/engineering-advanced-skills:tdd-guidefrom engineering-advanced-skills
Guides red-green-refactor TDD workflows with test generation, coverage-gap analysis, and multi-framework support for Jest, Pytest, JUnit, Vitest, and Mocha.
Ships in engineering-advanced-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
The agent guides red-green-refactor TDD workflows, generates framework-specific test stubs from requirements, parses coverage reports to identify prioritized gaps, and calculates test quality metrics including smell detection and assertion density. Supports Jest, Pytest, JUnit, Vitest, and Mocha.
Before generating tests or analyzing coverage, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
scripts/tdd.py is the command-line entry point. Its most useful job is the coverage gate:
it parses LCOV, Istanbul JSON or Cobertura XML, lists every file below the threshold with
its uncovered lines, and exits 1 while any gap remains.
python scripts/tdd.py coverage assets/sample_coverage_gaps.lcov --threshold 80 # exit 1, lists gaps
python scripts/tdd.py coverage assets/sample_coverage_report.lcov --threshold 80 # exit 0
python scripts/tdd.py generate assets/sample_input_python.json --module discount # pytest stubs
python scripts/tdd.py quality tests/test_discount.py --format json # assertion density, smells
| Subcommand | What it does | Key flags |
|---|---|---|
coverage <report> | Per-file line/branch gaps, uncovered lines, prioritised P0-P2 recommendations | --threshold (default 80), --format text/json |
generate <input.json> | Test stubs from user stories, acceptance criteria, error and edge cases (Jest, Vitest, Pytest, JUnit, Mocha) | --framework, --module, -o, --format |
quality <test file> | Test count, assertions per test, isolation, naming, smells, quality score | --format |
Generated stubs raise or throw until you write the real assertion, so they start RED by design; a stub that passes before the code exists proves nothing.
Exit codes: 0 ok (coverage: every file meets the threshold); 1 coverage gaps found;
2 bad input (missing or empty file, unknown report format, invalid JSON, unknown framework).
The other modules (tdd_workflow.py phase validation, fixture_generator.py
boundary values and mocks, framework_adapter.py cross-framework conversion,
output_formatter.py) are libraries; import them with PYTHONPATH=scripts as shown in
references/tool-reference.md.
tdd.py coverage on it. Done when it exits 0 at the agreed threshold and every new branch has a test that failed before the code existed.Load the reference that matches the task — keep this file lean and pull detail on demand:
This skill covers:
This skill does NOT cover:
senior-qa for E2E patterns and senior-devops for load testingsenior-security and senior-secops skillsMistake: Writing the implementation first, then adding tests that mirror it. Why it happens: It feels faster, and the tests pass on the first run. Instead: Watch each test fail before the code exists. A test that never failed may not be able to fail.
Mistake: Adding assertion-free tests to push a file over the threshold.
Why it happens: The gate checks lines executed, not behaviour verified.
Instead: Run tdd.py quality alongside coverage; low assertions per test with high coverage is the signature of this mistake.
Mistake: Leaving generated stubs in the suite with placeholder bodies. Why it happens: They look like progress. Instead: The stubs fail until filled in, on purpose. Fill each one or delete it before merging.
| File | Purpose |
|---|---|
scripts/tdd.py | CLI: coverage, generate, quality |
scripts/coverage_analyzer.py, test_generator.py, metrics_calculator.py, format_detector.py | Libraries behind the CLI |
scripts/tdd_workflow.py, fixture_generator.py, framework_adapter.py, output_formatter.py | Import-only libraries |
assets/sample_coverage_report.lcov | Fully covered report (coverage exits 0) |
assets/sample_coverage_gaps.lcov | Report with an untested function and branches (exits 1) |
assets/sample_input_python.json, sample_input_typescript.json | Requirements inputs for generate |
assets/expected_output.json | Example combined output |
references/*.md | Workflows, API reference, practices, frameworks, CI, troubleshooting |
HOW_TO_USE.md (opens in a new tab)README.md (opens in a new tab)assets/expected_output.json (opens in a new tab)assets/sample_coverage_gaps.lcov (opens in a new tab)assets/sample_coverage_report.lcov (opens in a new tab)assets/sample_input_python.json (opens in a new tab)assets/sample_input_typescript.json (opens in a new tab)references/ci-integration.md (opens in a new tab)references/framework-guide.md (opens in a new tab)references/tdd-best-practices.md (opens in a new tab)references/tool-reference.md (opens in a new tab)references/troubleshooting-and-quality.md (opens in a new tab)references/workflows.md (opens in a new tab)scripts/coverage_analyzer.py (opens in a new tab)scripts/fixture_generator.py (opens in a new tab)scripts/format_detector.py (opens in a new tab)scripts/framework_adapter.py (opens in a new tab)scripts/metrics_calculator.py (opens in a new tab)scripts/output_formatter.py (opens in a new tab)scripts/tdd.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub borghei/claude-skills --plugin engineering-advanced-skills100 skills in this plugin
/a11y-auditStatic WCAG scan of HTML files (alt text, headings, labels, ARIA, lang, landmarks) and colour contrast checks for colour pairs or CSS. Use when auditing templates for accessibility, checking contrast, or adding an a11y gate to CI.
/agent-designerDesigns multi-agent system architectures with orchestration patterns, tool schemas, and performance evaluation. Use when building AI agent systems, designing agent workflows, creating tool schemas, or evaluating agent performance.
/agent-harnessTest and evaluation harness for AI agents — scenario suites, deterministic replay, regression diffing, cost and latency budgets. Use when agent quality is vibe-checked, before shipping a prompt or model change, or when evals drift.
Other plugins' skills for the same job