mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-02-07 15:13:08 +08:00
47 lines
1.4 KiB
Markdown
47 lines
1.4 KiB
Markdown
|
|
# Hooks System
|
||
|
|
|
||
|
|
## Hook Types
|
||
|
|
|
||
|
|
- **PreToolUse**: Before tool execution (validation, parameter modification)
|
||
|
|
- **PostToolUse**: After tool execution (auto-format, checks)
|
||
|
|
- **Stop**: When session ends (final verification)
|
||
|
|
|
||
|
|
## Current Hooks (in ~/.claude/settings.json)
|
||
|
|
|
||
|
|
### PreToolUse
|
||
|
|
- **tmux reminder**: Suggests tmux for long-running commands (npm, pnpm, yarn, cargo, etc.)
|
||
|
|
- **git push review**: Opens Zed for review before push
|
||
|
|
- **doc blocker**: Blocks creation of unnecessary .md/.txt files
|
||
|
|
|
||
|
|
### PostToolUse
|
||
|
|
- **PR creation**: Logs PR URL and GitHub Actions status
|
||
|
|
- **Prettier**: Auto-formats JS/TS files after edit
|
||
|
|
- **TypeScript check**: Runs tsc after editing .ts/.tsx files
|
||
|
|
- **console.log warning**: Warns about console.log in edited files
|
||
|
|
|
||
|
|
### Stop
|
||
|
|
- **console.log audit**: Checks all modified files for console.log before session ends
|
||
|
|
|
||
|
|
## Auto-Accept Permissions
|
||
|
|
|
||
|
|
Use with caution:
|
||
|
|
- Enable for trusted, well-defined plans
|
||
|
|
- Disable for exploratory work
|
||
|
|
- Never use dangerously-skip-permissions flag
|
||
|
|
- Configure `allowedTools` in `~/.claude.json` instead
|
||
|
|
|
||
|
|
## TodoWrite Best Practices
|
||
|
|
|
||
|
|
Use TodoWrite tool to:
|
||
|
|
- Track progress on multi-step tasks
|
||
|
|
- Verify understanding of instructions
|
||
|
|
- Enable real-time steering
|
||
|
|
- Show granular implementation steps
|
||
|
|
|
||
|
|
Todo list reveals:
|
||
|
|
- Out of order steps
|
||
|
|
- Missing items
|
||
|
|
- Extra unnecessary items
|
||
|
|
- Wrong granularity
|
||
|
|
- Misinterpreted requirements
|