CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

dart-use-pattern-matching

Applies Dart 3 pattern matching, switch expressions, and destructuring idiomatically to validate data schemas, handle algebraic data types, and decompose control flow. Use when refactoring complex if-else chains, parsing polymorphic JSON or API responses, destructuring Lists, URI/path segments, String.split() tokens, Records, or Maps, or enforcing exhaustiveness on sealed classes. Don't use for simple boolean conditions, single-variable type promotion (use `is`), or basic collection filtering.

Quality

91%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

Quality

Content

81%Weight 40%Scale 1-5

Reviews the quality of instructions and guidance provided to agents. Good implementation is clear, handles edge cases, and produces reliable results.

The body is highly actionable with executable code, clear prefer/avoid anti-pattern pairs, and strong feedback loops for both static and runtime verification. Its weaknesses are moderate redundancy (basic pattern-syntax re-explanation and repeated containsKey semantics) and a dangling reference to a nonexistent examples/json_patterns.dart file.

Suggestions

Remove or repair the two references to examples/json_patterns.dart — either add the example file to the bundle or inline the key parsing snippet, since Claude will currently attempt to read a file that does not exist.

Trim the Core Pattern Implementations and Switch Statements vs. Expressions sections to the non-obvious rules (variable-binding constraints, rest elements, containsKey semantics) and drop syntax definitions Claude already knows, such as wildcard and implicit break behavior.

State the map-pattern containsKey vs explicit-null behavior once (e.g. only in Feedback Loop 2) and have the checklist and Nested JSON example point back to it instead of restating it.

DimensionReasoningScore

Conciseness

"Wildcard (`_`): Matches any value and discards it" and "Non-empty cases implicitly break (no `break` keyword required)" re-explain basic Dart semantics Claude already knows, and the map-pattern `containsKey` behavior is stated three times (Feedback Loop 2, the Nested JSON Validation example, and the checklist item). This goes beyond the 'minor instances of over-explanation' of level 4, fitting the mostly-efficient-but-could-be-tightened anchor.

3 / 5

Actionability

Concrete, complete, executable Dart code throughout: prefer/avoid pairs for each anti-pattern, a full `resolveAllowedAssetSubpath` function, a sealed-class `calculateArea` switch expression, and the specific verification command `dart analyze` with the exact compiler error text to look for. Examples cover the common cases; only trivial gaps exist (e.g. the omitted `math` import in the area example).

5 / 5

Workflow Clarity

An ordered 8-item implementation checklist is provided, plus two explicit feedback loops: static exhaustiveness checking (run `dart analyze`, review "The type 'X' is not exhaustively matched by the switch cases", then add missing Object patterns or a wildcard arm) and runtime Map/JSON semantics verification with omitted-key vs explicit-null guidance. This matches the checklist-plus-feedback-loops anchor at the top of the scale.

5 / 5

Progressive Disclosure

Internal structure is good: a linked contents section and well-scoped sections (selection strategy, syntax reference, anti-patterns, workflows, examples). However, the body twice references "examples/json_patterns.dart" as an executable implementation, and no such file exists in the bundle (no examples/, references/, scripts/, or assets/ directories are present), so the navigation pointer is broken — a minor organization gap that keeps it below the well-signaled-resolving-references level 5.

4 / 5

Total

17

/

20

Passed

Description

100%Weight 40%Scale 1-5

Based on the skill's description, can an agent find and select it at the right time? Clear, specific descriptions lead to better discovery.

The description is exemplary: it states concrete capabilities in third person, provides an explicit and comprehensive "Use when" clause with natural trigger terms and synonyms, and adds "Don't use for" boundary guidance to prevent false triggers. No changes are needed.

DimensionReasoningScore

Specificity

Names the domain (Dart 3 pattern matching, switch expressions, destructuring) and multiple concrete actions: "validate data schemas, handle algebraic data types, and decompose control flow", destructuring Lists/Records/Maps/path segments, and "enforcing exhaustiveness on sealed classes". Coverage is comprehensive with no obvious gaps, matching the top anchor rather than the 'minor gaps' level 4.

5 / 5

Completeness

Explicitly answers "what" ("Applies Dart 3 pattern matching, switch expressions, and destructuring idiomatically to...") and "when" ("Use when refactoring complex if-else chains, parsing polymorphic JSON...") with concrete trigger phrases, plus negative triggers ("Don't use for simple boolean conditions, single-variable type promotion"). This clearly matches the both-what-and-when-with-concrete-triggers anchor.

5 / 5

Trigger Term Quality

"refactoring complex if-else chains", "parsing polymorphic JSON", "String.split() tokens", "URI/path segments", "sealed classes", and "Records" are exactly the natural phrases a Dart developer would say, including API-level synonyms. No common variant is obviously missing, so it fits the comprehensive-coverage anchor rather than level 4.

5 / 5

Distinctiveness Conflict Risk

Tightly scoped to Dart 3 pattern matching with distinct, domain-specific triggers (sealed classes, switch expressions, destructuring Records); the negative triggers further reduce misfires. Minimal conflict risk with other skills, matching the clear-niche anchor.

5 / 5

Total

20

/

20

Passed

Validation

87%

Checks the skill against the spec for correct structure and formatting. All validation checks must pass before discovery and implementation can be scored.

Validation — 14 / 16 Passed

Validation for skill structure

CriteriaDescriptionResult

metadata_version

'metadata.version' is missing

Warning

relative_links

Relative link issues: 2 missing

Warning

Total

14

/

16

Passed

Repository

flutter/agent-plugins

Path

skills/dart-use-pattern-matching/SKILL.md

Reviewed

Table of Contents

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.