ATLAS ROOM
← Home
🪝HOOKS
reel #08

Claude tests your code on its own

What this is

A free, step-by-step template from Taha's reels — the exact tools, prompts and links, laid out so you can follow along and ship. Comment the keyword on the reel and it also lands in your DMs.

Hey! 👋 Here's what I promised you:

Claude Code Hooks — commands that run automatically with every step Claude takes: it edits, and the hook tests right after — without you telling it to. These are the two hooks I use myself:

🔗Official docshttps://code.claude.com/docs/en/hooks

How to start

  1. Add this to your project's .claude/settings.json (replace npm test && npm run lint with your project's commands):
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          { "type": "command", "command": "npm test && npm run lint" }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          { "type": "command", "command": "git diff --cached | grep -qiE 'api[_-]?key|secret|password' && echo 'STOP: secrets f staged files!' >&2 && exit 2 || exit 0" }
        ]
      }
    ]
  }
}
exit 2 is what blocks: Claude stops and reads the error message.
  1. Add the rule to your project's CLAUDE.md so it becomes a habit for Claude:
Any code you write or edit, run the tests before you consider the task done.
Big changes = test the whole workflow.
  1. Try it: ask Claude to edit a file — you'll see the tests run on their own right after. ✅
New to vibe coding? See what you'll learn →
Previous
🤖AGENTS
Next
ANTI🚀

More free templates

Browse all templates →