Help us improve
Share bugs, ideas, or general feedback.
Share bugs, ideas, or general feedback.
Share bugs, ideas, or general feedback.
By xiaolai
TDD Guardian — enforces strict test-driven development discipline in Claude Code with quality gates, coverage enforcement, and mutation testing
npx claudepluginhub xiaolai/claude-plugin-marketplace --plugin tdd-guardianShared: detect project language/stack from manifest files, propose default commands
Shared: load .claude/tdd-guardian/config.json, validate fields, fail loudly if missing
Shared: parse coverage output into normalized metrics across Jest/Vitest, LCOV, cobertura, Go cover, coverage.py
Shared: parse mutation testing output into score + survivor list across Stryker, mutmut, go-mutesting, cargo-mutants
Shared: execute the configured test command, distinguish runner failure from test failure
Enforce strict coverage gates and identify exact missing coverage scenarios. <example> Context: All work items have been implemented and tests are green; now the workflow needs to verify the project meets the 90% branch coverage threshold configured in tdd-guardian config. assistant: "I'll use the tdd-coverage-auditor to run the coverage command, compare totals against the configured thresholds, and produce a report listing any uncovered branches with proposed tests to close each gap." </example> <example> Context: A newly added error-handling branch in src/queue.ts is suspected to be untested after implementation. assistant: "I'll dispatch the tdd-coverage-auditor to run coverage focused on src/queue.ts, identify uncovered lines and branches, and propose concrete test cases to bring the file to threshold." </example>
Implement planned work items in small batches with test-first discipline. <example> Context: The tdd-planner and tdd-test-designer have both finished; there are 3 work items and a full test matrix ready for a JWT token validation module. assistant: "I'll use the tdd-implementer to work through each work item one at a time — writing failing tests first, then the minimal implementation to make them pass, running the test command after each batch." </example> <example> Context: WI-2 of an ongoing TDD workflow is a database transaction rollback handler, with tests already specified in the matrix. assistant: "I'll dispatch the tdd-implementer for WI-2: write the rollback handler tests (red), implement the handler (green), confirm via Bash, then report the result before moving to WI-3." </example>
Validate test robustness using mutation testing and close surviving mutants. <example> Context: Coverage gate passed at 94%, but the team suspects tests are weak — many assertions may be wiring-only and would miss logic mutations. assistant: "I'll use the tdd-mutation-auditor to run Stryker, list any surviving mutants with their file locations and mutant types, then strengthen the test assertions to kill each survivor." </example> <example> Context: After implementing a complex conditional pricing algorithm, the mutation score needs to meet the 80% kill-rate threshold before the workflow can proceed to review. assistant: "I'll dispatch the tdd-mutation-auditor to verify Stryker is available, run mutation tests against the pricing module, and iteratively add boundary tests until the kill-rate threshold is met or a blocker is reported." </example>
Break a request into implementation work items with explicit acceptance criteria and test targets. <example> Context: User asks to add a user authentication feature with login, logout, and session handling to an Express API. assistant: "I'll use the tdd-planner to break down the authentication feature into work items with acceptance criteria and required test targets for each component." </example> <example> Context: User wants to refactor a payment processing module to support multiple currencies. assistant: "I'll dispatch the tdd-planner to decompose the currency refactor into discrete work items, identify risks, and define the test targets before any code is written." </example>
Final reviewer that audits code quality, test quality (wiring vs behavior), and coverage gaps. <example> Context: All prior gates (coverage, mutation) have passed and the implementation is complete; a final sign-off is needed before committing. assistant: "I'll use the tdd-reviewer to audit both code quality and test quality — checking for wiring-only tests, mocked internal modules, missing error-path coverage, and producing a severity-ordered findings report." </example> <example> Context: A PR adding a new file upload handler has been flagged because its test file only contains toHaveBeenCalledWith assertions and no behavior verification. assistant: "I'll dispatch the tdd-reviewer to classify every expect() call in the upload handler test file, flag all wiring-only tests, and identify which behavior assertions are missing before this can be approved." </example>
Enforce coverage thresholds AND test quality — coverage without behavioral assertions is meaningless.
Initialize workspace TDD Guardian config and enable strict hooks for test/coverage enforcement.
Validate test strength with mutation testing and harden weak assertions. Covers Stryker (JS/TS), mutmut (Python), go-mutesting (Go), and cargo-mutants (Rust).
Global TDD governance policy. Enforces plan-first development, behavior-driven test quality, and strict completion gates.
Produce findings-first code review with severity ordering, test-gap findings, and test-quality audit.
Executes bash commands
Hook triggers when Bash tool is used
Uses power tools
Uses Bash, Write, or Edit tools
Share bugs, ideas, or general feedback.
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge.
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge.
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
Automated Test-Driven Development enforcement
Test-driven development skill that enforces red-green-refactor, one test at a time
Test-Driven Development (TDD) principles and red-green-refactor cycle enforcement.
Test-driven development methodology with red-green-refactor cycles and code review
Test execution, TDD workflow, testing strategies, and quality analysis
Comprehensive skill pack with 66 specialized skills for full-stack developers: 12 language experts (Python, TypeScript, Go, Rust, C++, Swift, Kotlin, C#, PHP, Java, SQL, JavaScript), 10 backend frameworks, 6 frontend/mobile, plus infrastructure, DevOps, security, and testing. Features progressive disclosure architecture for 50% faster loading.
Natural-Language Programming Manager — scan, lint, and write NL artifacts with Claude-native quality scoring
A 260-token system prompt that overrides three structural presumptions every RLHF-trained LLM inherits from training: that you want confirmation, that old scarcity still applies, that best practices are ceilings.
English language coach for non-native speakers — auto-corrects prompts, translates non-English, refines with :: prefix, tracks improvement over time
Initialize a multi-agent workspace with shared configuration for Claude Code, Codex CLI, and Gemini CLI
Documentation quality and freshness enforcer — detect staleness, check accuracy, measure coverage, and auto-generate docs
TDD Guardian for Claude Code — enforces strict test-driven development discipline with automated quality gates.
TDD Guardian ensures Claude Code follows rigorous TDD practices:
git commit, git push, and gh pr create until all gates passPart of the xiaolai plugin marketplace.
Add the marketplace (once):
/plugin marketplace add xiaolai/claude-plugin-marketplace
Then install:
/plugin install tdd-guardian@xiaolai
Install fails with "Plugin not found in marketplace 'xiaolai'"? Your local marketplace clone is stale. Run
claude plugin marketplace update xiaolaiand retry —plugin installdoes not auto-refresh.
| Scope | Command | Effect |
|---|---|---|
| User (default) | /plugin install tdd-guardian@xiaolai | Available in all your projects |
| Project | /plugin install tdd-guardian@xiaolai --scope project | Shared with team via .claude/settings.json |
| Local | /plugin install tdd-guardian@xiaolai --scope local | Only you, only this repo |
Run /tdd-guardian:init inside your project to generate .claude/tdd-guardian/config.json. This auto-detects your stack and configures test/coverage commands.
| Command | Description |
|---|---|
/tdd-guardian:init | Initialize TDD Guardian config for the current project |
/tdd-guardian:workflow | Run the full TDD workflow with specialized subagents |
/tdd-guardian:workflow)Runs 6 specialized subagents in sequence:
The workflow stops if any gate fails. No commit/push is allowed until all gates are green.
TDD Guardian installs two hooks:
pretool_guard.js): intercepts git commit, git push, gh pr create, and npm publish commands. Blocks them unless quality gates have passed recently (configurable freshness window).taskcompleted_gate.js): runs tests, coverage checks, and mutation tests automatically when a task completes. Updates gate state on success.TDD Guardian enforces behavior-driven testing — tests must verify what code does (outputs, side effects, state changes), not how it does it (which internal functions it calls).
The assertion hierarchy:
| Level | Type | Quality |
|---|---|---|
| 1 | Output verification | Best |
| 2 | Side-effect verification | Best |
| 3 | Real integration | Best |
| 4 | State verification | Good |
| 5 | Mock return + output | Good |
| 6 | Mock call args | Weak |
| 7 | Mock was called | Unacceptable alone |
Tests with only Level 6-7 assertions are flagged and must be upgraded.
Config lives at .claude/tdd-guardian/config.json:
{
"enabled": true,
"enforceOnTaskCompleted": true,
"blockCommitWithoutFreshGate": true,
"gateFreshnessMinutes": 120,
"bypassEnv": "TDD_GUARD_BYPASS",
"preflightCommand": "pnpm exec tsc --noEmit",
"testCommand": "pnpm test",
"coverageCommand": "pnpm test -- --coverage",
"coverageSummaryPath": "coverage/coverage-summary.json",
"coverageThresholds": {
"lines": 100,
"functions": 100,
"branches": 100,
"statements": 100
},
"requireMutation": false,
"mutationCommand": ""
}