← ClaudeAtlas

iterative-developmentlisted

TDD iteration loops using Claude Code Stop hooks - runs tests after each response, feeds failures back automatically
lciacci/tessera · ★ 0 · AI & Automation · score 66
Install: claude install-skill lciacci/tessera
# Iterative Development Skill (Stop Hook TDD Loops) **Concept:** Claude Code's Stop hook fires right before Claude finishes a response. Exit code 2 feeds stderr back to the model and continues the conversation. This creates a real TDD loop without any plugins. --- ## How It Actually Works Claude Code has a **Stop hook** that runs when Claude is about to conclude its response. If the hook script exits with code 2, its stderr is shown to the model and the conversation continues automatically. ``` ┌─────────────────────────────────────────────────────────────┐ │ 1. User asks Claude to implement a feature │ ├─────────────────────────────────────────────────────────────┤ │ 2. Claude writes tests + implementation │ ├─────────────────────────────────────────────────────────────┤ │ 3. Claude finishes its response │ ├─────────────────────────────────────────────────────────────┤ │ 4. Stop hook runs: executes tests, lint, typecheck │ ├─────────────────────────────────────────────────────────────┤ │ 5a. All pass (exit 0) → Claude stops, work is done │ │ 5b. Failures (exit 2) → stderr fed back to Claude │ ├─────────────────────────────────────────────────────────────┤ │ 6. Claude sees failures, fixes code, response ends │ ├─────────────────────────────────────────────────────────────┤ │ 7. Stop hook runs again → repeat until green or max tries │ └─────────────────────────────────