enhance-hooks
Use when reviewing hooks for safety, timeouts, and correct frontmatter.
npx skills add agent-sh/agentsys --skill enhance-hooks --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# enhance-hooks Analyze hook definitions and scripts for safety, correctness, and best practices. ## Parse Arguments ```javascript const args = '$ARGUMENTS'.split(' ').filter(Boolean); const targetPath = args.find(a => !a.startsWith('--')) || '.'; const fix = args.includes('--fix'); ``` ## Workflow 1. **Discover** - Find hook files (.md, .sh, .json) 2. **Classify** - Identify hook type and event 3. **Parse** - Extract frontmatter and script content 4. **Check** - Run all pattern checks against knowledge below 5. **Filter** - Apply certainty filtering 6. **Report** - Generate markdown output 7. **Fix** - Apply auto-fixes if --fix flag present --- ## Hook Knowledge Reference ### What Are Hooks Hooks are automated actions triggered at specific points in a Claude Code session. They enable validation, monitoring, and control of Claude's actions through bash commands or LLM-based evaluation. ### Hook Lifecycle (Complete Reference) Hooks fire in this sequence: | Order | Event | Description | Matcher Required | |-------|-------|-------------|------------------| | 1 | `SessionStart` | Session begins or resumes | No | | 2 | `UserPromptSubmit` | User submits a prompt | No | | 3 | `PreToolUse`
- Parse Arguments
- Workflow
- Hook Knowledge Reference
- What Are Hooks
- Hook Lifecycle (Complete Reference)
- Hook Types
- Configuration Locations
- Configuration Structure
- Matcher Syntax
- Input Schema (JSON via stdin)
- Exit Codes
- Output Schemas
- Environment Variables
- Practical Hook Examples
set -euo pipefail
Block dangerous patterns
if echo "$cmd" | grep -qE 'rm -rf|git reset --hard|curl.*\|.*sh'; then
echo '{"decision": "block", "reason": "Dangerous command blocked"}' >&2
exit 2
fi
exit 0
for file in $files; do
case "$file" in
esacWhat does the enhance-hooks skill do?
Use when reviewing hooks for safety, timeouts, and correct frontmatter.
How do I install it?
Run `npx skills add agent-sh/agentsys --skill enhance-hooks --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From agent-sh/agentsys, a repository with 923 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.