Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

hooks-configuration

БесплатноБез исполняемых скриптовНе проверен

Claude Code hooks configuration and development. Use when the user mentions hooks, PreToolUse, PostToolUse, SessionStart, SubagentStart, PermissionRequest, or…

laurigatesот laurigates★ 61 звезда на GitHub11 установок в других каталогах

Об этом скилле

Claude Code Hooks Configuration

Expert knowledge for configuring and developing Claude Code hooks to automate workflows and enforce best practices.

When to Use This Skill

Use this skill when... Use something else when...
Configuring hook lifecycle events (PreToolUse, PostToolUse, etc.) Writing general shell scripts unrelated to hooks
Blocking dangerous commands or enforcing patterns Setting up CI/CD pipelines (use CI tooling)
Auto-formatting files after edits Configuring Claude Code settings unrelated to hooks
Injecting context at session or subagent start Writing standalone automation scripts
Setting up PermissionRequest auto-approve/deny Managing project permissions via settings.json directly
Developing prompt or agent hooks for judgment-based decisions Building MCP servers or custom tool integrations

Core Concepts

What Are Hooks? Hooks are user-defined shell commands that execute at specific points in Claude Code's lifecycle. Unlike relying on Claude to "decide" to run something, hooks provide deterministic, guaranteed execution.

Why Use Hooks?

  • Enforce code formatting automatically
  • Block dangerous commands before execution
  • Inject context at session start
  • Log commands for audit trails
  • Send notifications when tasks complete

Hook Lifecycle Events

Event When It Fires Key Use Cases
SessionStart Session begins/resumes Environment setup, context loading
SessionEnd Session terminates Cleanup, state persistence
UserPromptSubmit User submits prompt Input validation, context injection
UserPromptExpansion A typed skill/command/MCP prompt expands, before it reaches Claude Block a command, inject skill-specific context, log invocations
PreToolUse Before tool execution Permission control, blocking dangerous ops
PostToolUse After tool completes Auto-formatting, logging, validation
PostToolUseFailure After tool execution fails Retry decisions, error handling
PermissionRequest Claude requests permission for a tool Auto approve/deny without user prompt
PermissionDenied Auto mode denies a tool call Audit denials, tell the model it may retry (retry: true)
PostToolBatch A batch of parallel tool calls has resolved, before the next model call Inject context once per batch, stop the loop
Stop Main agent finishes responding Notifications, git reminders
SubagentStart Subagent (Task tool) is about to start Input modification, context injection
SubagentStop Subagent finishes Per-task completion evaluation
WorktreeCreate New git worktree created via EnterWorktree Worktree setup, dependency install
WorktreeRemove Worktree removed after session exits Cleanup, uncommitted changes alert
TeammateIdle Teammate in agent team goes idle Assign additional tasks to teammate
TaskCompleted Task in shared task list marked complete Validation gates before task acceptance
PreCompact Before context compaction Transcript backup
Notification Claude sends notification Custom alerts
ConfigChange Claude Code settings change at runtime Audit config changes, validation
PreModelSwitch Before the session model changes (/model, fallbackModel, safety-classifier fallback) Audit or record the outgoing model
PostModelSwitch After the session model has changed Re-apply per-model settings, log the new model

Stop vs SubagentStop: Stop fires at the session level when the main agent finishes a response turn. SubagentStop fires when an individual subagent (spawned via the Task tool) completes. Use Stop for session-level notifications; use SubagentStop for per-task quality gates.

For full schemas, examples, and timeout recommendations for each event, see .claude/rules/hooks-reference.md.

Configuration

File Locations

Hooks are configured in settings files:

  • ~/.claude/settings.json - User-level (applies everywhere)
  • .claude/settings.json - Project-level (committed to r
Полный SKILL.md на GitHub

Установить hooks-configuration в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(bash *)
Bash(cat *)
Read
Write
Edit
Glob
Grep
TodoWrite

Вложенные файлы

REFERENCE.mdreferences/frontmatter-hooks.mdreferences/hook-patterns.mdreferences/troubleshooting.md

FAQ

Что делает скилл hooks-configuration?

Claude Code hooks configuration and development. Use when the user mentions hooks, PreToolUse, PostToolUse, SessionStart, SubagentStart, PermissionRequest, or TaskCompleted.

Как установить скилл hooks-configuration?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл hooks-configuration запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить hooks-configuration с