CLAUDE LABJP
FORK — Claude Code 2.1.212 changes what /fork does: it copies your conversation into a new background session with its own row in claude agents, so you can keep working. The old in-session subagent is now /subtaskLIMITS — WebSearch calls are now capped at 200 per session by default, and subagent spawns get the same 200 ceiling, so a runaway search or delegation loop stops on its ownMCPBG — MCP tool calls running past two minutes now move to the background automatically, keeping the session usable. Tune the threshold with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSPLANFIX — Fixed plan mode auto-running file-modifying Bash commands such as touch and rm without a permission prompt or an SDK canUseTool callbackSONNET5 — Claude Sonnet 5 is running on introductory pricing of $2 per million input tokens and $10 per million output. After August 31 it moves to $3 and $15IPO — Bankers are reportedly lining up investor meetings for Anthropic ahead of a possible public listing as soon as OctoberFORK — Claude Code 2.1.212 changes what /fork does: it copies your conversation into a new background session with its own row in claude agents, so you can keep working. The old in-session subagent is now /subtaskLIMITS — WebSearch calls are now capped at 200 per session by default, and subagent spawns get the same 200 ceiling, so a runaway search or delegation loop stops on its ownMCPBG — MCP tool calls running past two minutes now move to the background automatically, keeping the session usable. Tune the threshold with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSPLANFIX — Fixed plan mode auto-running file-modifying Bash commands such as touch and rm without a permission prompt or an SDK canUseTool callbackSONNET5 — Claude Sonnet 5 is running on introductory pricing of $2 per million input tokens and $10 per million output. After August 31 it moves to $3 and $15IPO — Bankers are reportedly lining up investor meetings for Anthropic ahead of a possible public listing as soon as October
Articles/Claude Code
Claude Code/2026-03-24Advanced

Claude Code Hooks— Practical Techniques to Automate Your Dev Workflow

Learn how to automate your development workflow with Claude Code Hooks. From PreToolUse and PostToolUse configuration to automated code review, security checks, and deployment pipeline integration.

claude-code129hooks14automation96workflow37devops2

Premium Article

What Are Claude Code Hooks — The Automation Layer That Transforms Your Workflow

Claude Code Hooks let you automatically run custom scripts before and after Claude executes tools. This means you can fully automate code reviews, test runs, security checks, and more — tasks that used to require manual intervention.

In 2026, collaborating with AI assistants is the norm in software development. But shipping AI-generated code straight to production without guardrails is risky. Hooks give you a way to apply consistent quality controls to Claude's output automatically, balancing safety with efficiency.

Hook Structure and Configuration

Claude Code Hooks are defined in .claude/settings.json. There are four hook types available:

// .claude/settings.json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hook": {
          "type": "command",
          "command": "bash .claude/hooks/pre-edit-check.sh \"$FILEPATH\""
        }
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hook": {
          "type": "command",
          "command": "bash .claude/hooks/post-edit-lint.sh \"$FILEPATH\""
        }
      }
    ],
    "Notification": [
      {
        "matcher": "",
        "hook": {
          "type": "command",
          "command": "bash .claude/hooks/notify-slack.sh \"$MESSAGE\""
        }
      }
    ],
    "Stop": [
      {
        "matcher": "",
        "hook": {
          "type": "command",
          "command": "bash .claude/hooks/on-stop.sh"
        }
      }
    ]
  }
}

Here's what each hook type does:

PreToolUse — The Gatekeeper Before Execution

Fires before Claude edits files or runs commands. Returning exit code 2 blocks the tool execution entirely, making it ideal for preventing dangerous operations.

PostToolUse — Quality Checks After Execution

Fires immediately after a file edit or command completes. Perfect for automated linting, type checking, and test execution.

Notification — Automated Alert Forwarding

Fires when Claude issues a notification. Useful for Slack alerts, email notifications, or logging.

Stop — Session Cleanup

Fires just before Claude finishes a task and returns its response. Great for logging, cleanup, and summary generation.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
CI/CD pipeline full automation techniques combining Git hooks with Claude Code
Automated pre-commit fixes, formatting, security scanning implementation and optimization
Automated review process and production deployment validation methodology
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Claude Code2026-06-18
Claude Code Adds /cd — Carrying Your Warm Cache Across Repositories
Claude Code's new /cd moves a running session to another working directory without rebuilding the prompt cache. Here are the design calls and pitfalls when you sweep across several repositories in one sitting.
Claude Code2026-06-14
Running Claude Code Hooks as a Quality Gate Without Breaking Your Pipeline
An implementation note on running Claude Code Hooks as a safety valve for automation: when to block with exit code 2 versus JSON output, how to keep formatters from looping or over-blocking, and how to log every hook firing so misfires are traceable.
Claude Code2026-04-25
When Claude Code Hooks Loop Forever — Stopping Self-Triggering PostToolUse Hooks
You wired up Claude Code hooks and now your terminal is a waterfall of tool calls that won't stop. Here's why PostToolUse hooks loop on themselves, and the patterns I use in real projects to make sure they never do again.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →