Route to Reference
flowchart TD
Start([What do you need?]) --> Q1{Which platform?}
Q1 -->|Claude Code| Q2{Inline agent hooks<br>hooks/mcpServers/skills/memory?}
Q1 -->|GitHub Copilot| Copilot["Read references/github-copilot.md"]
Q1 -->|Cursor, Windsurf, Amp<br>or coverage gaps| Coverage["Read references/platform-coverage.md"]
Q2 -->|Yes — agent frontmatter| Agent["Read references/inline-agent-hooks.md"]
Q2 -->|No — project or global hooks| Q3{Interacts with session data?<br>costs, workloads, duration, tracking}
Q3 -->|Yes — reading or writing<br>session logs or token data| SessionSchema["Load references/claude-session-log-schema-reference.md<br>before writing any code"]
Q3 -->|No| Q4{Which language?}
SessionSchema --> Q4
Q4 -->|Node.js| CJS["Read references/hooks-nodejs-extension.md"]
Q4 -->|Python| Py["Read references/hooks-python.md"]
Q4 -->|Not sure / both| Both["Read references/hooks-nodejs-extension.md<br>then references/hooks-python.md"]
Agent --> CC["Also read references/claude-code.md<br>for full event schema"]
Q4 --> Schema["Cross-platform concepts:<br>references/common-schema.md"]
Copilot --> Schema
Coverage --> Schema
Specialist Skills
For deeper Claude Code coverage, these focused skills are available:
- hooks-core-reference — Hook system fundamentals: events, configuration, matchers, environment variables, execution, security, debugging. Use
Skill(skill: "plugin-creator:hooks-core-reference") for configuration and troubleshooting.
- hooks-io-api — JSON input/output API: what data hooks receive via stdin and what JSON they return to control Claude. Use
Skill(skill: "plugin-creator:hooks-io-api") for writing hook scripts that process input or produce JSON output.
- hooks-patterns — Recipes and working examples: plugin hooks, frontmatter hooks, prompt-based hooks, complete code examples in Python/Node.js. Use
Skill(skill: "plugin-creator:hooks-patterns") for implementation patterns and examples.
Reference Files
references/common-schema.md — shared concepts, cross-platform comparison, JSON I/O, exit codes
references/claude-code.md — Claude Code hooks full reference (events, matchers, configuration)
references/inline-agent-hooks.md — hooks, mcpServers, skills, and memory in agent frontmatter
references/github-copilot.md — GitHub Copilot coding agent hooks
references/hooks-nodejs-extension.md — Node.js authoring guide: extension rules (.mjs/.cjs), templates, anti-patterns
references/hooks-python.md — Python authoring guide and templates
references/best-practices.md — cross-platform conventions and anti-patterns
references/platform-coverage.md — known platforms, fetch URLs, coverage status
references/hooks-lifecycle.png — visual diagram of the full hook event sequence
references/claude-session-log-schema-reference.md — verified schema for Claude Code session JSONL logs: file locations, record structure, tool_use/tool_result pairing, usage fields, observed response sizes. Load when creating or modifying hooks that interact with session data for costs, workloads, duration, or tracking.
Refresh Docs
Re-fetch all platform docs and run the script's focused single-reference transform on each:
bash plugins/plugin-creator/skills/hooks-guide/scripts/fetch-and-transform-hooks-docs.sh
This updates reference files from official sources. Run when upstream docs change.
Sources
- Claude Code hooks:
https://docs.anthropic.com/en/docs/claude-code/hooks.md (accessed 2026-05-21)
- Claude Code hooks guide:
https://docs.anthropic.com/en/docs/claude-code/hooks-guide.md (accessed 2026-05-21)
- Claude Code agent frontmatter:
https://docs.anthropic.com/en/docs/claude-code/sub-agents.md (accessed 2026-02-27)
- GitHub Copilot coding agent:
https://docs.github.com/en/copilot/using-github-copilot/using-claude-as-your-copilot-llm (accessed 2026-02-27)
1---2name: hooks-guide3description: Cross-platform hooks reference for AI coding assistants — Claude Code, GitHub Copilot, Cursor, Windsurf, Amp. Covers hook authoring in Node.js (ESM and CJS) and Python, per-platform event schemas, inline-agent hooks and MCP in agent frontmatter, common JSON I/O, exit codes, best practices, and a fetch script to refresh docs from official sources. Use when writing, reviewing, or debugging hooks for any AI assistant.4---56## Route to Reference78```mermaid9flowchart TD10 Start([What do you need?]) --> Q1{Which platform?}11 Q1 -->|Claude Code| Q2{Inline agent hooks<br>hooks/mcpServers/skills/memory?}12 Q1 -->|GitHub Copilot| Copilot["Read references/github-copilot.md"]13 Q1 -->|Cursor, Windsurf, Amp<br>or coverage gaps| Coverage["Read references/platform-coverage.md"]1415 Q2 -->|Yes — agent frontmatter| Agent["Read references/inline-agent-hooks.md"]16 Q2 -->|No — project or global hooks| Q3{Interacts with session data?<br>costs, workloads, duration, tracking}1718 Q3 -->|Yes — reading or writing<br>session logs or token data| SessionSchema["Load references/claude-session-log-schema-reference.md<br>before writing any code"]19 Q3 -->|No| Q4{Which language?}2021 SessionSchema --> Q42223 Q4 -->|Node.js| CJS["Read references/hooks-nodejs-extension.md"]24 Q4 -->|Python| Py["Read references/hooks-python.md"]25 Q4 -->|Not sure / both| Both["Read references/hooks-nodejs-extension.md<br>then references/hooks-python.md"]2627 Agent --> CC["Also read references/claude-code.md<br>for full event schema"]28 Q4 --> Schema["Cross-platform concepts:<br>references/common-schema.md"]29 Copilot --> Schema30 Coverage --> Schema31```3233## Specialist Skills3435For deeper Claude Code coverage, these focused skills are available:3637- **hooks-core-reference** — Hook system fundamentals: events, configuration, matchers, environment variables, execution, security, debugging. Use `Skill(skill: "plugin-creator:hooks-core-reference")` for configuration and troubleshooting.38- **hooks-io-api** — JSON input/output API: what data hooks receive via stdin and what JSON they return to control Claude. Use `Skill(skill: "plugin-creator:hooks-io-api")` for writing hook scripts that process input or produce JSON output.39- **hooks-patterns** — Recipes and working examples: plugin hooks, frontmatter hooks, prompt-based hooks, complete code examples in Python/Node.js. Use `Skill(skill: "plugin-creator:hooks-patterns")` for implementation patterns and examples.4041## Reference Files4243- `references/common-schema.md` — shared concepts, cross-platform comparison, JSON I/O, exit codes44- `references/claude-code.md` — Claude Code hooks full reference (events, matchers, configuration)45- `references/inline-agent-hooks.md` — hooks, mcpServers, skills, and memory in agent frontmatter46- `references/github-copilot.md` — GitHub Copilot coding agent hooks47- `references/hooks-nodejs-extension.md` — Node.js authoring guide: extension rules (.mjs/.cjs), templates, anti-patterns48- `references/hooks-python.md` — Python authoring guide and templates49- `references/best-practices.md` — cross-platform conventions and anti-patterns50- `references/platform-coverage.md` — known platforms, fetch URLs, coverage status51- `references/hooks-lifecycle.png` — visual diagram of the full hook event sequence52- `references/claude-session-log-schema-reference.md` — verified schema for Claude Code session JSONL logs: file locations, record structure, tool_use/tool_result pairing, usage fields, observed response sizes. Load when creating or modifying hooks that interact with session data for costs, workloads, duration, or tracking.5354## Refresh Docs5556Re-fetch all platform docs and run the script's focused single-reference transform on each:5758```bash59bash plugins/plugin-creator/skills/hooks-guide/scripts/fetch-and-transform-hooks-docs.sh60```6162This updates reference files from official sources. Run when upstream docs change.6364## Sources6566- Claude Code hooks: `https://docs.anthropic.com/en/docs/claude-code/hooks.md` (accessed 2026-05-21)67- Claude Code hooks guide: `https://docs.anthropic.com/en/docs/claude-code/hooks-guide.md` (accessed 2026-05-21)68- Claude Code agent frontmatter: `https://docs.anthropic.com/en/docs/claude-code/sub-agents.md` (accessed 2026-02-27)69- GitHub Copilot coding agent: `https://docs.github.com/en/copilot/using-github-copilot/using-claude-as-your-copilot-llm` (accessed 2026-02-27)