claude-hooks

Automate shell hook execution for Claude Code events.

24|6|Updated Nov 15, 2025
One-click install
npx skills add https://github.com/vinnie357/claude-skills --skill claude-hooks-vinnie357
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: claude-hooks
Source: https://github.com/vinnie357/claude-skills/tree/main/claude-code/skills/claude-hooks
Command: npx skills add https://github.com/vinnie357/claude-skills --skill claude-hooks-vinnie357

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables users to automate actions in response to specific Claude Code events, such as tool calls or user prompts. It allows for custom validation, formatting, logging, and integration with external systems, streamlining workflows and enforcing project standards.

Core Features & Use Cases

  • Event-Driven Automation: Configure onToolCall hooks to execute scripts before or after tools like Write, Edit, or Bash, or onUserPromptSubmit for user interactions.
  • Custom Validation & Formatting: Implement hooks for auto-formatting code on write, running linters on edit, or validating git commands before execution.
  • Integration with External Systems: Use hooks to trigger notifications, log events to external services, or integrate with CI/CD pipelines.
  • Use Case: To ensure all code written by Claude Code adheres to project style guides, implement an onToolCall hook for the Write tool that automatically runs prettier --write {{file_path}} and eslint --fix {{file_path}} after any file modification.

Quick Start

Create a hook that automatically runs 'prettier --write' on a file after Claude Code uses the 'Write' tool.

Frequently Asked Questions about claude-hooks

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

FAQPage Schema
How do I automatically run linters and formatters when Claude Code writes files?

Event-driven hooks let you execute shell scripts in response to Claude Code tool calls. Configure an `onToolCall` hook for the `Write` tool to run `prettier --write` and `eslint --fix` automatically after file modifications, enforcing project style guides without manual intervention.

What are Claude Code hooks and how do they work?

Hooks are automated shell scripts triggered by Claude Code events—tool calls like Write or Edit, lifecycle events like onInstall, or user prompts. They execute before or after an action using contextual variables like {{file_path}} and {{cwd}}, enabling validation, formatting, logging, and external system integration.

Can I integrate external tools and CI/CD systems with Claude Code workflows?

Yes. Hooks connect Claude Code to external systems by executing shell commands in response to events. Use `onToolCall` or `onUserPromptSubmit` hooks to trigger notifications, log events to external services, or integrate with CI/CD pipelines through custom shell scripts.

How do I configure hooks for my project?

Define hooks in a standalone `hooks.json` file, inline within `plugin.json`, or in plugin manifests. Specify the event type (`onToolCall`, `onUserPromptSubmit`, `onInstall`), target tool or action, and shell command with contextual variables like {{cwd}}, {{timestamp}}, and {{prompt}}.

What validation can I enforce with hooks before Claude Code executes commands?

Use `onToolCall` hooks to validate git commands, file paths, or code patterns before execution. Run custom validation scripts that check against project rules, then fail or modify the action based on the script's exit code, ensuring compliance with security and coding standards.

Do hooks support multiple file types and tool integrations?

Hooks support Tool Call Hooks for Write, Read, Edit, Bash, Glob, and other Claude Code tools, plus Lifecycle Hooks and User Prompt Hooks. File-scoped templating and contextual variables enable integration with any shell-compatible tool across different file types and workflows.