Skip to content

These pages document master, which is unreleased and in development. The Quick Start installs the latest stable release; anything newer than that tag is marked in the text.

Hooks — Manual Test Cases

Add Phase 2 P0 hooks: verify-on-stop, verify-after-edit, notify
- verify-on-stop.sh: runs tests when Claude finishes (6 stacks)
- verify-after-edit.sh: runs type checker after edits (7 langs)
- notify.sh: desktop notifications (macOS/Linux)
- settings.json, docs/hooks-guide.md, setup automation
Terminal window
cd claude_code && bash claude-setup.sh
ls ~/.claude/hooks/
jq '.hooks | keys' ~/.claude/settings.json

Expected: 3 .sh files; keys include Notification, PostToolUse, Stop

2. claude-setup.sh does not overwrite existing hooks config

Section titled “2. claude-setup.sh does not overwrite existing hooks config”
Terminal window
# Run setup twice — second run should skip, not overwrite
bash claude-setup.sh
bash claude-setup.sh

Expected: second run prints [skip] ... already has hooks configured

3. claude-code init does NOT touch global settings

Section titled “3. claude-code init does NOT touch global settings”
Terminal window
bash claude-code init web-static /tmp/test-project
rm -rf /tmp/test-project

Expected: no output about hooks or settings.json — init only creates project files

Terminal window
echo '{"title":"Test","message":"Hook works"}' | ~/.claude/hooks/notify.sh

Expected: macOS notification banner appears

Terminal window
echo '{"title":"Test","message":""}' | ~/.claude/hooks/notify.sh; echo $?

Expected: exit 0, no notification

6. verify-after-edit.sh skips non-source files

Section titled “6. verify-after-edit.sh skips non-source files”
Terminal window
echo '{"tool_input":{"file_path":"README.md"}}' | ~/.claude/hooks/verify-after-edit.sh; echo $?

Expected: exit 0 (skipped, .md is not a source file)

7. verify-after-edit.sh runs tsc on TypeScript

Section titled “7. verify-after-edit.sh runs tsc on TypeScript”
Terminal window
# Run in a TypeScript project directory:
echo '{"tool_input":{"file_path":"src/index.ts"}}' \
| CLAUDE_PROJECT_DIR="$(pwd)" ~/.claude/hooks/verify-after-edit.sh; echo $?

Expected: 0 if types pass, 2 with errors on stderr

Terminal window
echo '{"stop_hook_active":true}' | ~/.claude/hooks/verify-on-stop.sh; echo $?

Expected: exit 0 immediately (no tests run)

9. verify-on-stop.sh skips when no test runner

Section titled “9. verify-on-stop.sh skips when no test runner”
Terminal window
echo '{"stop_hook_active":false}' \
| CLAUDE_PROJECT_DIR=/tmp ~/.claude/hooks/verify-on-stop.sh; echo $?

Expected: exit 0 (no package.json/go.mod/etc found)

Terminal window
# Run in a Node.js project with tests:
echo '{"stop_hook_active":false}' \
| CLAUDE_PROJECT_DIR="$(pwd)" ~/.claude/hooks/verify-on-stop.sh; echo $?

Expected: 0 if tests pass, 2 with failure output on stderr