From tdd
TDD bug-fix workflow — reproduce a bug as a failing test, find root cause, fix, and verify
How this command is triggered — by the user, by Claude, or both
Slash command
/tdd:fix Paste or describe the bug to reproduce and fixFiles this command reads when invoked
This command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# TDD Bug-Fix Workflow You are an expert test engineer performing a disciplined TDD bug-fix loop on this project. Follow this workflow precisely for every bug. Initial bug report: $ARGUMENTS --- ## Phase 1: Understand the Bug **Goal**: Parse the bug report into a testable reproduction scenario. **Actions**: 1. Create a todo list tracking all phases 2. Read the bug report and identify: - **Symptom**: What the user observes (error message, wrong output, silent failure) - **Expected behavior**: What should happen instead - **Trigger conditions**: What inputs, configuration, or s...
You are an expert test engineer performing a disciplined TDD bug-fix loop on this project. Follow this workflow precisely for every bug.
Initial bug report: $ARGUMENTS
Goal: Parse the bug report into a testable reproduction scenario.
Actions:
Goal: Create a test that reproduces the bug and is expected to fail.
CRITICAL: Follow the project's test conventions from AGENTS.md/CLAUDE.md strictly. Read existing test files to understand patterns before writing any test code.
Use the appropriate "expected failure" mechanism for the project's test framework:
| Framework | xfail mechanism | Expected behavior on fix |
|---|---|---|
| pytest | @pytest.mark.xfail(strict=True) | XPASS (unexpected pass) when bug is fixed |
| Jest | it.failing('...') or .todo() | Test passes when bug is fixed |
Rust (#[test]) | #[should_panic] or conditional #[ignore] | Remove annotation when fixed |
| Go | t.Skip("known bug: ...") | Remove skip when fixed |
| Other | Use the framework's skip/pending/expected-failure mechanism | Remove when fixed |
Actions:
<project's test command> <test_file>::<test_name>
Goal: Trace from symptom to the exact code that needs to change.
Actions:
Goal: Apply the minimal fix that makes the test pass.
Principles:
Actions:
Goal: Confirm the fix works and the test is a proper regression test.
Actions:
@pytest.mark.xfail, it.failing, #[should_panic], t.Skip)Goal: If the test still fails after the fix, diagnose why.
Decision tree:
When the bug involves both this project and a dependency:
IMPORTANT: Package managers that enforce lockfiles may overwrite local development installs. When developing across repos simultaneously, configure the package manager to use the local dependency path (e.g., path-based dependency sources, workspace links, or local overrides depending on the ecosystem).
Before EVERY commit, run the project's quality gates as defined in AGENTS.md/CLAUDE.md. Common gates include:
| Gate | Example commands |
|---|---|
| Formatter | ruff format, prettier --write, rustfmt, gofmt |
| Linter | ruff check, eslint, clippy, golangci-lint |
| Type checker | mypy, tsc --noEmit, basedpyright |
| Tests | pytest, jest, cargo test, go test |
ALL gates must pass. A commit with failing tests or lint errors is not acceptable.
Use the project's commit message format from AGENTS.md/CLAUDE.md. If no format is specified, use a conventional format that clearly describes:
Wrap body lines at 72 characters. Let URLs, file paths, hashes, and long identifiers overflow rather than breaking mid-token.
npx claudepluginhub tony/ai-workflow-plugins --plugin tdd/TDD-debugDebugs specified bug using TDD: creates failing test reproducing issue via multi-agent proposals, implements with user approval, fixes collaboratively, verifies test passes.
/fixDiagnoses reported bugs, implements TDD fixes via senior-dev, and validates with QA and security checks. Supports autopilot mode and up to 5 retries per phase.
/triageInvestigates a bug from provided description or error, determines root cause, and files GitHub issue with TDD fix plan.
/flow-fix-pipelineRuns a compressed bug fix pipeline for flow's --fix mode. Adapts triage levels from full bug+debug+fix+review+PR to quick single-pass fix. Covers documentation, root cause analysis, implementation, and PR creation.
/hatch3r-bug-pipelineRuns a known-cause bug fix through a 3-phase test-first pipeline: reproduce + root-cause, regression-test + fix, then root-cause-depth review with sub-agent delegation.
/fixIteratively repairs code errors until zero remain via autonomous loop, applying one atomic fix per iteration with auto-revert on failure. Supports --target, --scope, --category, --iterations flags.