WEEK 2 In Progress

Hooks Mastery

Build security and automation hooks to control Claude Code's behavior.

Time Limit
60 min
🎯
Format
3-Stage Sprint
📈
Max Score
100 +20

SITUATION

Your security team has requested a Hook system for Claude Code. They need to block sensitive file access and automate code quality checks. The project has incomplete hooks that you need to fix and extend.

🔒
Security Focus

Hooks intercept Claude's tool usage. Use exit code 2 to block dangerous operations. Document your learnings in CLAUDE.md using the # command!

PROJECT SETUP

Download Hooks Challenge

Click to download hooks-challenge.zip directly

Terminal
# 1. Extract the downloaded zip
unzip hooks-challenge.zip -d my-hooks

# 2. Navigate to project
cd my-hooks

# 3. Install dependencies
npm install

# 4. Copy settings (IMPORTANT!)
cp .claude/settings.example.json .claude/settings.json
💡
First Step

Run /init to analyze the project. Check hooks/ directory for existing hooks.

🔒

Challenge Details Locked

Start your timer to reveal the challenge requirements, scoring rubric, and submission form.

Your time will be recorded for the leaderboard ranking.

WHAT YOU'LL PRACTICE

🔒

PreToolUse Hooks

Intercept and control tool execution before it happens.

exit(2) to block

PostToolUse Hooks

Automate actions after tool execution completes.

tool_response data
🧠

Claude Agent SDK

Call Claude programmatically from hooks.

@anthropic-ai/claude-agent-sdk
🛠

settings.json

Configure hook matchers and commands.

Write|Edit|MultiEdit

SUBMIT YOUR WORK

Please login to submit your solution.
Start Timer to reveal challenge details and submit form