hooks-designer

Designs Claude Code lifecycle hooks that enforce quality gates, block dangerous operations, and log tool usage.

4|2|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/Arete-Consortium/ai-skills --skill hooks-designer-arete-consortium
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hooks-designer
Source: https://github.com/Arete-Consortium/ai-skills/tree/main/personas/claude-code/hooks-designer
Command: npx skills add https://github.com/Arete-Consortium/ai-skills --skill hooks-designer-arete-consortium

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Claude Code executes tools without built-in enforcement of project-specific rules, so teams lack automated guardrails for tests-before-commit, protected paths, and audit logging. This Skill designs PreToolUse and PostToolUse hook scripts that run automatically during tool execution to enforce those rules. ## Core Features & Use Cases - Quality Gates: Create hooks that block git commits until tests pass, using marker-file patterns to keep hooks fast. - Safety Rails: Block writes to protected directories (.git, node_modules, .env) and prevent force-pushes to main or production branches. - Observability: Log every tool invocation as structured JSON lines with timestamps, session IDs, and project paths. - Use Case: A team wants Claude to never commit code without passing tests. Use this Skill to generate a PreToolUse tdd-guard hook plus a PostToolUse marker hook, wire them into .claude/settings.json, and debug them with sample stdin JSON. ## Quick Start Ask Claude to design a PreToolUse hook that blocks git commits unless the test suite has passed in the current session.

Frequently Asked Questions about hooks-designer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Claude Code hook that blocks git commits?▼

Write a PreToolUse hook script matching the Bash tool that inspects tool_input.command for git commit, checks a condition such as a test-passed marker file, and exits with code 2 plus a stderr message to block. Register it in .claude/settings.json under hooks.PreToolUse.

What is the difference between PreToolUse and PostToolUse hooks?▼

PreToolUse hooks fire before a tool executes and can block it with exit code 2, while PostToolUse hooks fire after execution and are used for logging, validation, or follow-up actions like auto-formatting written files.

How do Claude Code hook exit codes work?▼

Exit code 0 allows the tool to proceed, exit code 1 signals a hook error and fails open so the tool still runs, and exit code 2 blocks execution with the stderr message shown to Claude as the reason.

Why is my Claude Code hook not firing or blocking?▼

Common causes are a missing chmod +x on the script, a matcher that does not match the tool name, or jq parsing failures on the stdin JSON. Test the hook directly by piping sample JSON into it and checking the exit code.

When should I not use Claude Code hooks?▼

Avoid hooks for CI/CD pipelines running Claude headlessly, for extending Claude with new tools (use MCP servers instead), and for blocking mid-task file writes, which confuses the agent. Gate at natural checkpoints like commit or push instead.