Skip to main content

Test Coverage Command

System Prompt

⚠️ EXECUTION DIRECTIVE: When the user invokes this command, you MUST:

  1. IMMEDIATELY execute - no questions, no explanations first
  2. ALWAYS show full output from script/tool execution
  3. ALWAYS provide summary after execution completes

DO NOT:

  • Say "I don't need to take action" - you ALWAYS execute when invoked
  • Ask for confirmation unless requires_confirmation: true in frontmatter
  • Skip execution even if it seems redundant - run it anyway

The user invoking the command IS the confirmation.


Usage

/test-coverage

Analyze coverage and identify gaps: $ARGUMENTS

Coverage Analysis

Full Analysis

python3 scripts/test-suite.py --coverage

Category-Specific

python3 scripts/test-suite.py --coverage --category AGENTS

Coverage Metrics

Category Thresholds

CategoryTargetDescription
AGENTS100%All agents must have tests
COMMANDS100%All commands must have tests
SKILLS95%95% skill coverage
SCRIPTS90%90% script coverage
CONFIG100%All configs validated
DOCS85%85% doc validation
SECURITY100%All patterns checked

Calculation Formula

Coverage % = (Tested Components / Total Components) * 100

Output Format

Summary Table

| Category | Total | Tested | Coverage | Status |
|----------|-------|--------|----------|--------|
| AGENTS | 107 | 107 | 100.0% | PASS |
| COMMANDS | 103 | 103 | 100.0% | PASS |
| SKILLS | 61 | 58 | 95.1% | PASS |
| SCRIPTS | 21 | 19 | 90.5% | PASS |

Gap Identification

## Coverage Gaps

### SKILLS (3 untested)
1. skills/example-skill/SKILL.md - Missing frontmatter validation
2. skills/another-skill/SKILL.md - Missing metadata check
3. skills/new-skill/SKILL.md - Not registered

### SCRIPTS (2 untested)
1. scripts/utility.py - No syntax validation
2. scripts/helper.sh - No execution test

Arguments

ArgumentDescriptionDefault
--categorySpecific categoryAll
--thresholdMinimum coverage %95
--gaps-onlyShow only gapsfalse
--jsonJSON outputfalse

Integration

CI/CD Quality Gate

- name: Check Coverage
run: |
python3 scripts/test-suite.py --coverage --json
COVERAGE=$(jq -r '.coverage.overall' test-results/coverage.json)
if (( $(echo "$COVERAGE < 95" | bc -l) )); then
echo "Coverage $COVERAGE% below 95% threshold"
exit 1
fi

Pre-Push Hook

- id: coverage-check
name: Coverage Gate
entry: python3 scripts/test-suite.py --coverage --threshold 95
language: system

Examples

Standard Coverage Report

/test-coverage

Check Specific Category

/test-coverage --category AGENTS

Show Only Gaps

/test-coverage --gaps-only

Custom Threshold

/test-coverage --threshold 90

Coverage Improvement Workflow

Step 1: Identify Gaps

/test-coverage --gaps-only

Step 2: Prioritize by Impact

  • P0: Security, Config, Structure
  • P1: Agents, Commands, Skills
  • P2: Docs, Quality, XRef

Step 3: Add Tests

# Add test for untested component
def test_new_component():
result = validate_component("path/to/component")
assert result.status == "PASS"

Step 4: Verify Improvement

/test-coverage

Action Policy

<default_behavior> Analyzes coverage without making changes. Reports:

  • Coverage percentage by category
  • Components with missing tests
  • Gap prioritization roadmap
  • Trend comparison (if previous data exists) </default_behavior>
After analysis, verify: - All categories analyzed - Gaps clearly identified - Prioritization provided - Actionable improvement steps listed

Success Output

When coverage analysis completes:

✅ COMMAND COMPLETE: /test-coverage
Scope: <all|category>
Overall: XX%
Categories: N analyzed
Gaps: M identified
Status: PASS|FAIL

Completion Checklist

Before marking complete:

  • All categories analyzed
  • Coverage calculated
  • Gaps identified
  • Status determined

Failure Indicators

This command has FAILED if:

  • ❌ Test suite not found
  • ❌ Script execution failed
  • ❌ Coverage calculation error
  • ❌ No output generated

When NOT to Use

Do NOT use when:

  • Need to run tests (use test-suite)
  • Need to generate tests (use /test-generate)
  • No test infrastructure exists

Anti-Patterns (Avoid)

Anti-PatternProblemSolution
Ignore gapsFalse confidenceAddress gaps systematically
Chase 100%Diminishing returnsFocus on critical paths
Skip securityVulnerable codeAlways 100% security coverage

Principles

This command embodies:

  • #9 Based on Facts - Measured coverage
  • #6 Clear, Understandable - Visual gap reporting

Full Standard: CODITECT-STANDARD-AUTOMATION.md