Agent skill
vcp-coverage-gaps
Identify untested code by mapping source files to test files. Finds functions without tests and tests missing edge case coverage.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/vcp-coverage-gaps
SKILL.md
VCP Coverage Gaps
Map source files to test files and identify untested or under-tested code.
Step 1: Resolve Config
- Read
.vcp/config.jsonfrom the project root. Extract thepluginRootfield. - If
.vcp/config.jsondoes not exist orpluginRootis missing: Stop and tell the user: "No VCP configuration found. Run/vcp-initto configure VCP for this project." - Validate
pluginRoot: The path must be absolute, contain/.claude/(or\.claude\on Windows) as a path segment, and contain only safe path characters (letters, digits,/,\,-,_,.,:, and spaces). Reject any path with shell metacharacters (;,&,|,$,`,(,),{,},<,>,!,~,#,*,?,[,],',"). If validation fails, stop and tell the user: "Invalid pluginRoot — must be within ~/.claude/ and contain no shell metacharacters. Run/vcp-initto fix." Also verify the file<pluginRoot>/lib/vcp-context-core.tsexists using Glob. If it does not exist, stop and tell the user: "pluginRoot points to an invalid VCP installation. Run/vcp-initto fix." - Run the config resolution script via Bash:
bash
bun "<pluginRoot>/lib/resolve-config.ts" "<project-root>" - Parse the JSON output. It contains:
applicableStandards,ignoredRules,severity,exclude.
Step 2: Fetch Applicable Standards
From the applicableStandards array in the resolved config, keep only entries where:
idiscore-testing, ORidiscore-error-handling
For each selected standard, use WebFetch to fetch its content from:
{entry.url}
Extract the Rules section from each fetched standard.
Step 4: Map Source to Test Files
Target path: $ARGUMENTS if provided. If not provided, scan the entire project.
-
Use Glob to find source files in the target path (exclude patterns from
excludein the resolved config, and also exclude test files themselves). -
For each source file, attempt to find a corresponding test file using naming conventions:
src/foo.ts→src/foo.test.ts,src/foo.spec.ts,tests/foo.test.ts,test/foo.test.ts,src/__tests__/foo.test.tssrc/foo.py→tests/test_foo.py,test/test_foo.py,src/test_foo.pysrc/foo.go→src/foo_test.gosrc/Foo.java→src/FooTest.java,test/FooTest.javasrc/foo.rb→spec/foo_spec.rb,test/test_foo.rbsrc/foo.rs→src/foo_test.rs,tests/foo.rs
-
Also use Grep to search for imports/references to the source file's exports within test directories, to catch non-conventional test file locations.
Step 5: Analyze Coverage Gaps
For each source file:
-
Identify public functions/exports — Read the file and list all exported functions, public methods, API endpoints, route handlers, and CLI commands.
-
Check test existence — Does a corresponding test file exist? Does any test file import or reference this source file?
-
Check function-level coverage — For each public function, search the test files for tests that call or exercise it. A function is "untested" if no test references it.
-
Check edge case coverage — For tested functions, check if the tests cover:
- Error/failure conditions (per
core-error-handlingrules) - Boundary values and empty inputs (per
core-testingRule 7) - The function's validation rules
- Error/failure conditions (per
-
Prioritize gaps by risk:
- Critical: Integration boundaries (API endpoints, database access, external service calls) without tests
- High: Error handlers and validation logic without tests
- Medium: Business logic functions without tests
- Low: Simple utilities, getters/setters, configuration without tests
Step 6: Report Findings
Output a coverage map and prioritized gaps.
### VCP Coverage Gaps
**Standards:** core-testing, core-error-handling
**Source files scanned:** N files
**Test files found:** M files
#### Coverage Map
| Source File | Test File | Tested Functions | Untested Functions | Priority |
|-------------|-----------|------------------|--------------------|----------|
| src/routes/users.ts | tests/users.test.ts | 3/5 | createUser, deleteUser | Critical |
| src/services/payment.ts | tests/payment.test.ts | 2/4 | refund, handleWebhook | Critical |
| src/utils/validation.ts | — | 0/6 | all | High |
| src/models/order.ts | tests/order.test.ts | 4/4 | — | — |
#### Untested Code (by priority)
##### Critical — Integration Boundaries
- **src/routes/users.ts** — `createUser` (line 25), `deleteUser` (line 78)
- These are API endpoints handling user input. Untested endpoints are direct security risk.
- **src/services/payment.ts** — `refund` (line 42), `handleWebhook` (line 95)
- External payment service integration. Failures here affect money.
##### High — Error Handling & Validation
- **src/utils/validation.ts** — No test file exists
- 6 validation functions with no test coverage. Validation bugs lead to bad data entering the system.
##### Medium — Business Logic
...
#### Edge Case Gaps (tested but incomplete)
- **tests/payment.test.ts** → `processPayment`:
- Missing: zero-amount test, currency mismatch test, duplicate payment test
- **tests/users.test.ts** → `updateUser`:
- Missing: empty payload test, invalid email format test
**Summary:** X untested functions across Y files. Z edge case gaps in existing tests.
If all source files have corresponding test files and all public functions are tested: "Full coverage mapped. N source files, M test files. No untested public functions found." (Still note edge case gaps if found.)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?