Sign in
Explore
Add-ons · HookTesting & SecurityUnit tests & TDDReviewedRuns shell commands

quality-gates/tdd-gate

Blocks edits to production code unless a matching test file exists, so the tests are written first.

Kind
Hook
Works with
Claude Code
Source
Claude Code Templates @ 72e5f237f64d
Path
cli-tool/components/hooks/quality-gates/tdd-gate.json
Jobs
Testing, Guardrails
Topics
Unit tests & TDD

Credit

Made by
davila7
Original
github.com/davila7/claude-code-templates/blob/72e5f237f64d70a…
License
MIT

Listed by Skill Manifest; not made by us.

InstallInstall it by hand, following the source.
Install factsScanned 3 Nov 2026
Adds
  • Entries under `hooks` in .claude/settings.json
  • Hook on PreToolUse
Runs scripts
Yes
  • /.claude/hooks/tdd-gate.sh
  • hook command runs on every matching event
Uses the network
None found
Needs secrets
None found
Source revision
72e5f237f64d
Licence
MIT
Last activity
26 Nov 2026
Source changed after the scan
Yes
  • Last push 26 Nov 2026, scanned 3 Nov 2026; read it again before you rely on this scan
Review
Reviewed

Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.

{
  "description": "Test-Driven Development enforcement hook. Blocks editing production code files (.cs, .py, .ts, .go, .rs, .rb, .php, .java, .kt, .swift, .dart) unless a corresponding test file exists. Forces the TDD workflow: write tests first, then implement. Automatically skips config files, migrations, DTOs, test files themselves, and infrastructure files. Looks for test files with common naming patterns (MyClassTest.ext, my-class.test.ext, my_class_test.ext, test_my_class.ext). Inspired by pm-workspace's Spec-Driven Development methodology.",
  "supportingFiles": [
    {
      "source": "tdd-gate.sh",
      "destination": ".claude/hooks/tdd-gate.sh",
      "executable": true
    }
  ],
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit",
        "hooks": [
          {
            "type": "command",
            "command": "bash \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/tdd-gate.sh"
          }
        ]
      },
      {
        "matcher": "MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "bash \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/tdd-gate.sh"
          }
        ]
      },
      {
        "matcher": "Write",
…