Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add sutchan/Agent-Skills-Hub --skill dart-use-pattern-matchinggit clone --depth 1 https://github.com/sutchan/Agent-Skills-HubWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/sutchan/agent-skills-hub/dart-use-pattern-matching)<a href="https://agentmods.dev/skills/sutchan/agent-skills-hub/dart-use-pattern-matching"><img src="https://agentmods.dev/badge/skills/sutchan/agent-skills-hub/dart-use-pattern-matching/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/sutchan/agent-skills-hub/dart-use-pattern-matching"><img src="https://agentmods.dev/badge/skills/sutchan/agent-skills-hub/dart-use-pattern-matching.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00014 | $0.01445 |
| Opus 5 | $0.00007 | $0.00723 |
| Sonnet 5 | $0.00003 | $0.00289 |
| Haiku 4.5 | $0.00001 | $0.00145 |
Grade A, and why
dart-use-pattern-matching scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
94% identical to dart-use-pattern-matching — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 147 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Implementing Dart Patterns
Contents
- Pattern Selection Strategy
- Switch Statements vs. Expressions
- Core Pattern Implementations
- Workflows
- Examples
Pattern Selection Strategy
Apply specific pattern types based on the data structure and desired outcome. Follow these conditional guidelines:
- If validating and extracting from deserialized data (e.g., JSON): Use Map and List patterns to simultaneously check structure and destructure key-value pairs.
- If handling multiple return values: Use Record patterns to destructure fields directly into local variables.
- If executing type-specific behavior (Algebraic Data Types): Use Object patterns combined with
sealedclasses to ensure exhaustiveness. - If matching numeric ranges or conditions: Use Relational (
>=,<=) and Logical-and (&&) patterns. - If multiple cases share logic: Use Logical-or (
||) patterns to share a single case body or guard clause. - If ignoring specific values: Use the Wildcard pattern (
_) or a non-matching Rest element (...) in collections.
Switch Statements vs. Expressions
Select the appropriate switch construct based on the execution context:
- If producing a value: Use a switch expression.
- Syntax:
switch (value) { pattern => expression, } - Rule: Each case must be a single expression. No implicit fallthrough. Must be exhaustive.
- Syntax:
- If executing statements or side effects: Use a switch statement.
- Syntax:
switch (value) { case pattern: statements; } - Rule: Empty cases fall through to the next case. Non-empty cases implicitly break (no
breakkeyword required).
- Syntax:
Core Pattern Implementations
Implement patterns using the following syntax and rules:
- Logical-or (
||):pattern1 || pattern2. Both branches must define the exact same set of variables. - Logical-and (
&&):pattern1 && pattern2. Branches must not define overlapping variables. - Relational:
==,!=,<,>,<=,>=followed by a constant expression. - Cast (
as):pattern as Type. Throws if the value does not match the type. Use to forcibly assert types during destructuring. - Null-check (
?):pattern?. Fails the match if the value is null. Binds the variable to the non-nullable base type. - Null-assert (
!):pattern!. Throws if the value is null. - Variable:
var nameorType name. Binds the matched value to a new local variable. - Wildcard (
_): Matches any value and discards it. - List:
[pattern1, pattern2]. Matches lists of exact length unless a Rest element (...or...var rest) is used. - Map:
{"key": pattern}. Matches maps containing the specified keys. Ignores unmatched keys. - Record:
(pattern1, named: pattern2). Matches records of the exact shape. Use:var nameto infer the getter name. - Object:
ClassName(field: pattern). Matches instances ofClassName. Use:var fieldto infer the getter name.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago Changed · -4 lines · -6 tokens per session 39d71b585417
- 8d ago First seen · 151 lines · 20 tokens per session scan A b993c9a2ad29
dart-use-pattern-matching is a skill published in the GitHub repository sutchan/Agent-Skills-Hub (2 stars, last pushed yesterday), licensed MIT. It adds 14 tokens to every session and 1,445 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 94% identical to dart-use-pattern-matching, differing in 0 lines, and is treated as a copy.
Other skills, from other repositories
js-backend-expert
Expert-level skill for Node.js 24+ (LTS), Bun 1.2+, and Deno 2.x backend development. Covers Express 5, Fastify 5, Hono v4, NestJS, Prisma 6, Drizzle ORM, WebSockets, BullMQ, OpenTelemetry, and microservices in English and Indonesian.
mvc-expert
Expert guidelines to refactor legacy PHP codebases into clean, modern, and scalable MVC-structured projects / Pedoman ahli untuk merefaktor codebase PHP lama menjadi proyek terstruktur MVC yang bersih, modern, dan skalabel.
python-programming-expert
Expert-level skill for Python programming (Python 3.13/3.14+). Covers type safety, generic syntax (PEP 695), async/await TaskGroups, FastAPI 0.115+, Pydantic v2, uv package manager, Ruff, and pytest in English and Indonesian.
typescript-expert
Expert guide for TypeScript 5.8+ advanced type system, strict mode, generics, utility types, branded types, inferred type predicates, isolated declarations, and type-safe architectural patterns / Panduan ahli untuk sistem tipe TypeScript 5.8+, mode strict, generics, utility types, branded types, inferred type…
database-orm-expert
Updated to be the unified database skill covering ORM, migrations, edge DBs, and Supabase CLI / Keahlian database terpadu untuk ORM, migrasi, edge DB, dan Supabase CLI.
go-programming-expert
Expert-level skill for Go programming (Go 1.25+). Covers high-performance microservices, concurrency patterns, sqlc, net/http, Gin/Echo/Fiber, gRPC, and testing in English and Indonesian.