dart-test-coverage
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "dart-test-coverage" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-e227c1bdb8806328dd021242c92b54d69260482df880939034898358e4cc4fc8. Verify the upstream source and version against https://github.com/kevmoo/dash_skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Understand and improve test coverage for Dart packages: assist agents in running coverage checks, interpreting results, and identifying untested lines of code to guide coverage improvement.
Introduction source: third_party · kevmoo · 0.0.1 Reference
SkillPi interpretation
- Tasks
- |-
- Audience
- When asked to "check test coverage" or "improve coverage". When you need to identify which parts of a library are untested.
- Limits and differences
- ALWAYS verify that tests pass before collecting coverage. DO NOT commit the `.dart_tool/coverage` directory. Focus coverage improvements on `lib/` files, not `test/` or generated files.
- Testing
- Not tested
Browse files
Frontmatter
name: dart-test-coverage
description: |-
Understand and improve test coverage in a Dart package.
Helps agents run coverage, interpret results, and identify missed lines.
key_features:
- LCOV report collection
- Missed line identification
- Coverage analysis & improvementDart 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.
Current listing version
0.0.1
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 针对 Dart 包的测试覆盖率分析与改进,属于明确场景的通用工具,具有广泛受众(Dart 开发者)
- 提供了从运行测试、收集覆盖率、解释结果到提出改进建议的完整闭环流程
Highlights
- description 明确描述功能(理解并提高 Dart 包的测试覆盖率)
- 'When to use this skill' 提供了清晰的触发场景(如 'check test coverage' 或 'improve coverage'),边界清晰
Highlights
- 结构清晰,包含 When to use/NOT to use、Discovery、Workflow、Running Coverage、Interpreting Results、Best Practices、Constraints 等完整章节
- 步骤划分明确,有端到端示例和命令,frontmatter 完整
Highlights
- 工具来源明确(dart test, package:coverage),参数正确
- 覆盖了主要异常(如测试失败时不应收集覆盖率、忽略生成代码等),有明确的约束和最佳实践指导
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.