Hooks Skill — Fencepost & Claude Code Hooks

Implement PreToolUse and PostToolUse hooks to enforce safe Claude Code tool usage.

Updated Feb 28, 2026
One-click install
npx skills add https://github.com/IMBurbank/ganttlet --skill hooks-skill-fencepost-claude-code-hooks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Hooks Skill — Fencepost & Claude Code Hooks
Source: https://github.com/IMBurbank/ganttlet/tree/main/.claude/skills/hooks
Command: npx skills add https://github.com/IMBurbank/ganttlet --skill hooks-skill-fencepost-claude-code-hooks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Hooks Skill provides guardrails for Claude Code integrations, ensuring PreToolUse and PostToolUse hooks run safely and consistently to prevent unsafe edits, enforce project boundaries, and maintain workflow invariants.

Core Features & Use Cases

  • Hook types: PreToolUse and PostToolUse hooks that block or lint tool invocations and post-run checks.
  • Registration & configuration: Settings.json and settings.local.json for hook declarations and per-environment overrides.
  • Project-context detection: Automatic detection of project root and worktrees to distinguish protected areas from transitory workspaces.
  • Use Case: Teams integrating Claude Code into a monorepo can enforce guardrails so agents cannot modify root-level files or break branch policies.

Quick Start

Follow the integration steps to install and register the hooks in your Claude Code environment.

Frequently Asked Questions about Hooks Skill — Fencepost & Claude Code Hooks

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

FAQPage Schema
How do I enforce safe tool usage guardrails in Claude Code?

Claude Code guardrails are enforced by implementing PreToolUse and PostToolUse hooks with Fencepost to block unsafe edits, lint tool invocations, and run post-run checks for consistent workflow invariants.

Can I prevent Claude Code agents from modifying root-level files in a monorepo?

You can prevent root-level file modifications in a monorepo by configuring Fencepost hooks to detect the project root and worktrees, distinguishing protected areas from transitory workspaces.

How do I configure PreToolUse and PostToolUse hooks for Claude Code?

PreToolUse and PostToolUse hooks are configured by declaring them in settings.json and settings.local.json, enabling per-environment overrides for hook registration and runtime context.

What is the difference between PreToolUse and PostToolUse hooks in Claude Code?

PreToolUse hooks block or validate tool invocations before execution, while PostToolUse hooks execute post-run checks to maintain workflow invariants after the tool completes.

Does Fencepost support worktree isolation for multiple repositories?

Fencepost supports worktree isolation across multiple repositories by automatically detecting project roots and worktrees to enforce project boundaries and branch policies.

When do I need Claude Code hooks for my development environment?

Claude Code hooks are needed when integrating agents into development environments requiring project-root protection, worktree isolation, and consistent post-run checks to prevent unsafe edits.