analyze-test-coverage
Analyze test coverage gaps and prioritize what to test next. Use this skill whenever the user says "analyze test coverage", "what's our test coverage", "find gaps in test coverage", "which code isn't tested", "improve test coverage", "show me a coverage report", "coverage analysis", "where are we missing tests", "what's untested", "test coverage audit", or asks about coverage percentages or uncovered files. Also trigger when the user asks which areas to focus testing efforts on, or when they want to know what the test-writer agent should work on next.
What this skill does
# Test Coverage Analyzer Measure where tests are missing, identify high-impact coverage gaps, and produce a prioritized action list — so the next test-writing session targets the code that matters most. ## When to Activate - User asks about test coverage or coverage percentages - User wants to know which code isn't tested - User wants to find the highest-priority testing gaps - User is planning a testing sprint and needs direction - User asks what to pass to the test-writer agent ## Step 1: Detect Project Setup Scan the project to identify language, test framework, and coverage tooling: **Language / framework detection (check in order):** | Signal file | Stack | Coverage command | | ----------------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------ | | `vitest.config.*` or `vite.config.*` with test key | TypeScript/JS + Vitest | `npx vitest run --coverage` | | `jest.config.*` or `"jest"` in package.json | TypeScript/JS + Jest | `npx jest --coverage --coverageReporters=json-summary,text` | | `pyproject.toml` with `[tool.pytest]` or `pytest.ini` | Python + pytest | `python -m pytest --cov --cov-report=term-missing --cov-report=json` | | `go.mod` | Go | `go test ./... -coverprofile=coverage.out && go tool cover -func=coverage.out` | | `pom.xml` | Java + Maven/JaCoCo | `mvn test jacoco:report -q` | | `build.gradle` | Java + Gradle | `./gradlew test jacocoTestReport` | If multiple frameworks are detected (monorepo), scan for the subpackages and handle each separately. Check for existing coverage reports before running tools — they may be fresh: - `.coverage`, `coverage.json`, `coverage-summary.json`, `lcov.info`, `coverage.out` in common locations ## Step 2: Run Coverage Run the coverage command detected in Step 1. If you can't determine the command, check `package.json` scripts for a `coverage`, `test:coverage`, or `test:cov` target and run that. **Important:** Run from the directory that contains the test config, not necessarily the repo root. If the coverage run fails (compilation error, missing deps, no tests), report the failure clearly with the exact error — don't silently skip. A project with zero passing tests is itself a critical finding. ## Step 3: Parse the Report Extract file-level coverage data from whichever output format was produced: - **JSON summary** (`coverage-summary.json`): Read `total` and per-file `statements`, `branches`, `functions`, `lines` percentages - **LCOV** (`lcov.info`): Parse `DA:` (line hit/missed) and `BRH:` (branch hit/missed) records - **Go text output**: Parse `func coverage: X%` per package - **Terminal text** (pytest `--cov-report=term-missing`): Extract file paths and uncovered line ranges from the `MISS` column Build a table of files with their line coverage %, branch coverage %, and uncovered line ranges. ## Step 4: Score and Rank Coverage Gaps Don't sort by raw line count. Sort by **criticality of what's untested**: **Criticality signals (check each uncovered file/function for these):** 1. **Public API surface** — exported functions, class methods, REST/GraphQL handlers, CLI entry points. These are contracts that callers depend on. 2. **Error-handling branches** — `catch` blocks, error returns, fallback paths. Untested error paths are where production incidents hide. 3. **Business logic density** — files in `src/`, `lib/`, `domain/`, or `core/` with conditionals and state transformations. High cyclomatic complexity + low coverage = high risk. 4. **Data boundaries** — input parsers, validators, serializers/deserializers. Untested boundary code produces silent corruption. 5. **Security-adjacent code** — auth, permissions, rate-limiting, token handling. **Scoring heuristic (per file):** - Start with `(100 - line_coverage) * 0.5 + (100 - branch_coverage) * 0.5` as a base gap score - Multiply by 2× if the file exports public symbols - Multiply by 1.5× if the file contains `catch`, `error`, or `fallback` handlers - Multiply by 1.5× if the file path matches `auth`, `security`, `permission`, `token`, `payment` - Sort descending by final score ## Step 5: Report Output two sections: ### Coverage Summary ``` Overall: statements X%, branches X%, functions X%, lines X% Files scanned: N | Files at 0% coverage: M ``` Include a small table of the 10 worst-covered files (by raw line coverage), as context. ### Prioritized Gap List For the **top 10 files by criticality score**, output: ``` ## 1. src/auth/token-validator.ts (branch coverage: 34%) Uncovered: lines 45-67 (error path when token is expired), line 89 (refresh failure branch) Why it matters: exported validateToken() is called at every API boundary; untested expiry/refresh paths are a common incident vector Suggested test: unit test for expired token, forged token, and refresh-failure scenarios ``` Adjust the "why it matters" explanation based on the criticality signals found in Step 4. If any file has **0% coverage** and is in the public API or business logic layer, call it out prominently at the top as a critical gap regardless of its ranked position. ## Step 6: Optional — Delegate to Test Writer If the user asks to also generate tests (e.g., "and write the tests" or "fix the top 3"), invoke the test-writer agent for the top N files from the prioritized list: Pass the agent: - The file path - The uncovered lines/branches identified above - The "why it matters" context - A note to focus on the error paths and branching scenarios, not just happy-path coverage ## Options | Flag | Description | | -------------------- | --------------------------------------------------------------- | | `--target <path>` | Limit analysis to a subdirectory or file | | `--min-coverage <N>` | Only report files below N% (default: 80) | | `--top <N>` | How many files to include in the prioritized list (default: 10) | | `--fix` | After reporting, invoke test-writer for the top 3 gaps | | `--skip-run` | Skip running coverage tools; parse existing reports only |
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.