hooks-creator
БесплатноБез исполняемых скриптовНе проверен**WORKFLOW SKILL — MANDATORY for ANY hook work.** Create, configure, edit, debug, or review lifecycle hooks for VS Code Copilot (default) and Claude Code. USE…
от gabrielmoreira★ 23 звезды на GitHubОб этом скилле
Hooks Creator — Complete Guide to Agent Lifecycle Hooks
You are an expert at creating and configuring lifecycle hooks for AI agents. When the user asks you to create a hook, follow this guide to produce a complete, cross-platform, well-structured hook configuration. All hooks should be written in JavaScript (Node.js) — a single .js file that runs identically on Windows, macOS, and Linux.
⚠️ MANDATORY DEFAULT: VS Code GitHub Copilot
Unless the user explicitly says otherwise, the target platform is ALWAYS VS Code GitHub Copilot.
- ✅ Default target: VS Code Copilot —
.github/hooks/*.json(workspace) or.agent.mdfrontmatter (agent-scoped) - ✅ Switch to Claude Code ONLY if: user explicitly says "Claude" / "Claude Code", OR a
.claude/directory exists in the workspace, OR the user is editing~/.claude/settings.json - ❌ NEVER assume Claude Code by default
- ❌ NEVER write hooks to
.claude/settings.jsonwithout explicit user request or evidence - ❌ If unsure, ASK which platform — do not guess Claude
When generating examples, paths, configuration snippets, or installation steps, default to the Copilot equivalents (.github/hooks/, ~/.copilot/hooks/scripts/, chat.useCustomAgentHooks, tool_name === 'run_in_terminal'). Mention Claude Code only as a secondary note when relevant.
What are Hooks?
Hooks are deterministic commands executed at specific lifecycle events during an agent session. Unlike instructions (which are non-deterministic \u2014 the agent may or may not follow them), hooks guarantee execution. They run as real processes, receive structured JSON input via stdin, and return structured JSON output via stdout. Use hooks when you need certainty: enforcement, logging, validation, or context injection that must happen every time.
Platform Detection
Default = VS Code GitHub Copilot. Only switch to Claude Code with explicit evidence (see decision table below).
| Signal | Platform | Hook Support |
|---|---|---|
| Nothing said + no evidence | VS Code Copilot (DEFAULT) | 8 events, command type only |
| User says "Copilot" / "GitHub Copilot" / "VS Code" | VS Code Copilot | 8 events, command type only |
.agent.md in workspace |
VS Code Copilot | 8 events, command type only |
.github/hooks/ exists |
VS Code Copilot | Workspace hooks |
| User explicitly says "Claude" / "Claude Code" | Claude Code | 20 events, 4 hook types |
.claude/ directory exists |
Claude Code | 20 events, 4 hook types |
Both .agent.md and .claude/ present |
Ask the user which one | — |
Detection strategy:
- Re-read the user's exact wording. Did they say "Copilot" or "Claude"? Trust their words.
- Check for
.claude/directory → if absent, target is Copilot. - Check for
.github/hooks/or.agent.md→ confirms Copilot. - If still unclear AND there's no signal at all → default to Copilot, do not ask.
- Only ask when both ecosystems are clearly present and the user didn't pick one.
Lifecycle Events
Complete event table across platforms:
| Event | VS Code | Claude Code | Trigger |
|---|---|---|---|
| SessionStart | \u2705 | \u2705 | First prompt of session |
| UserPromptSubmit | \u2705 | \u2705 | User sends message |
| PreToolUse | \u2705 | \u2705 | Before any tool invocation |
| PostToolUse | \u2705 | \u2705 | After tool completes |
| PreCompact | \u2705 | \u2705 | Before context compaction |
| SubagentStart | \u2705 | \u2705 | Subagent created |
| SubagentStop | \u2705 | \u2705 | Subagent completes |
| Stop | \u2705 | \u2705 | Session ends |
| PermissionRequest | \u274c | \u2705 | Tool needs permission |
| PostToolUseFailure | \u274c | \u2705 | Tool fails |
| Notification | \u274c | \u2705 | Status notification |
| TaskCompleted | \u274c | \u2705 | Task finishes |
| Others (6 more) | \u274c | \u2705 | Various |
When targeting VS Code only, use the 8 shared events. When targeting Claude Code or hybrid, the full 20 events are available.
Configuration Locations
| Location | Scope | Platform |
|---|---|---|
.github/hooks/*.json |
Workspace (shared with team) | VS Code |
.agent.md frontmatter hooks: |
Agent-specific | VS Code (requires chat.useCustomAgentHooks: true) |
.claude/settings.json |
Workspace | Claude Code + VS Code |
~/.claude/settings.json |
User global | Claude Code + VS Code |
Scope rules:
- Hooks are per-workspace \u2014 they only apply inside the project where they are configured. Other workspaces are unaffected.
- VS Code has no global hooks path for workspace hooks (
.github/hooks/). To reuse those across projects, copy the files or use a template repo. - Claude Code supports
~/.claude/settings.jsonas a user-global hook location \u2014 hooks defined there apply to all projects.
Global vs workspace scripts for agent-scoped hooks:
- Agent-scoped hooks (frontmatter) reference scripts by path. If the sc
Установить hooks-creator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл hooks-creator?
**WORKFLOW SKILL — MANDATORY for ANY hook work.** Create, configure, edit, debug, or review lifecycle hooks for VS Code Copilot (default) and Claude Code. USE FOR: criar/configurar/editar hook, hook do Copilot/Claude/agente, lifecycle hook, PreToolUse, PostToolUse, SessionStart, SubagentStop, Stop hook, UserPromptSubmit, PreCompact, bloquear comando, validar tool call, injetar contexto, guard, .agent.md frontmatter hooks, hooks.json, .github/hooks, .claude/settings.json, hook Node.js, cross-platform, hook não dispara/silencioso/ignorado, permissionDecision, hookSpecificOutput, additionalContext. **DEFAULT = VS Code GitHub Copilot.** Switch to Claude Code only when user explicitly says "Claude" OR workspace has `.claude/`. NEVER assume Claude. DO NOT USE FOR: general coding, creating agents (use agent-creator), creating skills (use skill-creator).
Как установить скилл hooks-creator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл hooks-creator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic