claude-code-hooks

Automate user-defined hooks around Claude Code tools for validation and logging.

1|Updated Jan 26, 2026
One-click install
npx skills add https://github.com/AskTinNguyen/vesper-team-skills --skill claude-code-hooks-asktinnguyen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: claude-code-hooks
Source: https://github.com/AskTinNguyen/vesper-team-skills/tree/main/claude-code-hooks
Command: npx skills add https://github.com/AskTinNguyen/vesper-team-skills --skill claude-code-hooks-asktinnguyen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Implements a structured, reusable way to inject automation, validation, logging, and custom behavior into Claude Code's workflow by enabling pre- and post-execution hooks.

Core Features & Use Cases

  • PreToolUse and PostToolUse hooks to enforce policies (e.g., block dangerous operations, log commands, auto-format edits).
  • UserPromptSubmit hooks to enrich prompts with context or save prompts for quality control.
  • Stop/SubagentStop/Session hooks for archival, notifications, and cleanup.
  • Scripts and references directories provide ready-to-use hooks and documentation; assets can store sample configurations or docs.

Quick Start

Configure a PreToolUse hook to block dangerous commands and a PostToolUse hook to log and format edits.

Frequently Asked Questions about claude-code-hooks

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

FAQPage Schema
Do I need external dependencies to run custom hooks with Claude Code?

No external dependencies are required to run custom hooks with Claude Code. The Skill provides ready-to-use scripts and references directories, supporting standalone YAML frontmatter configurations for immediate deployment.

How do I automate pre and post execution hooks around Claude Code tools?

Automate Claude Code hooks by configuring PreToolUse and PostToolUse injections to enforce policies, log commands, and auto-format edits safely. This structured approach embeds validation and logging directly into the workflow without manual intervention.

Can I block dangerous commands before Claude Code executes them?

Block dangerous commands by setting up a PreToolUse hook to enforce security policies before tool execution. This validates operations beforehand, preventing unauthorized or risky actions from running.

How do I log and auto-format edits after Claude Code makes file changes?

Log and auto-format edits by configuring a PostToolUse hook to trigger after file modifications. This automatically records command history and applies formatting rules to ensure consistency.

What is the best way to capture user prompts for quality control in Claude Code?

Capture user prompts for quality control by implementing a UserPromptSubmit hook to enrich prompts with context or save them. This provides a structured record of inputs for later review.

How do I handle archival and cleanup when Claude Code stops or finishes a session?

Handle archival and cleanup by configuring Stop or SubagentStop hooks to trigger when execution halts. These session hooks automate notifications, save logs, and perform necessary environment teardown.