FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Claude Code Hooks: Auto-Format, Security Guards, and Test Triggers on Every Tool Call
How-ToTools

Claude Code Hooks: Auto-Format, Security Guards, and Test Triggers on Every Tool Call

via Dev.tomyougaTheAxo3w ago

Claude Code's Hooks system lets you run scripts automatically before or after every tool call — code writes, bash commands, file edits. Configure them once, and every interaction gets automatic quality enforcement. What Hooks Can Do Before bash execution → Block dangerous commands ( rm -rf / , DROP DATABASE ) After file writes → Auto-format with Prettier/Ruff/gofmt After file writes → Scan for leaked API keys After source changes → Run related unit tests automatically Hook Configuration Add hooks to .claude/settings.json (project-level) or ~/.claude/settings.json (global): { "hooks" : { "PreToolUse" : [ { "matcher" : "Bash" , "hooks" : [{ "type" : "command" , "command" : "python .claude/hooks/guard.py" }] } ], "PostToolUse" : [ { "matcher" : "Write|Edit" , "hooks" : [{ "type" : "command" , "command" : "python .claude/hooks/format.py" , "timeout" : 30 }] } ] } } Exit Code Protocol For PreToolUse hooks: Exit Code Meaning 0 Allow — tool executes normally 2 Block — tool execution is cancel

Continue reading on Dev.to

Opens in a new tab

Read Full Article
39 views

Related Articles

Why this Marshall is the first soundbar I've tested that truly challenges my Sonos Arc Ultra
How-To

Why this Marshall is the first soundbar I've tested that truly challenges my Sonos Arc Ultra

ZDNet • 1d ago

This App Makes Even the Sketchiest PDF or Word Doc Safe to Open
How-To

This App Makes Even the Sketchiest PDF or Word Doc Safe to Open

Wired • 1d ago

References: The Alias You Didn’t Know You Needed
How-To

References: The Alias You Didn’t Know You Needed

Medium Programming • 1d ago

Pointers: The Concept Everyone Says Is Hard
How-To

Pointers: The Concept Everyone Says Is Hard

Medium Programming • 1d ago

Learning a Recurrent Visual Representation for Image Caption Generation
How-To

Learning a Recurrent Visual Representation for Image Caption Generation

Dev.to • 1d ago

Discover More Articles