Command Palette

Search for a command to run...

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

hook-creator

БесплатноЗапускает вложенные скриптыНе проверен

Creates and registers hooks for the Claude Code framework. Handles pre/post tool execution, validation, memory, and session hooks. Use when new validation…

oimiragieoот oimiragieo★ 48 звёзд на GitHub

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

Hook Creator Skill

Creates, validates, and registers hooks for the multi-agent orchestration framework.

ROUTER UPDATE REQUIRED (CRITICAL - DO NOT SKIP)

After creating ANY hook, you MUST update documentation:

1. Add to .claude/hooks/README.md under appropriate category
2. Register in config.yaml or settings.json if required
3. Update learnings.md with hook summary

Verification:

grep "<hook-name>" .claude/hooks/README.md || echo "ERROR: hooks/README.md NOT UPDATED!"

WHY: Hooks not documented are invisible and unmaintainable.


Overview

This skill creates hooks for the Claude Code framework:

  • Pre-tool execution - Safety validation before commands run
  • Post-tool execution - Logging, memory updates, telemetry
  • Session lifecycle - Initialize context, cleanup on exit
  • Memory management - Auto-extract learnings, format memory files
  • Routing enforcement - Ensure Router-First protocol compliance

Hook Types

Type Location Purpose When Triggered
Safety .claude/hooks/safety/ Validate commands, block dangerous ops Before Bash/Write/Edit
Memory .claude/hooks/memory/ Auto-update learnings, extract insights After task completion
Routing .claude/hooks/routing/ Enforce router-first protocol On UserPromptSubmit
Session .claude/hooks/session/ Initialize/cleanup sessions Session start/end

Hook-Agent Archetype Reference

When creating hooks, determine which agent archetypes will be governed by the new hook. See .claude/docs/@HOOK_AGENT_MAP.md for:

  • Section 1: Full hook-agent matrix
  • Section 2: Archetype hook sets (Router, Implementer, Reviewer, Documenter, Orchestrator, Researcher)

After creating a hook, you MUST add it to both the matrix AND update affected agents' ## Enforcement Hooks sections.

Claude Code Hook Types

Hook Event When Triggered Use Case
PreToolUse Before tool executes Validation, blocking, permission checks
PostToolUse After tool completes Logging, cleanup, notifications
UserPromptSubmit Before model sees message Routing, intent analysis, filtering

Workflow Steps

Step 0: Existence Check and Updater Delegation (MANDATORY - FIRST STEP)

BEFORE creating any hook file, check if it already exists:

  1. Check if hook already exists:

    test -f .claude/hooks/<category>/<hook-name>.cjs && echo "EXISTS" || echo "NEW"
    
  2. If hook EXISTS:

    • DO NOT proceed with creation

    • Invoke artifact-updater workflow instead:

      Skill({
        skill: 'artifact-updater',
        args: '--type hook --path .claude/hooks/<category>/<hook-name>.cjs --changes "<description of requested changes>"',
      });
      
    • Return updater result and STOP

  3. If hook is NEW:

    • Continue with Step 0.5 below

Step 0.1: Smart Duplicate Detection (MANDATORY)

Before proceeding with creation, run the 3-layer duplicate check:

const { checkDuplicate } = require('.claude/lib/creation/duplicate-detector.cjs');
const result = checkDuplicate({
  artifactType: 'hook',
  name: proposedName,
  description: proposedDescription,
  keywords: proposedKeywords || [],
});

Handle results:

  • EXACT_MATCH: Stop creation. Route to hook-updater skill instead: Skill({ skill: 'hook-updater' })
  • REGISTRY_MATCH: Warn user — artifact is registered but file may be missing. Investigate before creating. Ask user to confirm.
  • SIMILAR_FOUND: Display candidates with scores. Ask user: "Similar artifact(s) exist. Continue with new creation or update existing?"
  • NO_MATCH: Proceed to Step 0.5 (companion check).

Override: If user explicitly passes --force, skip this check entirely.


Step 0.5: Companion Check

Before proceeding with creation, run the ecosystem companion check:

  1. Use companion-check.cjs from .claude/lib/creators/companion-check.cjs
  2. Call checkCompanions("hook", "{hook-name}") to identify companion artifacts
  3. Review the companion checklist — note which required/recommended companions are missing
  4. Plan to create or verify missing companions after this artifact is complete
  5. Include companion findings in post-creation integration notes

This step is informational (does not block creation) but ensures the full artifact ecosystem is considered.


Reference Hook

Use .claude/lib/routing/routing-table.cjs as the canonical routing reference.

Before finalizing any hook, compare against routing-table structure:

  • H
Полный SKILL.md на GitHub

Установить hook-creator в Claude Code и Claude Desktop

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

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

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

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

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

Read
Write
Edit
Bash
Glob
Grep

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

commands/hook-creator.mdhooks/post-execute.cjshooks/pre-execute.cjsreferences/research-requirements.mdrules/hook-creator.mdschemas/input.schema.jsonschemas/output.schema.jsonscripts/main.cjstemplates/implementation-template.md

FAQ

Что делает скилл hook-creator?

Creates and registers hooks for the Claude Code framework. Handles pre/post tool execution, validation, memory, and session hooks. Use when new validation, safety, or automation hooks are needed.

Как установить скилл hook-creator?

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

Скилл hook-creator запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

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

Сравнить hook-creator с