Skip to content
Back to skills

Summaries

BSecurity

Skill in the `plugin-dev` plugin teaching how to author hooks for Claude Code plugins. Triggers on prompts about hook creation, PreToolUse/PostToolUse/Stop, validating tool use, prompt-based hooks, `${CLAUDE_PLUGIN_ROOT}`, etc. **Two hook types** (per `type:` field): - **Prompt-based** (recommended): LLM-driven decisions. Supported events: Stop, SubagentStop, UserPromptSubmit, PreToolUse. Default 30s timeout. Better for context-aware reasoning. - **Command**: deterministic bash. Default 60s t...

  • 8 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 30, 2026
ai-agentsgobashdebugginggitsecurity

Works with

  • claude code
  • mcp

Security analysis

B75/100
  • criticalPipes output to a shell interpreter

Pro scans all 21 files and shows the line behind each finding

Scanned November 30, 2026

npx -y skills add NickCollect/ai-coding-runbook --skill Summaries --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Summaries?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Summaries
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/nickcollect-summaries-40655007/badge)](https://www.skillsdirectory.com/skills/nickcollect-summaries-40655007)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
type: summary
source: 01_Raw/github/anthropics/claude-code/plugins/plugin-dev/skills/hook-development/SKILL.md
title: "Hook Development for Claude Code Plugins (skill)"
summarized_at: 2026-05-05
entities_referenced: [Hooks, Plugin, Subagent, Settings, MCP-server]
concepts_referenced: []
---

Skill in the `plugin-dev` plugin teaching how to author hooks for Claude Code plugins. Triggers on prompts about hook creation, PreToolUse/PostToolUse/Stop, validating tool use, prompt-based hooks, `${CLAUDE_PLUGIN_ROOT}`, etc.

**Two hook types** (per `type:` field):
- **Prompt-based** (recommended): LLM-driven decisions. Supported events: Stop, SubagentStop, UserPromptSubmit, PreToolUse. Default 30s timeout. Better for context-aware reasoning.
- **Command**: deterministic bash. Default 60s timeout. Use for fast checks, FS ops, external tools, perf-critical work.

**Two config formats** — important distinction:
- **Plugin `hooks/hooks.json`**: wrapper format `{"description": "...", "hooks": {"PreToolUse": [...], ...}}`. `description` optional, `hooks` field required.
- **Settings `.claude/settings.json`**: direct format — events at top level, no wrapper, no description.

**Lifecycle events**: PreToolUse, PostToolUse, Stop, SubagentStop, UserPromptSubmit, SessionStart (special: persist env via `$CLAUDE_ENV_FILE`), SessionEnd, PreCompact, Notification.

**PreToolUse decisions** via `hookSpecificOutput.permissionDecision`: `allow`/`deny`/`ask`, plus `updatedInput` to rewrite tool args. `systemMessage` shown to Claude.

**Stop decisions** via `decision: approve|block` + `reason`.

**Standard output**: `{continue: bool, suppressOutput: bool, systemMessage: str}`. Exit codes: 0=success (stdout shown), 2=blocking error (stderr → Claude), other=non-blocking.

**Hook input on stdin** — JSON with `session_id`, `transcript_path`, `cwd`, `permission_mode`, `hook_event_name`, plus event-specific fields (`tool_name`/`tool_input`/`tool_result` for tool events, `user_prompt`, `reason`).

**Env vars in command hooks**: `$CLAUDE_PROJECT_DIR`, `$CLAUDE_PLUGIN_ROOT` (always use for portability), `$CLAUDE_ENV_FILE` (SessionStart only), `$CLAUDE_CODE_REMOTE`.

**Matchers** (regex on tool name): `Write`, `Read|Write|Edit`, `*`, `mcp__.*__delete.*`, case-sensitive. Common patterns: all MCP `mcp__.*`, specific plugin `mcp__plugin_asana_.*`.

**Parallel execution**: all matching hooks run in parallel — design for independence, no ordering, no inter-hook output sharing.

**Security best practices** (command hooks):
- `set -euo pipefail`.
- Validate inputs (regex check tool_name format).
- Path traversal check (`*..*`).
- Sensitive file check (`.env`, etc.).
- Always quote variables.
- Set appropriate timeouts.

**Temporarily active hooks**: gate via flag file (`.enable-strict-validation`) or config-based (`jq` reads JSON setting).

**Hook lifecycle gotcha**: hooks load at SESSION START. Editing `hooks.json` mid-session has NO EFFECT. Must restart Claude Code (`exit` then `claude`). Use `/hooks` to see loaded.

**Debugging**: `claude --debug` for execution logs. Test scripts directly: `echo '{"tool_name":"Write",...}' | bash hook.sh; echo $?`. Validate JSON output with `jq .`.

References sibling files: `references/patterns.md`, `references/migration.md`, `references/advanced.md`, `examples/validate-write.sh`, `examples/validate-bash.sh`, `examples/load-context.sh`, plus utility scripts in `scripts/`.

Files in this skill

  • 100k-context-windows--anthropic-news.md1.2 KB
  • 2026-w13.md2.5 KB
  • 2026-w14.md2.5 KB
  • 2026-w15.md2.5 KB
  • 2026-w16.md3.3 KB
  • 2026-w17.md2.9 KB
  • 3-5-models-and-computer-use--anthropic-news.md1.8 KB
  • 3p-updates--internal-comms.md1.6 KB
  • 81k-economics--anthropic-research.md2.3 KB
  • AGENTS--codex-openai.md1.8 KB
  • AGENTS--mcp-py-sdk.md3.1 KB
  • AGENTS--mcp-spec.md860 B
  • AI-assistance-coding-skills--anthropic-research.md1.3 KB
  • AI-fluency-index--anthropic-research.md1.2 KB
  • AI-resistant-technical-evaluations--anthropic-eng.md2.5 KB
  • ANTITRUST--mcp-spec.md569 B
  • AmazonBedrock-CONTRIBUTING--prompt-eng-tutorial.md1.3 KB
  • AmazonBedrock-README--prompt-eng-tutorial.md1.8 KB
  • CHANGELOG--agent-sdk-py-repo.md3.2 KB
  • CHANGELOG--anthropic-sdk-py.md1.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.