dart-migrate-to-checks-package
Skill1 starsChanged 6 months agoBSD-3-ClauseView on GitHub
Replace the usage of `expect` and similar functions from `package:matcher` to `package:checks` equivalents.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- dart-lang/skillstheir own version, first seen Oct 16, 2026
- zhouycheng/skillstheir own version, first seen Oct 13, 2026
- flutter/skillstheir own version, first seen Oct 8, 2026
- hjdspace/SpaceCodetheir own version, first seen Jul 21, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- flutter/skills★ 3.2ksame name
- dart-lang/skills★ 548same name
- hjdspace/SpaceCode★ 4same name
- zhouycheng/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dart-add-unit-testSkill
- dart-build-cli-appSkill
- dart-collect-coverageSkill
- dart-fix-runtime-errorsSkill
- dart-generate-test-mocksSkill
- dart-resolve-package-conflictsSkill
- dart-run-static-analysisSkill
- dart-use-pattern-matchingSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 0 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Add package:checks as a dev_dependency using dart pub add dev:checks.
- Very specific: line 21
Remove package:matcher if it is explicitly listed in the pubspec.yaml (note: it is often transitively included by package:test, which is …
- Very specific: line 22
Import package:checks/checks.dart in all test files undergoing migration.
- Very specific: line 30
Cascades for Multiple Checks: Use Dart's cascade operator (..) to chain multiple expectations on a single subject.
- Very specific: line 32
If checking a Future, await the check call: await check(someFuture).completes((r) => r.equals(expected));.
- Very specific: line 33
If checking a Stream, wrap it in a StreamQueue for multiple checks, or use .withQueue for single/broadcast checks.
- Very specific: line 48
Run the analyze_files tool on the modified test directories.
- Very specific: line 54
Run the run_tests tool.
- Very specific: line 55
If tests fail, review the failure output.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Migrating Dart Tests to Package Checks
Contents
- Dependency Management
- Syntax Migration Guidelines
- Utilizing Dart MCP Tools
- Migration Workflow
- Examples
Dependency Management
Manage dependencies using the Dart Tooling MCP Server pub tool or standard CLI commands.
- Add
package:checksas adev_dependencyusingdart pub add dev:checks. - Remove
package:matcherif it is explicitly listed in thepubspec.yaml(note: it is often transitively included bypackage:test, which is fine). - Import
package:checks/checks.dartin all test files undergoing migration.
Syntax Migration Guidelines
Transition test assertions from the package:matcher syntax to the literate API provided by package:checks.
- Basic Equality: Replace
expect(actual, equals(expected))orexpect(actual, expected)withcheck(actual).equals(expected). - Type Checking: Replace
expect(actual, isA<Type>())withcheck(actual).isA<Type>(). - Property Extraction: Replace
expect(actual.property, expected)withcheck(actual).has((a) => a.property, 'property name').equals(expected). - Cascades for Multiple Checks: Use Dart's cascade operator (
..) to chain multiple expectations on a single subject. - Asynchronous Expectations:
- If checking a
Future,awaitthecheckcall:await check(someFuture).completes((r) => r.equals(expected));. - If checking a
Stream, wrap it in aStreamQueuefor multiple checks, or use.withQueuefor single/broadcast checks.
- If checking a
Migration Workflow
Copy and use the following checklist to track progress when migrating a test suite:
- Task Progress
- Add
package:checksas a dev dependency. - Identify all test files using
package:matcher(expectcalls). - Import
package:checks/checks.dartin target test files. - Rewrite all
expect(...)statements tocheck(...)statements. - Run static analyzer (
analyze_files). - Run tests (
run_tests).
- Add
Feedback Loop: Static Analysis
- Run the
analyze_filestool on the modified test directories. - Review any static analysis warnings or errors (e.g., missing imports, incorrect generic types on
isA, unawaited futures). - Fix the warnings.
- Repeat until the analyzer returns zero issues.
Feedback Loop: Test Validation
- Run the
run_teststool. - If tests fail, review the failure output.
package:checksprovides detailed context (e.g.,Which: has length of <2>). - Adjust the
check()expectations or the underlying code to resolve the failure. - Repeat until all tests pass.
Examples
Basic Assertions
Input (matcher):
expect(someList.length, 1);
expect(someString, startsWith('a'));
expect(someObject, isA<Map>());Output (checks):
check(someList).length.equals(1);
check(someString).startsWith('a');
check(someObject).isA<Map>();Composed Expectations
Input (matcher):
expect('foo,bar,baz', allOf([
contains('foo'),
isNot(startsWith('bar')),
endsWith('baz')
]));Output (checks):
check('foo,bar,baz')
..contains('foo')
..not((s) => s.startsWith('bar'))
..endsWith('baz');Asynchronous Futures
Input (matcher):
expect(Future.value(10), completion(equals(10)));
expect(Future.error('oh no'), throwsA(equals('oh no')));Output (checks):
await check(Future.value(10)).completes((it) => it.equals(10));
await check(Future.error('oh no')).throws<String>().equals('oh no');Asynchronous Streams
Input (matcher):
var stdout = StreamQueue(Stream.fromIterable(['Ready', 'Go']));
await expectLater(stdout, emitsThrough('Ready'));Output (checks):
var stdout = StreamQueue(Stream.fromIterable(['Ready', 'Go']));
await check(stdout).emitsThrough((it) => it.equals('Ready'));Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

