DEV Community

Cover image for Your Prompt Rules Are Just Suggestions: Claude Code Hooks Auto-Format Every Edit and Block Dangerous Commands (2-Minute Setup)
quickpromptco
quickpromptco

Posted on Edited on Originally published at quickpromptco.com

Your Prompt Rules Are Just Suggestions: Claude Code Hooks Auto-Format Every Edit and Block Dangerous Commands (2-Minute Setup)

You told Claude Code “always run the formatter after editing” and “never run rm -rf ”. It listened, until it didn’t. A rule in a prompt is a request — it can be forgotten, skipped, or missed after a context compaction.

A hook is not a request. It’s a shell command that runs automatically at a specific point in the agent’s workflow, and it can actually block an action before it happens. This guide covers real, practical hook setups you can have running in about 2 minutes, not just the concept.

What the full guide covers:

  • What You’ll Need
  • Step-by-Step Setup
  • What Each Piece Does
  • Verify a Hook Actually Fires

The commands, our own test notes, and the troubleshooting steps are in the full guide, which we keep up to date:

Read the full guide on quickpromptco.com

Top comments (0)