Skip to content
Daniel Alfocea AcademyES Log in
All paths Capsule · Claude Code · IA

Your first hook in Claude Code

Create a hook in .claude/settings.json that blocks a dangerous command, test it by hand and debug it when it does not fire

  • LevelIntermediate
  • Duration18 min
  • BadgeClaude Code
PlanPlus Get Plus Log in

What you will see

  1. 1. What a hook is and why `CLAUDE.md` is not enough
  2. 2. Where they live
  3. 3. The JSON shape
  4. 4. What the hook receives and how it answers
  5. 5. First hook: block dangerous commands
  6. 6. Second hook: format after editing
  7. 7. Test without Claude
  8. 8. When it does not fire
  9. Take away

At the end, a short quiz. Pass it and the capsule gives you points toward this badge.