
dart-test-coverage
Understand and improve test coverage in a Dart package. Helps agents run coverage, interpret results, and identify missed lines.
- Installs
- 157
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/kevmoo/dash_skills --skill dart-test-coverage- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads dart-test-coverage automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Dart Test Coverage
Guidelines for running and interpreting test coverage in Dart packages.
When to use this skill
- When asked to "check test coverage" or "improve coverage".
- When you need to identify which parts of a library are untested.
When NOT to use (Abstention Guardrails)
Do NOT collect or demand test coverage for:
- Generated Code: Code generated by builders (
*.g.dart,*.freezed.dart, protobufs). - Platform-Specific FFI / OS Entrypoints: Low-level platform bindings or entrypoints that require specific physical hardware or OS services not available in the execution environment.
- Example Applications & Tool Scripts: Standalone sample code under
example/or developer maintenance scripts undertool/unless the package explicitly mandates 100% repository-wide coverage. - Failing Test Suites: If existing tests are failing under
dart test, fix the broken tests first before collecting or reporting coverage.
Discovery
To find areas lacking test coverage:
Run Coverage Analysis
Follow the workflow to generate and interpret coverage data:
- Run Tests with Coverage:
dart test --coverage=.dart_tool/coverage - Interpret Results: Use the script or
format_coverageas described in the Interpreting Results section to identify specific files and missed lines.
How to use this skill (The Workflow)
- Ensure tests pass by running
dart test. - Collect coverage by running
dart test --coverage=.dart_tool/coverage. - Interpret the results using the provided script or standard tools.
- Add tests to cover missed lines.
Running 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.
Interpreting Results
Option 1: Use the custom interpreter script
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
Option 2: Use package:coverage
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).
Best Practices for Reporting Results
When presenting coverage results to the user, follow these guidelines:
- State the high-level percentage first to give immediate context.
- Identify specific files and missed lines clearly.
- Translate line numbers to code: Don't just say "lines 3-6 are missed".
Look at the source file and tell the user which functions or blocks are
untested (e.g., "The
dividefunction is missing coverage"). - Propose concrete fixes: Provide example test code that the user can immediately apply to cover the missed lines.
- Use tables for multi-file summaries: When reporting on multiple files, use a markdown table with columns for File, Coverage %, and Missed Lines to make the summary easy to scan.
Constraints
- ALWAYS verify that tests pass before collecting coverage.
- DO NOT commit the
.dart_tool/coveragedirectory. - Focus coverage improvements on
lib/files, nottest/or generated files.
FAQ
What does the dart-test-coverage skill do?
Understand and improve test coverage in a Dart package. Helps agents run coverage, interpret results, and identify missed lines.
How do I install dart-test-coverage?
Run npx skills add https://github.com/kevmoo/dash_skills --skill dart-test-coverage in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/dart-test-coverage/ (personal) or .claude/skills/dart-test-coverage/ (project).
Which AI agents can use dart-test-coverage?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is dart-test-coverage safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains dart-test-coverage?
It is published by kevmoo in kevmoo/dash_skills. It has 157 recorded installs.
More from kevmoo/dash_skills
dart-best-practices
kevmoo/dash_skills
General best practices for Dart development. Covers code style, effective Dart, and language features.
dart-test-fundamentals
kevmoo/dash_skills
Core concepts and best practices for package:test. Covers test, group, lifecycle methods (setUp, tearDown), and configuration (darttest.yaml).
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.
dart-doc-validation
kevmoo/dash_skills
Best practices for validating Dart documentation comments. Covers using dart doc to catch unresolved references and macros.
dart-package-maintenance
kevmoo/dash_skills
Open the skill to read its SKILL.md instructions.
dart-matcher-best-practices
kevmoo/dash_skills
Best practices for using expect and package:matcher. Focuses on readable assertions, proper matcher selection, and avoiding common pitfalls.
Popular testing & qa skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
grilling
mattpocock/skills
Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
migrate-to-shoehorn
mattpocock/skills
Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.
run-train
lllllllama/rigorpilot-skills
Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.
test-driven-development
obra/superpowers
Use when implementing any feature or bugfix, before writing implementation code
finishing-a-development-branch
obra/superpowers
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work