Command Palette

Search for a command to run...

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

hook-development

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

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "wire command hooks", "use…

Sivan757от Sivan757★ 23 звезды на GitHub

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

Hook Development for DeepSeek Harness Plugins

Overview

Hooks are event-driven automation scripts that execute in response to DeepSeek Harness events. Use hooks to validate operations, enforce policies, add context, and integrate external tools into workflows.

Key capabilities:

  • Validate tool calls before execution (PreToolUse)
  • React to tool results (PostToolUse)
  • Enforce completion standards (Stop, SubagentStop)
  • Load project context (SessionStart)
  • Automate workflows across the development lifecycle

Hook Types

Command Hooks (The Supported Type)

Execute bash commands for deterministic checks:

{
  "type": "command",
  "command": "bash ${PLUGIN_ROOT}/scripts/validate.sh",
  "timeout": 60
}

Use for:

  • Fast deterministic validations
  • File system operations
  • External tool integrations
  • Performance-critical checks

Hook Configuration Formats

Plugin hooks.json Format

For plugin hooks in com.deepseek.harness/hooks/hooks.json, use wrapper format:

{
  "description": "Brief explanation of hooks (optional)",
  "hooks": {
    "PreToolUse": [...],
    "Stop": [...],
    "SessionStart": [...]
  }
}

Key points:

  • description field is optional
  • hooks field is required wrapper containing actual hook events
  • This is the plugin-specific format

Example:

{
  "description": "Validation hooks for code quality",
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Write",
        "hooks": [
          {
            "type": "command",
            "command": "${PLUGIN_ROOT}/hooks/validate.sh"
          }
        ]
      }
    ]
  }
}

Settings Format (Direct)

For a standalone hook file (for example a project .agents/hooks/hooks.json), use the bare event-table format:

{
  "PreToolUse": [...],
  "Stop": [...],
  "SessionStart": [...]
}

Key points:

  • No wrapper - events directly at top level
  • No description field
  • This is the settings format

Important: The examples below show the hook event structure that goes inside either format. For plugin hooks.json, wrap these in {"hooks": {...}}.

Hook Events

PreToolUse

Execute before any tool runs. Use to approve, deny, or modify tool calls.

Example:

{
  "PreToolUse": [
    {
      "matcher": "Write|Edit",
      "hooks": [
        {
          "type": "command",
          "command": "bash ${PLUGIN_ROOT}/scripts/validate-write.sh",
          "timeout": 10
        }
      ]
    }
  ]
}

Output for PreToolUse:

{
  "hookSpecificOutput": {
    "permissionDecision": "allow|deny|ask",
    "updatedInput": {"field": "modified_value"}
  },
  "systemMessage": "Explanation for the agent"
}

PostToolUse

Execute after tool completes. Use to react to results, provide feedback, or log.

Example:

{
  "PostToolUse": [
    {
      "matcher": "Edit",
      "hooks": [
        {
          "type": "command",
          "command": "bash ${PLUGIN_ROOT}/scripts/check-edit-result.sh",
          "timeout": 10
        }
      ]
    }
  ]
}

Output behavior:

  • Exit 0: stdout shown in transcript
  • Exit 2: stderr fed back to the agent
  • systemMessage included in context

Stop

Execute when main agent considers stopping. Use to validate completeness.

Example:

{
  "Stop": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "bash ${PLUGIN_ROOT}/scripts/check-completeness.sh",
          "timeout": 30
        }
      ]
    }
  ]
}

Decision output:

{
  "decision": "approve|block",
  "reason": "Explanation",
  "systemMessage": "Additional context"
}

SubagentStop

Execute when subagent considers stopping. Use to ensure subagent completed its task.

Similar to Stop hook, but for subagents. Observe only — it cannot block or add context.

UserPromptSubmit

Execute when user submits a prompt. Use to add context, validate, or block prompts. Takes no matcher.

Example:

{
  "UserPromptSubmit": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "bash ${PLUGIN_ROOT}/scripts/check-prompt.sh",
          "timeout": 10
        }
      ]
    }
  ]
}

SessionStart

Execute when DeepSeek Harness session begins. Use to load context and set environment.

Example:

{
  "SessionStart": [
    {
      "matcher": "*",
      "hooks": [
        {
          "type": "command",
          "command": "bash ${PLUGIN_ROOT}/scripts/load-context.sh"
        }
      ]
    }
  ]
}

Special capability: Persist environment variables using $DSH_ENV_FILE:

echo "export PROJECT_TYPE=nodejs" >> "$DSH_ENV_FILE"

See examples/load-context.sh for complete example.

Events without a DeepSeek Harness counterpart

The runtime runs ten events: SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PostToolUseFailure, Stop, SubagentStart, SubagentStop, PreCompact and `SessionEn

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

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

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

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

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

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

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

Без ограничений — скилл может использовать любой инструмент.

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

examples/load-context.shexamples/validate-bash.shexamples/validate-write.shreferences/advanced.mdreferences/migration.mdreferences/patterns.mdscripts/README.mdscripts/hook-linter.shscripts/test-hook.shscripts/validate-hook-schema.sh

FAQ

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

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "wire command hooks", "use ${PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStart, SubagentStop, SessionStart, UserPromptSubmit). Provides comprehensive guidance for creating and implementing DeepSeek Harness plugin hooks with focus on the command-hook contract and the matcher model.

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

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

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

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

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

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