creating-hooks

Execute shell commands at Claude Code lifecycle events with configurable matchers.

1|Updated May 14, 2025
One-click install
npx skills add https://github.com/fcnatra/VibeCoding --skill creating-hooks-fcnatra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: creating-hooks
Source: https://github.com/fcnatra/VibeCoding/tree/main/Copilot%20Tools/skills/claude-code/creating-hooks
Command: npx skills add https://github.com/fcnatra/VibeCoding --skill creating-hooks-fcnatra

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill allows you to automate repetitive tasks and enforce project rules within Claude Code by executing custom shell commands at specific lifecycle points.

Core Features & Use Cases

  • Deterministic Execution: Run shell commands automatically when Claude Code edits files, finishes tasks, or needs input, ensuring consistent behavior.
  • Customizable Workflows: Format code after edits, block dangerous commands, send desktop notifications, and inject context on session start.
  • Use Case: Automatically format all TypeScript files after Claude Code writes or edits them, ensuring consistent code style across your project.

Quick Start

Update the reference documentation by running the provided Python script.

Frequently Asked Questions about creating-hooks

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

FAQPage Schema
How do I automate shell commands to run automatically when Claude Code edits files?

You can automate shell commands in Claude Code by configuring hooks at specific lifecycle points like PostToolUse. This enables deterministic execution of custom scripts, ensuring tasks such as file formatting run automatically after edits.

What is a Claude Code hook and when do I need to use lifecycle events?

A Claude Code hook is a system that triggers deterministic shell commands at specific lifecycle events like PreToolUse or SessionStart. You need hooks to automate repetitive tasks, enforce project rules, or inject context without manual intervention.

Can I block dangerous shell commands from executing in my Claude Code workflow?

Yes, you can block dangerous commands by configuring a hook for the PreToolUse event. By setting configurable matchers for precise triggering, the hook intercepts and prevents unauthorized shell commands from executing within your project environment.

How do I configure hooks to trigger only for specific file types or commands?

Hooks use configurable matchers for precise triggering based on your user and project settings. You can configure these matchers within your settings files to ensure specific shell commands only execute when designated file types or commands are interacted with.

Does the Claude Code hook system support sending desktop notifications?

Yes, the hook system supports a Notification lifecycle event. You can configure custom shell commands to execute automatically when this event triggers, allowing you to send desktop notifications when Claude Code finishes tasks or needs input.

What are the limitations of using shell command hooks for workflow automation?

Hook automation relies on predefined lifecycle events like SessionStart and PostToolUse, meaning shell commands only execute at these specific points. Complex conditional logic outside of configurable matchers is not natively supported by the hook system.