analyzing a change to determine what tests are needed and adding them to the test suite
59
67%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.claude/skills/adding-tests/SKILL.mdThis skill is for analyzing a code change and adding appropriate test coverage. It covers both unit tests and randomized/fuzz tests, ensuring that new functionality is tested and bug fixes include regression tests.
This skill involves a fair amount of work. Consider splitting it into pieces and running each piece as a subagent (e.g., one for analyzing test needs, one for writing unit tests, one for randomized tests). Keep each subagent focused on a moderate amount of work so it doesn't get lost or wander off track.
The output is either confirmation that tests were added (with details), or confirmation that no additional tests are needed.
Before starting the analysis, gather the following information (if running as a subagent, the invoking agent should provide these; otherwise, determine them yourself or ask the user):
Git range: The git command to get the diff (e.g., git diff master...HEAD).
Type of change: Is this a new feature, bug fix, refactor, or performance change?
Bug/issue reference (if applicable): For bug fixes, the issue number or description of what was broken.
Specific test requirements (optional): Any specific testing requirements the user has mentioned.
If invoking as a subagent, the prompt should include: "Analyze and add tests
for: . Get the diff using <git-command>. "
Get the diff using the command provided by the invoking agent:
Categorize the change:
Locate tests related to the changed code:
Foo.cpp → FooTests.cpp)# Find test files
find src -name "*Tests.cpp" | xargs grep -l "FunctionName"LogSlowExecution wrapper that will flag any
long-running units of work on the IO serviceFor changes affecting:
Consider whether randomized testing is appropriate:
Find existing tests in the same area and follow their patterns. Common patterns in this codebase:
src/ alongside the code they test, in a test/
subdirectory.*Tests.cpp*TestUtils.cppsrc/testIf adding a fuzz target:
Report what was done:
## Tests Added
### Unit Tests
1. **src/ledger/LedgerManagerTests.cpp**: `processEmptyTransaction`
- Tests that empty transactions are rejected with appropriate error
- Regression test for issue #1234
2. **src/ledger/LedgerManagerTests.cpp**: `processTransactionWithMaxOps`
- Tests boundary condition at maximum operation count
### Randomized Tests
1. **src/fuzz/FuzzTransactionFrame.cpp**: Extended to cover new transaction type
- Added generation of the new transaction variant
## No Additional Tests Needed
[If applicable, explain why existing coverage is sufficient]Summarize your work as follows:
If invoked as a subagent, pass this summary back to the invoking agent.
457f20b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.