/plugin marketplace add xpepper/tdd-kata-claude-plugin/plugin install xpepper-tdd-kata@xpepper/tdd-kata-claude-pluginDefined in hooks/hooks.json
{
"Stop": [
{
"hooks": [
{
"type": "prompt",
"prompt": "Validate kata session completion before stopping.\n\nCheck if there's an active TDD kata session (.tdd-session.json exists).\n\nIf active session exists:\n1. Read .tdd-session.json to check phase\n2. Read TODO.md to check for pending tasks\n3. Check recent commits to see if in middle of RED-GREEN-REFACTOR cycle\n\nBlock stopping if:\n- Phase is 'red' and last commit was a test (incomplete cycle - need GREEN phase)\n- Phase is 'green' and last commit was implementation (incomplete cycle - need REFACTOR phase)\n- TODO.md has current tasks marked in progress\n- Test results show failures (should resolve before stopping)\n\nAllow stopping if:\n- No active session (.tdd-session.json doesn't exist)\n- Phase is 'refactor' and last commit was refactoring (cycle complete)\n- Phase is 'complete' (kata finished)\n- User explicitly completed a full cycle\n\nReturn JSON:\n{\n \"decision\": \"approve|block\",\n \"reason\": \"Explanation of decision\",\n \"systemMessage\": \"Additional context or next steps\"\n}\n\nIf blocking, suggest:\n- What phase to complete next\n- Commands to check status (/kata-status)\n- How to properly complete the cycle",
"timeout": 30
}
],
"matcher": "*"
}
],
"PreToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "You are validating a Bash command for TDD kata discipline.\n\nCommand being run: $TOOL_INPUT\n\nRules to enforce:\n1. If .tdd-session.json doesn't exist, allow all commands (no active kata session)\n2. If running production code (not test commands): Check if tests exist. Block if no tests found.\n3. If running 'git commit' and phase is 'red' (from .tdd-session.json): Verify last test run shows FAILING tests. Block commit if tests pass or no test output found.\n4. If running 'git commit' and phase is 'green' or 'refactor': Verify last test run shows ALL PASSING tests. Block commit if any tests fail.\n\nTo check:\n- Read .tdd-session.json to get current phase (if file exists)\n- Look for recent test output in transcript or run test command to check status\n- Identify if this is a test command (cargo test, npm test, pytest, etc.) vs production code\n- For commits: verify test status matches phase requirements\n\nReturn JSON:\n{\n \"hookSpecificOutput\": {\n \"permissionDecision\": \"allow|deny|ask\",\n \"updatedInput\": null\n },\n \"systemMessage\": \"Explanation of decision\"\n}\n\nIf denying:\n- Explain what rule was violated\n- Tell what needs to be fixed\n- Provide actionable next steps",
"timeout": 45
}
],
"matcher": "Bash"
}
],
"SessionStart": [
{
"hooks": [
{
"type": "prompt",
"prompt": "Check for existing TDD kata session on startup.\n\nInstructions:\n1. Check if .tdd-session.json exists in current directory\n2. If exists:\n - Read and parse the file\n - Extract: kata phase, language, constraints, last updated time\n - Calculate session duration\n - Read TODO.md to get current tasks and lessons learned\n3. If session found, return systemMessage with:\n - \"🎯 TDD Kata Session Detected!\"\n - Current phase (RED/GREEN/REFACTOR)\n - Language and constraints\n - Last updated timestamp\n - Current TODO items (if TODO.md exists)\n - Suggestion: \"Use /kata-status for full session details\"\n4. If no session found, return empty systemMessage (silent)\n\nReturn JSON:\n{\n \"systemMessage\": \"Session resume info or empty string\",\n \"continue\": true\n}\n\nFormat systemMessage as a clear, informative summary that helps user resume their kata practice.",
"timeout": 30
}
],
"matcher": "*"
}
]
}{
"riskFlags": {
"touchesBash": true,
"matchAllTools": false,
"touchesFileWrites": false
},
"typeStats": {
"prompt": 3
},
"eventStats": {
"Stop": 1,
"PreToolUse": 1,
"SessionStart": 1
},
"originCounts": {
"absolutePaths": 0,
"pluginScripts": 0,
"projectScripts": 0
},
"timeoutStats": {
"commandsWithoutTimeout": 0
}
}