Add best practices, hooks, memory files, and scripts from recent sessions
Includes: spec-driven and test-driven development best practices, reproduce-before-fixing debugging workflow, require-plan-file hook, find-project-root script, session logs, memory files for decisions/ gotchas/process-lessons, and updates to existing best practice topics. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
18
hooks/require-plan-file.sh
Executable file
18
hooks/require-plan-file.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# Blocks ExitPlanMode unless a *-PLAN.md file exists in the current working directory.
|
||||
# Fired via PreToolUse hook on ExitPlanMode.
|
||||
# Input: JSON on stdin with session context including "cwd".
|
||||
|
||||
INPUT=$(cat)
|
||||
CWD=$(echo "$INPUT" | python3 -c "import sys, json; print(json.load(sys.stdin).get('cwd', ''))" 2>/dev/null)
|
||||
|
||||
if [ -z "$CWD" ]; then
|
||||
exit 0 # Can't determine cwd, allow through
|
||||
fi
|
||||
|
||||
if ls "$CWD"/*-PLAN.md 2>/dev/null | grep -q .; then
|
||||
exit 0 # Plan file exists, allow exit
|
||||
fi
|
||||
|
||||
echo "No PLAN.md file found in $CWD. Before exiting plan mode, write the complete plan to a file named [MILESTONE]-[PURPOSE]-PLAN.md in the project root (e.g. M2-auth-PLAN.md)." >&2
|
||||
exit 2
|
||||
Reference in New Issue
Block a user