Agent skill

Dart Matcher Best Practices

by kevmoo in kevmoo/dash_skills

Best practices for using expect and package:matcher. An agent skill from kevmoo/dash_skills.

Apache-2.0Auto-check passedMobile

Install Dart Matcher Best Practices

skills CLI
$ npx skills add kevmoo/dash_skills --skill dart-matcher-best-practices -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install kevmoo/dash_skills dart-matcher-best-practices --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/kevmoo/dash_skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/dart-matcher-best-practices .claude/skills/dart-matcher-best-practices && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
dart-matcher-best-practices
GitHub stars
147
Token cost
~1.6k tokens
SKILL.md length
542 words
Files
2
Skills in repo
12
Repo updated
First seen
Licence
Apache-2.0

At a glance

Best practices for using expect and package:matcher. An agent skill from kevmoo/dash_skills.

  • Works in 6 steps: Collections (hasLength, contains,… → Type Checks (isA and TypeMatcher) → Object Properties (having) → …
  • Tasks that involve Cross-platform mobile apps
  • SKILL.md covers When to use this skill, Discovery, Core Matchers and Principles, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Dart Matcher Best Practices is an agent skill from kevmoo/dash_skills. Best practices for using expect and package:matcher. Focuses on readable assertions, proper matcher selection, and avoiding common pitfalls.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `evals/evals.json`).

It sits in Mobile, covering Cross-platform mobile apps. It works with Dart. The repository describes itself as: Agent Skills for Dart and Flutter ecosytem. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Cross-platform mobile apps

Example prompts

  • “/dart-matcher-best-practices”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Collections (hasLength, contains, isEmpty, unorderedEquals, containsPair)
  2. Type Checks (isA and TypeMatcher)
  3. Object Properties (having)
  4. Async Assertions
  5. Exception Testing (Avoid try/catch with fail())
  6. Using expectLater

What it can do on your machine

Read from SKILL.md and the folder at commit 397a703. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are dart).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Dart Matcher Best Practices loads about 1.6k tokens when it runs. Until then it costs about 43 tokens; SKILL.md has 542 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~43
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from kevmoo/dash_skills at commit 397a703, republished under its Apache-2.0 licence (© kevmoo). 542 words, ~1,553 tokens.

Download SKILL.mdSave it as .claude/skills/dart-matcher-best-practices/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
dart-matcher-best-practices
description
Best practices for using `expect` and `package:matcher`. Focuses on readable assertions, proper matcher selection, and avoiding common pitfalls.
license
Apache-2.0
key_features
Package matcher assertions, Readable test expectations, Matcher selection & refactoring

Dart Matcher Best Practices

When to use this skill

Use this skill when:

  • Writing assertions using expect and package:matcher.
  • Migrating legacy manual checks to cleaner matchers.
  • Debugging confusing test failures.
When NOT to use (Abstention Guardrails)

Do NOT apply this skill or refactor assertions when:

  • Non-Collection Properties: The property happens to be named .length but belongs to a non-collection class (e.g. geometric scalar magnitude on a Vector, duration on a buffer, or line segment distance). hasLength(n) expects an int on an Iterable, Map, or String.
  • Custom Domain Booleans: The boolean check tests an arbitrary domain property (e.g. expect(switch.isEnabled, isTrue)). Do not invent non-existent matchers.
  • Alternative Assertion Frameworks: The package has adopted package:checks (check(x)...). Do not revert checks back to package:matcher.
  • Already Idiomatic Assertions: Tests already use declarative matchers (hasLength, isEmpty, isNotEmpty, contains, containsPair, isA, throwsA). Abstain and make zero modifications.

Discovery

To find candidates for improving matcher usage, search for suboptimal patterns:

Suboptimal Length Checks

Search for length checks that should use hasLength:

  • Regex: expect\([^,]+.length,\s*
Suboptimal Boolean Checks

Search for checks on boolean properties that have specific matchers:

  • Regex: expect\([^,]+.isEmpty,\s*(true|equals\(true\))
  • Regex: expect\([^,]+.isNotEmpty,\s*(true|equals\(true\))
  • Regex: expect\([^,]+.contains\(.*\),\s*(true|equals\(true\))
Suboptimal Map Lookups

Search for manual map lookups instead of containsPair:

  • Regex: expect\([^,]+\[.*\],\s*

Core Matchers

1. Collections (hasLength, contains, isEmpty, unorderedEquals, containsPair)
  • hasLength(n):

    • Prefer expect(list, hasLength(n)) over expect(list.length, n).
    • Gives better error messages on failure (shows actual list content).
  • isEmpty / isNotEmpty:

    • Prefer expect(list, isEmpty) over expect(list.isEmpty, true).
    • Prefer expect(list, isNotEmpty) over expect(list.isNotEmpty, true).
  • contains(item):

    • Verify existence without manual iteration.
    • Prefer over expect(list.contains(item), true).
  • unorderedEquals(items):

    • Verify contents regardless of order.
    • Prefer over expect(list, containsAll(items)).
  • containsPair(key, value):

    • Verify a map contains a specific key-value pair.
    • Prefer over checking expect(map[key], value) or expect(map.containsKey(key), true).
2. Type Checks (isA<T> and TypeMatcher<T>)
  • isA<T>():

    • Prefer for inline assertions: expect(obj, isA<Type>()).
    • More concise and readable than TypeMatcher<Type>().
    • Allows chaining constraints using .having().
  • TypeMatcher<T>:

    • Prefer when defining top-level reusable matchers.
    • Use const: const isMyType = TypeMatcher<MyType>();
    • Chaining .having() works here too, but the resulting matcher is not const.
Show full SKILL.md (219 more words)Show less
3. Object Properties (having)

Use .having() on isA<T>() or other TypeMatchers to check properties.

  • Descriptive Names: Use meaningful parameter names in the closure (e.g., (e) => e.message) instead of generic ones like p0 to improve readability.
dart
expect(person, isA<Person>()
    .having((p) => p.name, 'name', 'Alice')
    .having((p) => p.age, 'age', greaterThan(18)));

This provides detailed failure messages indicating exactly which property failed.

4. Async Assertions
  • completion(matcher):

    • Wait for a future to complete and check its value.
    • Prefer await expectLater(...) to ensure the future completes before the test continues.
    • await expectLater(future, completion(equals(42))).
  • throwsA(matcher):

    • Check that a future or function throws an exception.
    • await expectLater(future, throwsA(isA<StateError>())).
    • expect(() => function(), throwsA(isA<ArgumentError>())) (synchronous function throwing is fine with expect).
5. Exception Testing (Avoid try/catch with fail())
  • Prefer throwsA over imperative try/catch:
    • Legacy tests often use try { fn(); fail('should throw'); } catch (e) { expect(e, isA<T>()); }.
    • Replace with declarative matchers:
      dart
      // Synchronous:
      expect(() => parseData('invalid'), throwsA(isA<FormatException>()));
      
      // Asynchronous:
      await expectLater(client.fetch('bad-url'), throwsA(isA<HttpException>()));
    • Common built-in exception matchers include throwsArgumentError, throwsStateError, throwsRangeError, throwsFormatException, throwsNoSuchMethodError, and throwsUnsupportedError.
6. Using expectLater

Use await expectLater(...) when testing async behavior to ensure proper sequencing.

dart
// GOOD: Waits for future to complete before checking side effects
await expectLater(future, completion(equals(42)));
expect(sideEffectState, equals('done'));

// BAD: Side effect check might run before future completes
expect(future, completion(equals(42)));
expect(sideEffectState, equals('done')); // Race condition!

Principles

  1. Readable Failures: Choose matchers that produce clear error messages.
  2. Avoid Manual Logic: Don't use if statements or for loops for assertions; let matchers handle it.
  3. Specific Matchers: Use the most specific matcher available (e.g., containsPair for maps instead of checking keys manually).

© kevmoo, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in skills/dart-matcher-best-practices of kevmoo/dash_skills.

  • SKILL.md
  • evals/evals.json

Open the folder on GitHubat commit 397a703

Compare with similar skills

Dart Matcher Best Practices next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Dart Matcher Best Practices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Dart Matcher Best Practices this skillkevmoo/dash_skills147—~1.6kAutomated safety check: PassApache-2.0
Fjson Dart Bean GeneratorK3vinb5/unyo-app664—~2.2kAutomated safety check: PassBSD-3-Clause
Flutter Riverpod State Managementandrewyng/context-hub14k—~1.1kAutomated safety check: PassMIT
BlocVeryGoodOpenSource/vgv-ai-flutter-plugin170—~2kAutomated safety check: PassMIT
Flutter Dart Code Reviewaffaan-m/ECC277k2 repos~5.8kAutomated safety check: NotesMIT
Signals for Flutterrodydavis/signals.dart819—~1.9kAutomated safety check: PassApache-2.0

Similar skills

  • Generate Dart bean classes from JSON and regenerate serialization helpers using the fjson CLI.

    664 GitHub stars~2.2k tokensUpdated 4 mo ago
    MobileAuto-check passed
  • Guides Flutter state management with Riverpod: choosing provider types, wiring ConsumerWidgets, handling async state and lifecycle, and overriding providers in tests.

    14k GitHub stars~1.1k tokensUpdated 4 mo ago
    MobileAuto-check passed
  • Bloc

    VeryGoodOpenSource/vgv-ai-flutter-plugin

    Best practices for Bloc state management in Flutter/Dart, covering Cubit versus Bloc, event and state naming, sealed classes with Equatable, the Page/View split with BlocProvider, BlocBuilder…

    170 GitHub stars~2k tokensUpdated 5 days ago
    MobileAuto-check passed
  • Library-agnostic Flutter/Dart code review checklist covering widget best practices, state management patterns (BLoC, Riverpod, Provider, GetX, MobX, Signals), Dart idioms, performance…

    277k GitHub starsUsed in 2 repos~5.8k tokens
    MobileAuto-check: notes
  • Signals for Flutter

    rodydavis/signals.dart

    Reference for the signals_flutter package: reactive signals, computed values, effects, async signals and collection signals bound to Flutter widgets.

    819 GitHub stars~1.9k tokensUpdated 27 days ago
    MobileAuto-check passed
  • Taskflow

    MelbourneDeveloper/dart_node

    Build and run the full TaskFlow demo stack (Express backend + React frontend + mobile)

    113 GitHub stars~327 tokensUpdated 27 days ago
    MobileAuto-check: notes

More from kevmoo/dash_skills

All 12 skills in this repo
  • Dart Test Coverage

    kevmoo/dash_skills

    Understand and improve test coverage in a Dart package. An agent skill from kevmoo/dash_skills.

    147 GitHub stars~1.1k tokensUpdated 2 days ago
    Auto-check passed
  • Profile Dart Code

    kevmoo/dash_skills

    Profile Dart command-line applications using the VM Service protocol to capture CPU samples and identify performance bottlenecks.

    147 GitHub stars~1.1k tokensUpdated 2 days ago
    Auto-check passed
  • Dart Best Practices

    kevmoo/dash_skills

    General best practices for Dart development. An agent skill from kevmoo/dash_skills.

    147 GitHub stars~709 tokensUpdated 2 days ago
    Auto-check passed
  • Dart Doc Validation

    kevmoo/dash_skills

    Best practices for validating Dart documentation comments. An agent skill from kevmoo/dash_skills.

    147 GitHub stars~822 tokensUpdated 2 days ago
    Auto-check passed
  • Dart Long Lines

    kevmoo/dash_skills

    Guidelines for handling long lines in Dart code to adhere to the 80-column rule.

    147 GitHub stars~1k tokensUpdated 2 days ago
    Auto-check passed
  • Dart Modern Features

    kevmoo/dash_skills

    Guidelines for using modern Dart features (v3.0 - v3.10) such as Records, Extension Types, Class Modifiers, Wildcards, Digit Separators, Null-Aware Elements, and Dot Shorthands.

    147 GitHub stars~1.6k tokensUpdated 2 days ago
    Auto-check passed

Works with

Categories

Questions about Dart Matcher Best Practices

What does Dart Matcher Best Practices do?

Best practices for using expect and package:matcher. An agent skill from kevmoo/dash_skills. Dart Matcher Best Practices is an agent skill from kevmoo/dash_skills. Best practices for using expect and package:matcher.

When should I use Dart Matcher Best Practices?

Dart Matcher Best Practices fits situations like: tasks that involve Cross-platform mobile apps.

How do I install Dart Matcher Best Practices in Claude Code?

Run `npx skills add kevmoo/dash_skills --skill dart-matcher-best-practices -a claude-code`. Or copy the skill folder (skills/dart-matcher-best-practices in kevmoo/dash_skills) into .claude/skills/dart-matcher-best-practices in your project. Claude Code loads it when a task matches its description.

How do I install Dart Matcher Best Practices in Codex?

Run `npx skills add kevmoo/dash_skills --skill dart-matcher-best-practices -a codex`. Or copy the skill folder (skills/dart-matcher-best-practices in kevmoo/dash_skills) into .agents/skills/dart-matcher-best-practices in your project. Codex loads it when a task matches its description.

Can I use Dart Matcher Best Practices in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add kevmoo/dash_skills --skill dart-matcher-best-practices -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/dart-matcher-best-practices, .gemini/skills/dart-matcher-best-practices, .github/skills/dart-matcher-best-practices and .opencode/skills/dart-matcher-best-practices in your project.

What does Dart Matcher Best Practices need to run?

SKILL.md names no scripts, command-line tools or credentials: Dart Matcher Best Practices is instructions for the agent only.

Does Dart Matcher Best Practices access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Dart Matcher Best Practices safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Dart Matcher Best Practices use?

Dart Matcher Best Practices is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Dart Matcher Best Practices use?

About 1.6k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Dart Matcher Best Practices?

Skills that share tags, products or a category with Dart Matcher Best Practices: Fjson Dart Bean Generator (K3vinb5/unyo-app, 664 stars), Flutter Riverpod State Management (andrewyng/context-hub, 14k stars), Bloc (VeryGoodOpenSource/vgv-ai-flutter-plugin, 170 stars) and Flutter Dart Code Review (affaan-m/ECC, 277k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Dart Matcher Best Practices?

kevmoo (a GitHub user) maintains it in kevmoo/dash_skills, which has 147 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 8, 2026.

Source: kevmoo/dash_skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.