CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
Claude Code hooks for test-first enforcement
TDD Guard adds Claude Code hooks that check whether an agent is following TDD before it keeps going. It uses validation rules, lint integration, and test reporters to catch missing tests or premature implementation, then tells the agent what to do next.
Builders who use Claude Code and want test-first rules enforced while the agent writes code.
You can stop your agent from skipping tests or over-implementing, and keep work aligned with TDD.
What it does
Test-first enforcement
Blocks implementation when there are no failing tests to justify the change.
Minimal implementation checks
Prevents code changes that go beyond the current test requirements.
Lint integration
Uses your lint rules to push refactoring and cleanup.
Custom validation rules
Lets you adjust enforcement to match your TDD style.
Session control
Lets you toggle enforcement on and off during a session.
Multi-framework test reporting
Supports reporters for Vitest, Jest, Storybook, pytest, PHPUnit, Go, Rust, RSpec, and Minitest.
How to get it
- 1Open Claude Code in your project and run
/plugin marketplace add nizos/tdd-guard
- 2Run
/plugin install tdd-guard@tdd-guard
- 3Run
/tdd-guard:setup
README
TDD Guard
[!IMPORTANT] TDD Guard grew into Probity: the same TDD enforcement, now for Claude Code, Codex, and GitHub Copilot CLI, with more reliable validation and no test reporters to set up. New projects should start there. TDD Guard remains maintained for the projects that rely on it.
Automated Test-Driven Development enforcement for Claude Code.
TDD Guard ensures Claude Code follows Test-Driven Development principles. When your agent tries to skip tests or over-implement, TDD Guard blocks the action and explains what needs to happen instead.
Features
- Test-First Enforcement - Blocks implementation without failing tests
- Minimal Implementation - Prevents code beyond current test requirements
- Lint Integration - Enforces refactoring using your linting rules
- Customizable Rules - Adjust validation rules to match your TDD style
- Flexible Validation - Choose faster or more capable models for your needs
- Session Control - Toggle on and off mid-session
Getting Started
Requirements
- Node.js 22+
- A supported test framework (Vitest, Jest, Storybook, pytest, PHPUnit, Go, Rust, RSpec, Minitest)
Installation
Open Claude Code in your project and run:
/plugin marketplace add nizos/tdd-guard/plugin install tdd-guard@tdd-guard/tdd-guard:setup
This adds the marketplace, installs the plugin, and configures the test reporter for your project. You may need to restart your terminal session or IDE extension for the setup skill to appear. For manual installation and configuration, see the installation guide.
Configuration
- Custom instructions - Customize TDD validation rules
- Lint integration - Automated refactoring support
- Strengthening enforcement - Prevent agents from bypassing validation
- Ignore patterns - Control which files are validated
- Validation Model - Choose faster or more capable model
- All settings - Complete settings documentation
Security
TDD Guard hooks run with your user permissions. We maintain automated security scanning, dependency audits, and welcome source code review. See Claude Code's security considerations for more on hook safety.
Development
Contributing
Contributions are welcome! See the contributing guidelines to get started.
Contributors:
- Python/pytest support: @Durafen
- PHP/PHPUnit support: @wazum
- Rust/cargo support: @104hp6u
- Go support: @sQVe, @wizzomafizzo
- Storybook support: @akornmeier
- Ruby/RSpec & Minitest support: @Hiro-Chiba
Support
- Discussions - Ask questions and share ideas
- Issues - Report bugs and request features
License
Files in the repo
- .claude-plugin
- .devcontainer
- .github
- .husky
- docs
- plugin
- reporters
- src
- test
- .claudeignore
- .commitlintrc.json
- .env.example
- .gitignore
- .npmignore
- .prettierignore
- .prettierrc
- CLAUDE.md
- CONTRIBUTING.md
- DEVELOPMENT.md
- eslint.config.mjs
- LICENSE
- package-lock.json
- package.json
- README.md
- tsconfig.build.json
- tsconfig.eslint.json
- tsconfig.json
- tsconfig.node.json
- vitest.config.ts
Discussion (0)
Ask about usage, or say what you built with itSign in to join the discussion.
No comments yet. Be the first to say what this is good for.
More hooks
Warcraft III Peon voice notifications (+ more!) for Claude Code, Codex, IDEs, and any AI agent. Stop babysitting your terminal. Employ a Peon today.
Read the Qur'an while Claude Code works. Start a session with 'claude --cwq' and a reader beside it walks forward through the Qur'an one ayah per prompt, resuming where you left off — in a terminal pane or a browser tab. Zero dependencies, fully offline.
Clean up Claude's token vomit with a separate LLM. Save your tokens, Opus is hopeless
A pre-execution guard for AI coding agents. It blocks destructive Git and file system commands, plus common attempts to access sensitive files, before a tool call runs. Supports Amp Code, Antigravity CLI, Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, Grok Build, Hermes Agent, Kimi Code, OpenClaw, OpenCode, and Pi.
Master Claude Code Hooks