Measures the specification coverage of one specification document: models its specifications with test techniques into coverage items, then checks off each coverage item a test verifies, finding the tests by the `// Test-basis:` comments in test files. Use this skill when the user asks how well a specification is tested, or which of its behaviors no test verifies.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Measure Spec Coverage?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nowsprinting-measure-spec-coverage)
---
name: measure-spec-coverage
description: >-
Measures the specification coverage of one specification document: models its specifications with test techniques
into coverage items, then checks off each coverage item a test verifies, finding the tests by the `// Test-basis:`
comments in test files.
Use this skill when the user asks how well a specification is tested, or which of its behaviors no test verifies.
argument-hint: "<specification document path or URL>"
license: Unlicense
metadata:
author: Koji Hasegawa
---
Measures how much of one specification document the tests verify, and lists the coverage items no test verifies.
The test analysis and test design knowledge lives in the `test-designing-guide` skill; this skill defines the procedure.
## Input
Take the specification document from the `specification document path or URL` argument: any document that states specifications, e.g., a requirements document, design docs, or an ADR, as a file path or a URL (e.g., an issue, a wiki page, or a Google Docs document).
If it is omitted or names neither a file nor a URL, use `AskUserQuestion` to ask the user for it.
If it names a test design document — a document whose `## <test class>` sections hold `### Test basis`, as the `design-tests` skill outputs it — do not measure it: its test cases are derived from the specifications, so measuring against it checks the tests only against the test design, and misses the specifications the test design left out.
Tell the user so, name the test bases it lists as the documents to pass instead, and stop.
Read a URL yourself and treat what you read as the specification document, since a subagent may lack the credentials to read it.
Read it with the access the user set up, e.g., an MCP server or a CLI of the service (`gh issue view <URL> --comments` for GitHub Issues).
For an issue, read its comments as well as its body: the comments often revise the body.
In this skill, the terms mean:
- **Coverage item** — in the ISTQB CT-MBT sense, one item that modeling the specifications with a test technique yields and a test case exercises: an equivalence partition, a decision table rule, or a state transition.
Leave out boundary values, which add conditions the specification does not state.
- **Test basis** — a file or a URL that the tests of a test file were written from, listed at the top of the file as a `// Test-basis: <path or URL>` line.
The test bases may be outdated or incomplete: use them only to find tests, never to judge what a test covers.
## Rules
- Modify no files; report what needs changing instead.
- Model the specification before reading any test code: a coverage item taken from the tests is covered by whatever tests exist.
- To measure again after the specification document changes, e.g., after its specification issues are fixed, launch new subagents for the test targets whose specifications changed, rather than continuing the subagents that measured them: those have read the test code.
## Workflow
### Step 1: Extract Test Targets
Load the `test-designing-guide` skill — do not rely on automatic skill triggering — and extract the test targets from the specification document per its test analysis resource.
Counting a specification in two targets would count its coverage items twice, and counting one the resource leaves out would lower the coverage for tests that should not exist.
### Step 2: Measure Each Test Target
Measure each test target in its own general-purpose subagent, launched in parallel, so that the model and the test code of one target stay out of the others' context.
Before launching them, list the test files that name the specification document with `${CLAUDE_SKILL_DIR}/scripts/find_test_files.sh <specification document path or URL>`: it prints the path of each `.cs` file with a `// Test-basis:` line naming the document, one per line, searching each repository level from the document's own repository, or for a URL from the current directory's repository, up to its superprojects, and exits with code 3 when none has one.
On exit code 3, proceed with an empty list: a project whose tests predate the `// Test-basis:` lines still has tests, and item 4 below finds them by name.
Give each subagent the test target with its assigned specifications, the constraints on its master data records if the test analysis recorded any with it, the list of test files, and the definitions of coverage item and test basis above, and instruct it to:
1. Load the `test-designing-guide` skill — do not rely on automatic skill triggering — and model the target's specifications with the Test Techniques of its test design resource, with equivalence partition coverage as the test selection criterion of equivalence partitioning, reading the resource of each technique applied, into a list of coverage items.
List apart, as untestable, each coverage item whose test case would be unverifiable, undefined, or ambiguous.
List apart also, as specification issues, the other issues the Assessment of the test design resource records, each with its proposed remedy and, for a contradiction, the modeling result that reveals it, but without the Assessment's label.
Finish the list before reading any test code
2. Read the test classes in the listed test files whose subject is the test target
3. Check off each coverage item that a test method verifies: its Arrange puts the test target in the coverage item — an input in the partition, the conditions of the rule, or the source state of the transition — and its assertions verify the coverage item's expected result.
A test method name alone checks off nothing, and neither does a method with `[Ignore]`
4. For each coverage item still unchecked, search the test classes named after the test target or its classes, e.g., `<ClassName>Test`, and check it off the same way: a test without the `// Test-basis:` line still verifies the coverage item.
Mark each test class found only this way
5. Return a table of the coverage items — `| Coverage item | Technique | Verified by |`, with `<TestClass>.<TestMethod>` or `—` in the last column — followed by the untestable coverage items, the specification issues, and the test classes marked in item 4
### Step 3: Report
Report to the user in the conversation:
1. The coverage: the checked coverage items over all coverage items, excluding the untestable ones, overall and per test target
2. The table of each test target, as the subagent returned it
3. The untestable coverage items and the specification issues: a gap in the specification, not in the tests
4. The test classes found without the `// Test-basis:` line: suggest adding `// Test-basis: <path>` to their files, so that the next run finds them directly
5. The specifications left out in Step 1, with the reason
The coverage items depend on the modeling of each run: compare the unchecked coverage items between runs, not the percentages.