SKILL.md

Three modes over one pipeline. Pick the mode from user intent.

Mode Selection

ModeTrigger phrasesReadsWrites
RUN (default)“run the tests”, “are tests green”, “npm test”, “pytest”, “test results”Source + testsNothing — stdout report only
COVERAGE”coverage”, “measure coverage”, “test gaps”, “what’s my coverage”, “coverage report”Source + tests + coverage outputCoverage artifacts (coverage/, coverage.out) — no source modification
GENERATE”fill coverage gaps”, “generate missing tests”, “improve coverage”, “tests for uncovered lines”Source + existing testsNew test files in the project

When the user intent is ambiguous between RUN and COVERAGE, ask: “Do you want pass/fail or coverage metrics?”

Skip When

  • User is implementing a new feature with tests (RED → GREEN → REFACTOR) — use codi-tdd
  • User has a specific failing test to debug — use codi-debugging
  • User wants to review test quality (style, assertions, mocks) — use codi-code-review
  • User wants to remove dead / uncovered code — use codi-refactoring
  • User wants a full codi installation audit (contributor-only) — use codi-dev-e2e-testing
  • User wants systematic multi-phase QA — use codi-guided-qa-testing

Framework Detection (all modes)

[SYSTEM] Identify the test framework from the project manifest:

SignalFramework
package.json devDependencies has vitestVitest
package.json devDependencies has jestJest
package.json devDependencies has mocha / avaMocha / Ava
pyproject.toml or setup.cfg has pytestPytest
go.mod presentGo go test
Cargo.toml presentRust cargo test
*.csproj / *.sln present.NET dotnet test

If no framework can be detected, report that and ask the user to confirm.


Mode: RUN

Use when the user wants pass/fail feedback.

Step 1 — Detect (see Framework Detection above)

Step 2 — Execute

[SYSTEM] Run the suite:

FrameworkCommand
Node.jsnpm test / pnpm test / yarn test
Pythonpytest
Gogo test ./...
Rustcargo test
.NETdotnet test

Step 3 — Report

[CODING AGENT] Summarize:

  • Total: passed, failed, skipped
  • For each failure:
    • Test name, file, and error message
    • Distinguish pre-existing failures from new ones — run git stash and re-run if needed to isolate
    • Suggest a specific fix (route to codi-debugging for root-cause work)
  • If all pass, confirm with a one-line summary

Mode: COVERAGE

Use when the user wants to measure current coverage or identify gaps. Read-only — does not modify source or generate tests.

Step 1 — Detect (see Framework Detection above)

Step 2 — Run Coverage Analysis

[SYSTEM] Execute the coverage command:

FrameworkCommand
Jestnpx jest --coverage --coverageReporters=text --coverageReporters=json-summary
Vitestnpx vitest run --coverage
Pytestpytest --cov=src --cov-report=term-missing --cov-report=json
Gogo test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out
Rustcargo tarpaulin --out json

Record the baseline coverage numbers.

Step 3 — Identify Coverage Gaps

[CODING AGENT] Parse the coverage output:

  • Files below the 80% coverage threshold
  • Specific uncovered line ranges in each file
  • Functions or methods with zero coverage
  • Branches (if/else, switch) only partially covered

Sort files by coverage gap size (lowest first).

Step 4 — Report

[CODING AGENT] Produce a concise gap report:

  • Overall coverage (percentage)
  • Files below threshold, sorted by gap
  • Top 3 highest-impact gaps (large file × low coverage)
  • Recommendation: stay in COVERAGE mode for a second look, or switch to GENERATE mode to fill gaps

Mode: GENERATE

Use when the user wants to fill coverage gaps with new tests. Writes new test files. Requires COVERAGE data first.

Step 1-3 — Run COVERAGE Steps 1-3

Step 4 — Prioritize Test Generation

[CODING AGENT] For each uncovered area, prioritize:

  1. Happy path — Normal successful execution paths
  2. Error handling — Catch blocks, error returns, validation failures
  3. Edge cases — Empty inputs, null values, boundary conditions
  4. Branch coverage — Untested conditional branches

Skip generating tests for:

  • Auto-generated code (protobuf, GraphQL codegen)
  • Configuration files or type definitions
  • Third-party library wrappers with no logic

Step 5 — Generate Missing Tests

[CODING AGENT] For each gap:

  • Read the source file to understand the function behavior
  • Read existing tests in adjacent test files to match patterns and style
  • Generate tests following arrange-act-assert (AAA)
  • Use descriptive names: “should [behavior] when [condition]”
  • Place tests adjacent to source files following project convention
  • Mock only external dependencies (APIs, databases, file system)

Delegate to the specialized agent for higher quality:

  • codi-test-generator — prompt at ${CLAUDE_SKILL_DIR}[[/agents/test-generator.md]]

Step 6 — Review Generated Tests

[CODING AGENT] Before finalizing:

  • codi-code-reviewer — prompt at ${CLAUDE_SKILL_DIR}[[/agents/code-reviewer.md]]

Step 7 — Verify and Report

[SYSTEM] Re-run the coverage command.

[CODING AGENT] Produce a before/after comparison:

  • Overall coverage: before vs after (percentage delta)
  • Per-file improvements
  • Files still below 80% threshold
  • Remaining gaps requiring manual attention (complex logic, integration points)
  • Total tests added and their file locations

  • codi-tdd — RED → GREEN → REFACTOR for new features
  • codi-debugging — Root-cause analysis for failing tests
  • codi-refactoring — Remove dead / uncovered code after analysis
  • codi-guided-qa-testing — Multi-phase systematic QA sweep