testgen
Comprehensive test generation skill for TDD-driving and post-implementation validation from feature lists or task packets. Use when you need deterministic, traceable unit/smoke/integration/e2e/regression tests with explicit edge-case analysis and a fail-closed touched-code coverage gate (default at
Install
mkdir -p .claude/skills/testgen && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15145" && unzip -o skill.zip -d .claude/skills/testgen && rm skill.zipInstalls to .claude/skills/testgen
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Comprehensive test generation skill for TDD-driving and post-implementation validation from feature lists or task packets. Use when you need deterministic, traceable unit/smoke/integration/e2e/regression tests with explicit edge-case analysis and a fail-closed touched-code coverage gate (default at least 90%).About this skill
Testgen
Use this skill to design and generate tests that prove implementation correctness against explicit requirements.
Inputs
Provide one normalized request:
mode:tdd-driverorpost-impl-generatorsource:feature-listortask-packetpayload: inline text, packet text, or payload file pathcoverage_target: integer percent (default90)preferred_cli:auto,gemini,copilot,claudeuse_pal_testgen:auto,on,off
Pipeline
Run these phases in order and fail closed on ambiguity.
- Intake and normalization.
- Requirement decomposition and risk modeling (
thinkdeepwhen available). - Deterministic sequencing (
plannerwhen available). - Edge-case and failure challenge pass (
consensuswhen available). - Specialist authoring pass:
- Primary: subagent (
clink) when available. - Fallback: built-in test-specialist persona.
- Optional augmentation: PAL
testgenwhen enabled and available.
- Primary: subagent (
- Layered generation:
- Unit tests are mandatory.
- Smoke/integration/e2e/regression are generated when applicable.
- Non-applicable layers require explicit
N/Awith evidence.
- Verification gate on touched code coverage (default
>=90).
Deterministic Rules
- If an explicit touched-file list is provided, treat it as the source of truth.
- Otherwise, resolve touched scope from VCS in this order:
git statusfirst, thengit diff. - If VCS-based resolution yields no trustworthy scope, fall back to requirement/feature-to-file mapping.
- If none of these sources are trustworthy, stop and request explicit scope before proceeding.
- Coverage is pass/fail for touched code; missing coverage evidence fails closed.
- Always return a traceability matrix from requirement IDs to test IDs.
Output Contract
Return these core sections:
traceability_matrixlayer_plan(unit/smoke/integration/e2e/regression)coverage_gate(target, measured, status)na_layerswith rationale and evidence
Optional sections (when available):
-
test_artifactslist by file and layer Detailed output and heuristics are defined in: -
references/output_contract.md -
references/layer_policy.md
Python and JS/TS v1 Focus
Prioritize first-class support for:
- Python (
pytest) - JS/TS (
jest,vitest)
For other stacks, keep behavior conservative and explicit about unsupported assumptions.
Local Utility Scripts
Use bundled scripts for deterministic preprocessing and gate evaluation:
scripts/testgen_workflow.pyscripts/testgen_cli.py
Example:
python scripts/testgen_cli.py \
--mode tdd-driver \
--source feature-list \
--payload-file /abs/path/features.txt \
--coverage-target 90 \
--preferred-cli auto \
--use-pal-testgen auto