Claude Code hook

TDD Guard

Hook-based enforcer that blocks code changes which skip the red-green-refactor TDD cycle.

2,373 stars 189 forksHooks Plugin marketplace Source

Install

Add the plugin marketplace
/plugin marketplace add nizos/tdd-guard

Run inside Claude Code, then /plugin to pick what to install from it.

Install
npm install -g tdd-guard
From source
git clone https://github.com/nizos/tdd-guard.git

From the README

TDD Guard

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:

1. /plugin marketplace add nizos/tdd-guard
2. /plugin install tdd-guard@tdd-guard
3. /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 -…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
TypeScript
License
MIT
Last updated
26 October 2026
Topics
agentic-codingautomationclaude-codecode-qualityhooksllm-toolstdd

FAQ

What is TDD Guard?

Hook-based enforcer that blocks code changes which skip the red-green-refactor TDD cycle. It is a hook for Claude Code, from nizos/tdd-guard on GitHub.

How do I install TDD Guard?

Run npm install -g tdd-guard, then follow the setup in the README.

Is TDD Guard popular?

nizos/tdd-guard has 2,373 GitHub stars and 189 forks, and is included in 2 curated Claude Code lists. It was last updated on 26 October 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.