一键导入
dart-test-coverage
Understand and improve test coverage in a Dart package. Helps agents run coverage, interpret results, and identify missed lines.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Understand and improve test coverage in a Dart package. Helps agents run coverage, interpret results, and identify missed lines.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
An elite Flutter & Dart engineer persona. Use this agent for writing, reviewing, or fixing Dart/Flutter code according to strict MVVM architecture, high-performance rendering, and modern Dart semantics.
Guidelines and best practices for writing microbenchmarks, analyzing GC overhead, and evaluating performance on VM, JS, and WASM compilation targets.
Execute `dart analyze` to identify warnings and errors, and use `dart fix --apply` to automatically resolve mechanical lint issues. Use during development to ensure code quality and before committing changes.
Adds interactive widget previews to the project using the previews.dart system. Use when creating new UI components or updating existing screens to ensure consistent design and interactive testing.
Implement a component-level test using `WidgetTester` to verify UI rendering and user interactions (tapping, scrolling, entering text). Use when validating that a specific widget displays correct data and responds to events as expected.
Architects a Flutter application using the recommended layered approach (UI, Logic, Data). Use when structuring a new project or refactoring for scalability.
| name | dart-test-coverage |
| description | Understand and improve test coverage in a Dart package. Helps agents run coverage, interpret results, and identify missed lines. |
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 .agent/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.