tdd-guard
CLAUDE.md2.4k starsChanged 5 months agoMITView on GitHub
TDD Guard is a Claude Code hook that enforces Test-Driven Development by intercepting file operations. When Claude Code attempts to edit or write files, TDD Guard: This automated enforcement maintains code quality without cluttering prompts with TDD reminders. Example: feat: add network request filtering to reduce noise in captured data (explains why, not just what) The codebase is organized with core functionality in src/ and language-specific reporters: TDD Guard is organized as a TypeScript project with integrated language-specific reporters:
Trending
Quiet since September.about the whole repository
Who's talking about nizos/tdd-guard
- @nick-tune.me“Today I took Claude TDD Guard for a spin (with @selrahcd.bsky.social ) and my expectations were exceeded. …”Bluesky · Sep 24, 2025 · 15 likes
- @matsuu.bsky.social“Claude …”Bluesky · Aug 31, 2025 · 4 likes
- A Hacker News story“TDD-Guard: Automated Test-Driven Development Enforcement for Claude Code”Hacker News · Aug 31, 2025 · 4 points
- @selrahcd.bsky.social“Yesterday I add the idea of using Claude Code hooks to enforce TDD cycle but my idea was super basic (check …”Bluesky · Aug 28, 2025 · 4 likes
- A Hacker News story“Show HN: TDD-Guard – Test-Driven Development for Claude Code”Hacker News · Aug 20, 2025 · 4 points
The biggest 5 of 31 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 31
Talked about on GitHub, Bluesky and Hacker News (31 times).
On GitHub · 23
- Aug 18, 2025Miscellaneous set of tools — UfoMiao/zcf2 reactions · 1 comment
- Sep 2, 2025Explore TDD Guard — PaulRBerg/dot-claude1 reaction · 1 comment
- Sep 30, 2026agent-skills.github.nizos.tdd-guard: init at 1.7.0 — sudosubin/agents.nix0 reactions
- Jun 22, 2026Lack of adaptive and historic TDD process to gate relases — IronbellyOrg/IronClaude0 reactions
- May 31, 2026chore(deps): bump uuid and tdd-guard — virgildotcodes/tdd-guard0 reactions
18 more on GitHub
- May 27, 2026Tdd guard — e-stepanov/agentic-coding0 reactions
- May 20, 2026chore(deps): bump uuid and tdd-guard — anointednetworks/tdd-guard0 reactions
- May 11, 2026chore: enforce CLAUDE.md workflow gates with Claude Code hooks (+ violation monitoring) — bentleypark/aiwatch0 reactions · 6 comments
- Apr 6, 2026chore(deps): bump the npm-minor-patch group across 1 directory with 7 updates — mossipcams/autosnooze0 reactions · 1 comment
- Apr 6, 2026deps(deps-dev): Bump the dev-dependencies group across 1 directory with 10 updates — Sallvainian/My-Love0 reactions · 5 comments
- Mar 22, 2026research: 外部AI知見(Claude Skills / MCP / OSS)の分析と活用計画 — uminomae/creation-space0 reactions · 2 comments
- Dec 9, 2025docs: Add explicit TDD context isolation documentation — akaszubski/autonomous-dev0 reactions · 1 comment
- Nov 20, 2025build(deps): bump @anthropic-ai/claude-code and tdd-guard — gatlin-carrier/wigg0 reactions · 1 comment
- Oct 13, 2025chore(deps-dev): bump tdd-guard-vitest from 0.1.3 to 0.1.6 — shopwareLabs/ai-contribution-validation-action0 reactions
- Oct 6, 2025chore(deps-dev): Bump tdd-guard from 0.6.0 to 1.1.0 in /scorm-builder — drelor-online/scorm-builder0 reactions
- Sep 22, 2025chore(deps-dev): Bump tdd-guard from 0.6.0 to 1.0.2 in /scorm-builder — drelor-online/scorm-builder0 reactions · 1 comment
- Sep 15, 2025chore(deps-dev): Bump tdd-guard from 0.6.0 to 1.0.1 in /scorm-builder — drelor-online/scorm-builder0 reactions · 1 comment
- Sep 15, 2025chore(deps-dev): bump tdd-guard-vitest from 0.1.3 to 0.1.5 — shopwareLabs/ai-contribution-validation-action0 reactions · 1 comment
- Sep 8, 2025chore(deps-dev): Bump tdd-guard from 0.6.0 to 0.11.0 in /scorm-builder — drelor-online/scorm-builder0 reactions · 1 comment
- Sep 8, 2025chore(deps-dev): bump tdd-guard-vitest from 0.1.3 to 0.1.4 — shopwareLabs/ai-contribution-validation-action0 reactions · 1 comment
- Sep 2, 2025build(deps-dev): Bump tdd-guard from 0.6.0 to 0.10.2 in /scorm-builder — drelor-online/scorm-builder0 reactions · 1 comment
- Aug 18, 2025build(deps-dev): Bump tdd-guard from 0.6.0 to 0.9.2 in /scorm-builder — drelor-online/scorm-builder0 reactions · 1 comment
- Aug 7, 2025Bump tdd-guard from 0.6.0 to 0.9.0 in /scorm-builder — drelor-online/scorm-builder0 reactions · 1 comment
On Bluesky · 5
- Sep 24, 2025Today I took Claude TDD Guard for a spin (with @selrahcd.bsky.social ) and my expectations were exceeded. It's early days, but I like… — @nick-tune.me15 likes and reposts · 2 replies
- Aug 31, 2025Claude CodeにTDD(テスト駆動開発)を強制するためのツール。各言語用に用意されたライブラリと組み合わせて使う模様。対応言語は現時点でJavaScript/TypeScript、Python、PHP、Go、Rustかな — @matsuu.bsky.social4 likes and reposts
- Aug 28, 2025Yesterday I add the idea of using Claude Code hooks to enforce TDD cycle but my idea was super basic (check if can write in test or impl… — @selrahcd.bsky.social4 likes and reposts
- Dec 29, 2025Experimenting with tdd-guard which enforces TDD workflow for the LLM: - no changing code without a failing test - only one test at a time -… — @s0enke.norden.social.ap.brid.gy1 likes and repost
- Sep 7, 2025https://github.com/nizos/tdd-guard — @tom-doerr.bsky.social1 likes and repost
On Hacker News · 3
- Aug 31, 2025TDD-Guard: Automated Test-Driven Development Enforcement for Claude Code4 points
- Aug 20, 2025Show HN: TDD-Guard – Test-Driven Development for Claude Code4 points · 7 comments
- Aug 3, 2025Show HN: Enforce TDD in Claude Code3 points · 3 comments
The file
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 6
When Claude Code attempts to edit or write files, TDD Guard:
- Distinctive: line 21
Test and implementation together: Never separate tests from the code they test
- Distinctive: line 22
Explain why, not what: Commit messages should explain the reason for the change
- Distinctive: line 23
Conventional format: Use prefixes to categorize changes: feat, fix, refactor, test, chore, docs
- Very specific: line 78
Use test factories: Always use factories from test/utils/ instead of creating data inline
- Very specific: line 79
Group tests effectively: Use describe blocks and beforeEach for common setup
- Distinctive: line 80
Keep tests concise: Keep as little logic in the tests themselves as possible
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TDD Guard
Project Goal
TDD Guard is a Claude Code hook that enforces Test-Driven Development by intercepting file operations. When Claude Code attempts to edit or write files, TDD Guard:
- Captures: Intercepts Edit, MultiEdit, and Write operations
- Analyzes: Examines test results, file paths, and code changes
- Validates: Checks TDD compliance using an AI model
- Blocks: Prevents operations that skip tests or over-implement
- Guides: Explains violations and suggests corrections
This automated enforcement maintains code quality without cluttering prompts with TDD reminders.
Development Workflow
Commit Guidelines
- Atomic commits: Each commit represents one logical change with its tests
- Test and implementation together: Never separate tests from the code they test
- Explain why, not what: Commit messages should explain the reason for the change
- Conventional format: Use prefixes to categorize changes: feat, fix, refactor, test, chore, docs
Example: feat: add network request filtering to reduce noise in captured data (explains why, not just what)
Project Structure
The codebase is organized with core functionality in src/ and language-specific reporters:
reporters/ # Language-specific test reporters
├── go/ # tdd-guard-go - Go test reporter
├── jest/ # tdd-guard-jest - Jest reporter (npm)
├── minitest/ # tdd-guard-minitest - Minitest reporter (gem)
├── phpunit/ # tdd-guard/phpunit - PHPUnit reporter (composer)
├── pytest/ # tdd-guard-pytest - Pytest reporter (pip)
├── rspec/ # tdd-guard-rspec - RSpec reporter (gem)
├── rust/ # tdd-guard-rust - Rust test reporter (crates.io)
├── storybook/ # tdd-guard-storybook - Storybook test-runner reporter (npm)
├── test/ # Shared test artifacts and integration tests
└── vitest/ # tdd-guard-vitest - Vitest reporter (npm)
src/ # Main CLI application
├── cli/ # Hook entry point and context builder
├── config/ # Configuration management
├── contracts/ # Types and Zod schemas
├── guard/ # Guard enable/disable management
├── hooks/ # Claude Code hook parsing and processing
├── linters/ # ESLint integration for code quality
├── processors/ # Test result and lint processing
├── providers/ # Model and linter client factories
├── storage/ # Storage abstractions
├── validation/ # TDD principle validation
│ ├── validator.ts # Sends context to AI model and parses response
│ ├── context/ # Formats operations for AI validation
│ ├── prompts/ # TDD validation rules and AI instructions
│ └── models/ # Claude SDK and Anthropic API clients
└── index.ts # Package entry point
test/ # Main test suite (hooks, integration, utils)
docs/ # Documentation (ADRs, configuration, etc.)Architecture
TDD Guard is organized as a TypeScript project with integrated language-specific reporters:
- src/: Core functionality including contracts, config, storage, and validation
- reporters/: Language-specific test reporters (go, jest, minitest, phpunit, pytest, rspec, rust, storybook, vitest)
- test/: Comprehensive test suite with integration tests and utilities
Testing
Guidelines
- Use test helpers: Extract setup logic into helper functions placed at the bottom of test files
- Use test factories: Always use factories from
test/utils/instead of creating data inline - Group tests effectively: Use
describeblocks andbeforeEachfor common setup - Keep tests concise: Keep as little logic in the tests themselves as possible
Commands
npm run build # Build main package and workspace reporters (jest, storybook, vitest)
npm run test # All unit tests and base integration tests
npm run test:unit # Fast unit tests only
npm run test:reporters # Test all reporter implementations
npm run lint # Check code style and quality
npm run format # Auto-format code with Prettier
npm run checks # Run all checks: typecheck, lint, format, and testKey Design Principles
- Interface-driven: Core functionality defined by interfaces (
Storage,ModelClient) - Dependency injection: Components receive dependencies as parameters
- Single responsibility: Each module has one clear purpose
- Type safety: Comprehensive TypeScript types with runtime validation
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

