ワンクリックで
hooks-integration
Claude Code hooks for automated Legion lifecycle events
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Claude Code hooks for automated Legion lifecycle events
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
DEPRECATED compatibility shim; workflow-common-core is canonical for all conventions referenced here
Interprets --just-* and --skip-* command flags for /legion:build and /legion:review, validates flag combinations against rules, and resolves the matching team template from intent-teams.yaml. Use when the user passes intent flags to build or review commands, asks about flag combinations, or needs to filter agent teams by intent.
Dev-QA loop engine with structured feedback, fix routing, and user escalation for /legion:review
Executes wave-structured plans with personality-injected agents — parallel or sequential per CLI adapter
Maps all 48 Legion agents by division, capability, and task type for intelligent team assembly
Engine for /legion:map. Analyzes an existing codebase, generates CODEBASE.md for backward-compatible architecture context, and writes .planning/codebase/ index artifacts consumed by /legion:start, /plan, /build, /review, /status, and /quick.
| name | hooks-integration |
| description | Claude Code hooks for automated Legion lifecycle events |
| triggers | ["hooks","automation","lifecycle","pre-build","post-build"] |
| token_cost | low |
| summary | Defines Claude Code hook configurations that automate Legion lifecycle events. Pre-build validates plans, post-build records outcomes, pre-ship runs security scans. |
Defines Claude Code hook configurations for automating Legion lifecycle events. Hooks are opt-in — users configure them in their Claude Code settings. This skill documents the recommended hooks and their behavior.
Claude Code hooks execute shell commands before or after specific events (tool calls, commands, etc.). Legion leverages hooks for:
Hooks are configured in .claude/settings.json (project-level) or ~/.claude/settings.json (global). Users must opt in — Legion never auto-installs hooks.
Validates plan file integrity before /legion:build executes.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Agent",
"hooks": [
{
"type": "command",
"command": "node -e \"const fs=require('fs'); const p='.planning/STATE.md'; if(!fs.existsSync(p)){process.exit(0)} const s=fs.readFileSync(p,'utf8'); if(!s.includes('Current')){console.error('STATE.md malformed'); process.exit(1)}\"",
"description": "Legion: validate STATE.md before agent spawn"
}
]
}
]
}
}
When: Before any Agent tool call (catches build agent spawns) What: Checks STATE.md exists and has required structure On failure: Blocks the agent spawn, displays error
Notifies the user when a build phase completes.
{
"hooks": {
"PostToolUse": [
{
"matcher": "Agent",
"hooks": [
{
"type": "command",
"command": "echo 'Legion: Agent task completed'",
"description": "Legion: notify on agent completion"
}
]
}
]
}
}
When: After any Agent tool call completes What: Simple notification (can be extended to trigger memory recording) Note: Full outcome recording still happens in the build command — this hook is informational
Runs a lightweight security check before /legion:ship creates a PR.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "node -e \"const cmd=process.env.CLAUDE_TOOL_INPUT||''; if(cmd.includes('gh pr create')){const r=require('child_process').execSync('npm audit --audit-level=critical 2>/dev/null',{encoding:'utf8',stdio:'pipe'}); if(r.includes('critical')){console.error('CRITICAL vulnerabilities found. Run npm audit fix before shipping.'); process.exit(1)}}\"",
"description": "Legion: security gate before PR creation"
}
]
}
]
}
}
When: Before any Bash call that includes gh pr create
What: Runs npm audit and blocks if critical vulnerabilities found
On failure: Blocks PR creation with security warning
To enable Legion hooks, add the desired hook configurations to your project's .claude/settings.json:
.claude/settings.json in the project roothooks section with desired configurations from Section 2process.exit(0) to pass silently, process.exit(1) to block with errorDelete the hooks section from .claude/settings.json. Hooks deactivate immediately.
| Command | Hook Point | Purpose |
|---|---|---|
/legion:build | PreToolUse (Agent) | Validate plans before spawning build agents |
/legion:build | PostToolUse (Agent) | Notify on agent completion |
/legion:ship | PreToolUse (Bash) | Security gate before PR creation |
/legion:review | PostToolUse (Agent) | Notify when review agents complete |
Hooks are lightweight automation. They do NOT replace: