[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6R7DWBRDEMVV5W557PVSE8P":3,"skill-same:01M6R7DWBRDEMVV5W557PVSE8P":72},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":56,"updatedAt":57,"install":58,"resources":71},"01M6R7DWBRDEMVV5W557PVSE8P","writing-hooks",null,"Guide for writing, configuring, and debugging Claude Code hooks. Use when adding, writing, or debugging hooks — including silent failures and permission errors.","tim-hub\u002Fpowerball-harness","tim-hub","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F2884320?v=4","01M6R7B70M93Y25SH3DV1B4Q26","Tim","01M6R7B74YQWC556YVC0FRVS3T",35,"MIT","https:\u002F\u002Fgithub.com\u002Ftim-hub\u002Fpowerball-harness\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Fwriting-hooks\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"writing hooks","hooks","writing","write","running","when","for","errors","post","use","claude code hooks","read","json","tool","Bash","code","create","debugging","debug","create hook","2026-11-10 10:12:30",false,"---\nname: writing-hooks\ndescription: \"Guide for writing, configuring, and debugging Claude Code hooks. Use when adding, writing, or debugging hooks — including silent failures and permission errors.\"\nwhen_to_use: \"write hook, create hook, hook not running, debug hook, hook silent failure, hooks.json, pre-tool hook, post-tool hook\"\nallowed-tools: [\"Read\", \"Write\", \"Edit\", \"Bash\"]\n---\n\n# Writing Hooks\n\nGuide for adding hooks to `harness\u002Fhooks\u002Fhooks.json` and writing the scripts they invoke.\n\n## Hook Types\n\n| Type | When to use | Cost |\n|------|-------------|------|\n| `command` | Deterministic checks, fast guards, file ops | Low |\n| `prompt` | Single LLM judgment with `{\"ok\": true\u002Ffalse}` response | Medium |\n| `agent` | Multi-step LLM reasoning with file tools | High |\n| `http` | POST to external service | Varies |\n\nPrefer `command` whenever the logic can be expressed in any executable script or the Go binary. Reserve `agent`\u002F`prompt` for cases that genuinely need judgment — they are slower and cost tokens on every invocation.\n\n> **Note**: `agent` hooks do NOT work on `PreCompact`. Use `command` instead.\n\n## Adding a command Hook\n\n### 1. Write the script\n\nPlace scripts in `harness\u002Fscripts\u002F`. Use whichever language fits the task — bash, Python, and Node.js are all fine. The only requirement is that the script is executable and produces the correct exit code and stdout.\n\n**Exit codes control the hook outcome:**\n\n| Exit code | Meaning |\n|-----------|---------|\n| `0` | Allow \u002F pass |\n| `2` + JSON to stdout | Block (PreToolUse \u002F Stop) |\n| `0` + JSON to stdout | Inject context (PostToolUse, PreCompact) |\n\n**Bash example — blocking Stop hook:**\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\nif [[ some_condition ]]; then\n  echo '{\"decision\":\"block\",\"reason\":\"Explain why\"}'\n  exit 2\nfi\nexit 0\n```\n\n**Python example — blocking Stop hook:**\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\nimport sys, json\nif some_condition:\n    print(json.dumps({\"decision\": \"block\", \"reason\": \"Explain why\"}))\n    sys.exit(2)\nsys.exit(0)\n```\n\n**Node.js example — warning injection (PreCompact):**\n```js\n#!\u002Fusr\u002Fbin\u002Fenv node\nif (someCondition) {\n  console.log(JSON.stringify({ systemMessage: \"Warning: something needs attention\" }));\n}\nprocess.exit(0);  \u002F\u002F never block compaction\n```\n\n### 2. Set execution permission\n\nScripts without `chmod +x` fail silently or with `permission denied`, regardless of language:\n\n```bash\nchmod +x harness\u002Fscripts\u002Fyour-script.py   # or .sh, .js, etc.\n```\n\nAlternatively, invoke the interpreter explicitly in the hook command (step 3) — then `chmod +x` is not required.\n\n### 3. Register in hooks.json\n\nEdit `harness\u002Fhooks\u002Fhooks.json` (SSOT). Reference the script via `${CLAUDE_PLUGIN_ROOT}` and invoke with the appropriate interpreter:\n\n```json\n{ \"type\": \"command\", \"command\": \"bash \\\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fyour-script.sh\\\"\", \"timeout\": 5 }\n{ \"type\": \"command\", \"command\": \"python3 \\\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fyour-script.py\\\"\", \"timeout\": 5 }\n{ \"type\": \"command\", \"command\": \"node \\\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fyour-script.js\\\"\", \"timeout\": 5 }\n```\n\nFor `bin\u002Fharness` subcommands, use `timeout: 3`. For scripts, use `timeout: 5`.\n\n### 4. Validate\n\n```bash\nmake validate   # runs tests\u002Fvalidate-plugin.sh\n```\n\n---\n\n## Checklist for New Hooks\n\n- [ ] Script has the correct shebang for its language (`#!\u002Fusr\u002Fbin\u002Fenv bash`, `#!\u002Fusr\u002Fbin\u002Fenv python3`, `#!\u002Fusr\u002Fbin\u002Fenv node`)\n- [ ] Script is executable (`chmod +x`) **or** interpreter is explicit in the hook command (`python3 \"...\"`, `node \"...\"`)\n- [ ] Script path uses `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002F` — never absolute paths\n- [ ] Timeout matches type: `3` for `bin\u002Fharness`, `5` for scripts, `30` for agents\n- [ ] Tested locally by running the script directly with its interpreter\n- [ ] `make validate` passes after editing `hooks.json`\n\n---\n\n## Common Issues\n\n### Hook not running (silent failure)\n\nThree likely causes:\n\n1. **Not executable** — check with `ls -la harness\u002Fscripts\u002Fyour-script.*`. Either `chmod +x` the file or prefix the command with the interpreter (`python3 \"...\"`, `node \"...\"`, `bash \"...\"`)\n2. **Wrong path** — verify the path resolves correctly; run the script directly to confirm\n3. **Syntax error** — run the script manually (`python3 script.py`, `node script.js`, `bash -n script.sh`) to surface errors before the hook fires\n\n### Permission denied\n\n```bash\nchmod +x harness\u002Fscripts\u002Fyour-script.py   # or .sh, .js\n# OR use explicit interpreter in hooks.json — no chmod needed\n```\n\n### Hook fires but doesn't block\n\nFor blocking hooks (PreToolUse \u002F Stop), you must **both** print JSON to stdout **and** `exit 2`. Printing alone or exiting alone won't block.\n\n### agent hook not firing on PreCompact\n\nAgent hooks silently do nothing on `PreCompact`. Convert to a `command` script — see `harness\u002Fscripts\u002Fcheck-wip-precompact.sh` as a reference.\n\n---\n\n## Event Reference\n\nKey events and their typical use:\n\n| Event | Use for |\n|-------|---------|\n| `PreToolUse` | Guard writes, validate inputs before execution |\n| `PostToolUse` | Cleanup, logging, tracking after tool runs |\n| `Stop` | Block session end if work is incomplete |\n| `PreCompact` | Warn (don't block) before context compaction |\n| `UserPromptSubmit` | Inject policy context, track commands |\n| `SessionStart` | One-time session initialization (`once: true`) |\n\nFull event list and response schemas: `.claude\u002Frules\u002Fhooks-editing.md`\n\n---\n\n## Related\n\n- `harness\u002Fhooks\u002Fhooks.json` — SSOT for all hook configuration\n- `harness\u002Fscripts\u002F` — All command hook scripts\n- `.claude\u002Frules\u002Fhooks-editing.md` — Complete event reference and timeout guidelines\n- `update-config` skill — For adding automated behaviors via settings.json\n","# Writing Hooks\n\nGuide for adding hooks to `harness\u002Fhooks\u002Fhooks.json` and writing the scripts they invoke.\n\n## Hook Types\n\n| Type | When to use | Cost |\n|------|-------------|------|\n| `command` | Deterministic checks, fast guards, file ops | Low |\n| `prompt` | Single LLM judgment with `{\"ok\": true\u002Ffalse}` response | Medium |\n| `agent` | Multi-step LLM reasoning with file tools | High |\n| `http` | POST to external service | Varies |\n\nPrefer `command` whenever the logic can be expressed in any executable script or the Go binary. Reserve `agent`\u002F`prompt` for cases that genuinely need judgment — they are slower and cost tokens on every invocation.\n\n> **Note**: `agent` hooks do NOT work on `PreCompact`. Use `command` instead.\n\n## Adding a command Hook\n\n### 1. Write the script\n\nPlace scripts in `harness\u002Fscripts\u002F`. Use whichever language fits the task — bash, Python, and Node.js are all fine. The only requirement is that the script is executable and produces the correct exit code and stdout.\n\n**Exit codes control the hook outcome:**\n\n| Exit code | Meaning |\n|-----------|---------|\n| `0` | Allow \u002F pass |\n| `2` + JSON to stdout | Block (PreToolUse \u002F Stop) |\n| `0` + JSON to stdout | Inject context (PostToolUse, PreCompact) |\n\n**Bash example — blocking Stop hook:**\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\nif [[ some_condition ]]; then\n  echo '{\"decision\":\"block\",\"reason\":\"Explain why\"}'\n  exit 2\nfi\nexit 0\n```\n\n**Python example — blocking Stop hook:**\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\nimport sys, json\nif some_condition:\n    print(json.dumps({\"decision\": \"block\", \"reason\": \"Explain why\"}))\n    sys.exit(2)\nsys.exit(0)\n```\n\n**Node.js example — warning injection (PreCompact):**\n```js\n#!\u002Fusr\u002Fbin\u002Fenv node\nif (someCondition) {\n  console.log(JSON.stringify({ systemMessage: \"Warning: something needs attention\" }));\n}\nprocess.exit(0);  \u002F\u002F never block compaction\n```\n\n### 2. Set execution permission\n\nScripts without `chmod +x` fail silently or with `permission denied`, regardless of language:\n\n```bash\nchmod +x harness\u002Fscripts\u002Fyour-script.py   # or .sh, .js, etc.\n```\n\nAlternatively, invoke the interpreter explicitly in the hook command (step 3) — then `chmod +x` is not required.\n\n### 3. Register in hooks.json\n\nEdit `harness\u002Fhooks\u002Fhooks.json` (SSOT). Reference the script via `${CLAUDE_PLUGIN_ROOT}` and invoke with the appropriate interpreter:\n\n```json\n{ \"type\": \"command\", \"command\": \"bash \\\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fyour-script.sh\\\"\", \"timeout\": 5 }\n{ \"type\": \"command\", \"command\": \"python3 \\\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fyour-script.py\\\"\", \"timeout\": 5 }\n{ \"type\": \"command\", \"command\": \"node \\\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fyour-script.js\\\"\", \"timeout\": 5 }\n```\n\nFor `bin\u002Fharness` subcommands, use `timeout: 3`. For scripts, use `timeout: 5`.\n\n### 4. Validate\n\n```bash\nmake validate   # runs tests\u002Fvalidate-plugin.sh\n```\n\n---\n\n## Checklist for New Hooks\n\n- [ ] Script has the correct shebang for its language (`#!\u002Fusr\u002Fbin\u002Fenv bash`, `#!\u002Fusr\u002Fbin\u002Fenv python3`, `#!\u002Fusr\u002Fbin\u002Fenv node`)\n- [ ] Script is executable (`chmod +x`) **or** interpreter is explicit in the hook command (`python3 \"...\"`, `node \"...\"`)\n- [ ] Script path uses `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002F` — never absolute paths\n- [ ] Timeout matches type: `3` for `bin\u002Fharness`, `5` for scripts, `30` for agents\n- [ ] Tested locally by running the script directly with its interpreter\n- [ ] `make validate` passes after editing `hooks.json`\n\n---\n\n## Common Issues\n\n### Hook not running (silent failure)\n\nThree likely causes:\n\n1. **Not executable** — check with `ls -la harness\u002Fscripts\u002Fyour-script.*`. Either `chmod +x` the file or prefix the command with the interpreter (`python3 \"...\"`, `node \"...\"`, `bash \"...\"`)\n2. **Wrong path** — verify the path resolves correctly; run the script directly to confirm\n3. **Syntax error** — run the script manually (`python3 script.py`, `node script.js`, `bash -n script.sh`) to surface errors before the hook fires\n\n### Permission denied\n\n```bash\nchmod +x harness\u002Fscripts\u002Fyour-script.py   # or .sh, .js\n# OR use explicit interpreter in hooks.json — no chmod needed\n```\n\n### Hook fires but doesn't block\n\nFor blocking hooks (PreToolUse \u002F Stop), you must **both** print JSON to stdout **and** `exit 2`. Printing alone or exiting alone won't block.\n\n### agent hook not firing on PreCompact\n\nAgent hooks silently do nothing on `PreCompact`. Convert to a `command` script — see `harness\u002Fscripts\u002Fcheck-wip-precompact.sh` as a reference.\n\n---\n\n## Event Reference\n\nKey events and their typical use:\n\n| Event | Use for |\n|-------|---------|\n| `PreToolUse` | Guard writes, validate inputs before execution |\n| `PostToolUse` | Cleanup, logging, tracking after tool runs |\n| `Stop` | Block session end if work is incomplete |\n| `PreCompact` | Warn (don't block) before context compaction |\n| `UserPromptSubmit` | Inject policy context, track commands |\n| `SessionStart` | One-time session initialization (`once: true`) |\n\nFull event list and response schemas: `.claude\u002Frules\u002Fhooks-editing.md`\n\n---\n\n## Related\n\n- `harness\u002Fhooks\u002Fhooks.json` — SSOT for all hook configuration\n- `harness\u002Fscripts\u002F` — All command hook scripts\n- `.claude\u002Frules\u002Fhooks-editing.md` — Complete event reference and timeout guidelines\n- `update-config` skill — For adding automated behaviors via settings.json\n",{"name":5,"description":7,"when_to_use":44,"allowed-tools":45},"write hook, create hook, hook not running, debug hook, hook silent failure, hooks.json, pre-tool hook, post-tool hook",[46,47,48,33],"Read","Write","Edit","master","cf086c6a667d37610d30a4236b94d8ab02e4efc5",".claude\u002Fskills\u002Fwriting-hooks",0,"https:\u002F\u002Fgithub.com\u002Ftim-hub\u002Fpowerball-harness","https:\u002F\u002Fgithub.com\u002Ftim-hub","https:\u002F\u002Ftim.bai.uno","Building things.","2026-08-05 17:45:08",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add tim-hub\u002Fpowerball-harness --skill writing-hooks",{"tool":64,"command":65},"bunx","bunx skills add tim-hub\u002Fpowerball-harness --skill writing-hooks",{"tool":67,"command":68},"pnpm","pnpm dlx skills add tim-hub\u002Fpowerball-harness --skill writing-hooks","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Ftim-hub\u002Fpowerball-harness\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Fwriting-hooks\u002FSKILL.md",true,[],[73,86,95,119,137,142],{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":39},"01M6R7GH70ABV40CS95W4WWMQZ","escape-skill","https:\u002F\u002Fgithub.com\u002Ftim-hub\u002Fpowerball-harness\u002Fblob\u002Fmaster\u002Ftests\u002Ffixtures\u002Fskills\u002Fzz-review-escape\u002FSKILL.md",[],[79,80,81,82,83,84,85],"escape skill","escape","quoted","path","true","false","Tools",{"skillNo":87,"name":88,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":39},"01M6R7G8A2BQHYTAR39BY7X3GK","zz-review-empty","https:\u002F\u002Fgithub.com\u002Ftim-hub\u002Fpowerball-harness\u002Fblob\u002Fmaster\u002Ftests\u002Ffixtures\u002Fskills\u002Fzz-review-empty\u002FSKILL.md",[],[92,93,94,83,84],"review","zz review empty","empty",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":39},"01M6R7G3XH6C43JKP2RX1SZW6V","harness-schedule-run","Use when running Plans.md tasks on a scheduled cadence (fresh context per wake-up, sprint-contract flow, plateau detection, flock guard). Do NOT load for: single-task work (harness-work), planning, review, release.","https:\u002F\u002Fgithub.com\u002Ftim-hub\u002Fpowerball-harness\u002Fblob\u002Fmaster\u002Fharness\u002Ftemplates\u002Fopencode\u002Fskills\u002Fharness-schedule-run\u002FSKILL.md",[],[102,103,104,105,92,106,107,108,109,110,24,111,33,112,113,114,115,116,117,118],"run","harness schedule run","harness","schedule","tasks","ci","MCP","mem","wake","sprint-contract","scheduled","cadence","sprint","fresh","worker","up","work",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":39},"01M6R7FY3ZVYDDKXBT3D7QSFFK","harness-work","Use when implementing, executing, or running Plans.md tasks — single task, parallel workers, or full team\u002Fbreezing run. Accepts specific task numbers or ranges. Do NOT load for: planning, review, release, or setup.","https:\u002F\u002Fgithub.com\u002Ftim-hub\u002Fpowerball-harness\u002Fblob\u002Fmaster\u002Fharness\u002Ftemplates\u002Fcodex-skills\u002Fharness-work\u002FSKILL.md",[],[126,104,118,127,24,128,129,130,131,132,133,22,134,33,135,102,106,136,92,30],"harness work","full","implementing","mode","number","breezing","auto","edit","team","release","commit",{"skillNo":138,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":39},"01M6R7FGP3R612506A5GKMBF5C","https:\u002F\u002Fgithub.com\u002Ftim-hub\u002Fpowerball-harness\u002Fblob\u002Fmaster\u002Fharness\u002Ftemplates\u002Fcodex-skills\u002Fharness-schedule-run\u002FSKILL.md",[],[103,104,102,105,92,108,106,112,24,111,110,113,114,115,116,109,117,118,33,107],{"skillNo":143,"name":131,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":39},"01M6R7FCDN9AS7RSQFGZWHTF7F","Use when running the full team\u002Fbreezing flow end-to-end — all tasks with parallel workers. Do NOT load for: single-task implementation, planning, review, release, or setup.","https:\u002F\u002Fgithub.com\u002Ftim-hub\u002Fpowerball-harness\u002Fblob\u002Fmaster\u002Fharness\u002Ftemplates\u002Fcodex-skills\u002Fbreezing\u002FSKILL.md",[],[131,133,23,24,148,129,149,150,127,132,22,30,151,33,134,152,135,106,136,92],"single-task","websearch","end","parallel","flow"]