返回 AiToEarn
hooks.md
1 # Hooks System
2
3 > **Note:** This documents the local Claude Code hooks configuration (`~/.claude/settings.json`), not project coding standards. These hooks are configured per-developer.
4
5 ## Hook Types
6
7 - **PreToolUse**: Before tool execution (validation, parameter modification)
8 - **PostToolUse**: After tool execution (auto-format, checks)
9 - **Stop**: When session ends (final verification)
10
11 ## Current Hooks (in ~/.claude/settings.json)
12
13 ### PreToolUse
14 - **tmux reminder**: Suggests tmux for long-running commands (npm, pnpm, yarn, cargo, etc.)
15 - **git push review**: Opens Zed for review before push
16 - **doc blocker**: Blocks creation of unnecessary .md/.txt files
17
18 ### PostToolUse
19 - **PR creation**: Logs PR URL and GitHub Actions status
20 - **Prettier**: Auto-formats JS/TS files after edit
21 - **TypeScript check**: Runs tsc after editing .ts/.tsx files
22 - **console.log warning**: Warns about console.log in edited files
23
24 ### Stop
25 - **console.log audit**: Checks all modified files for console.log before session ends
26
27 ## Auto-Accept Permissions
28
29 Use with caution:
30 - Enable for trusted, well-defined plans
31 - Disable for exploratory work
32 - Never use dangerously-skip-permissions flag
33 - Configure `allowedTools` in `~/.claude.json` instead
34
35 ## TodoWrite Best Practices
36
37 Use TodoWrite tool to:
38 - Track progress on multi-step tasks
39 - Verify understanding of instructions
40 - Enable real-time steering
41 - Show granular implementation steps
42
43 Todo list reveals:
44 - Out of order steps
45 - Missing items
46 - Extra unnecessary items
47 - Wrong granularity
48 - Misinterpreted requirements
49
49 lines MARKDOWN