dart-test-coverage
Understand and improve test coverage in a Dart package. Helps agents run coverage, interpret results, and identify missed lines.
What this skill does
# 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.
## Discovery
To find areas lacking test coverage:
### Run Coverage Analysis
Follow the workflow to generate and interpret coverage data:
1. **Run Tests with Coverage**: `dart test --coverage=.dart_tool/coverage`
2. **Interpret Results**: Use the script or `format_coverage` as described in
the **Interpreting Results** section to identify specific files and missed
lines.
## How to use this skill (The Workflow)
1. Ensure tests pass by running `dart test`.
2. Collect coverage by running `dart test --coverage=.dart_tool/coverage`.
3. Interpret the results using the provided script or standard tools.
4. Add tests to cover missed lines.
## Running Coverage
Run the following command to collect coverage in JSON format:
```bash
dart test --coverage=.dart_tool/coverage
```
> [!NOTE]
> We use `.dart_tool/coverage` as the output directory because `.dart_tool`
> is typically already ignored in `.gitignore` files.
> [!TIP]
> For projects with complex conditional logic, you can pass the
> `--branch-coverage` flag to `dart test` to 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):
```bash
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:
```bash
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:
1. **State the high-level percentage first** to give immediate context.
2. **Identify specific files and missed lines** clearly.
3. **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 `divide` function is missing coverage").
4. **Propose concrete fixes**: Provide example test code that the user can
immediately apply to cover the missed lines.
5. **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/coverage` directory.
- Focus coverage improvements on `lib/` files, not `test/` or generated files.
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.