skills/dart-test-coverage/SKILL.md
Understand and improve test coverage in a Dart package. Helps agents run coverage, interpret results, and identify missed lines.
npx skillsauth add kevmoo/dash_skills dart-test-coverageInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Guidelines for running and interpreting test coverage in Dart packages.
To find areas lacking test coverage:
Follow the workflow to generate and interpret coverage data:
dart test --coverage=.dart_tool/coverageformat_coverage as described in
the Interpreting Results section to identify specific files and missed
lines.dart test.dart test --coverage=.dart_tool/coverage.Run the following command to collect coverage in JSON format:
dart test --coverage=.dart_tool/coverage
[!NOTE] We use
.dart_tool/coverageas the output directory because.dart_toolis typically already ignored in.gitignorefiles.
[!TIP] For projects with complex conditional logic, you can pass the
--branch-coverageflag todart testto collect branch-level coverage.
This repository includes a zero-dependency script that parses the raw JSON output and provides a summary of covered percentage and missed lines.
Run it from the project root (adjust path to script as needed):
dart run skills/dart-test-coverage/scripts/interpret_coverage.dart .dart_tool/coverage <package_name>
Replace <package_name> with the name from pubspec.yaml.
Example Output:
package:my_pkg/src/file.dart: 50.0% (2/4 lines)
Missed lines: 3, 4
If package:test is installed, package:coverage is likely available as a
transitive dependency. You can use its format_coverage tool.
To get a human-readable "pretty print" of the coverage:
dart run coverage:format_coverage --in=.dart_tool/coverage --out=stdout --pretty-print --report-on=lib
This will output the file content with hit counts on the left (e.g., 0| for
missed lines).
When presenting coverage results to the user, follow these guidelines:
divide function is missing coverage")..dart_tool/coverage directory.lib/ files, not test/ or generated files.testing
Core concepts and best practices for `package:test`. Covers `test`, `group`, lifecycle methods (`setUp`, `tearDown`), and configuration (`dart_test.yaml`).
documentation
Guidelines for maintaining external Dart packages, covering versioning, publishing workflows, and pull request management. Use when updating Dart packages, preparing for a release, or managing collaborative changes in a repository.
development
Guidelines and best practices for refactoring consecutive prints, single-line string concatenations, and complex output blocks into triple-quoted multi-line string literals (''' or """) in Dart.
tools
Guidelines for using modern Dart features (v3.0 - v3.10) such as Records, Pattern Matching, Switch Expressions, Extension Types, Class Modifiers, Wildcards, Null-Aware Elements, and Dot Shorthands.