Standardized configuration and pattern enforcement for AI agent hooks.
Install
mkdir -p .claude/skills/hooks && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2194" && unzip -o skill.zip -d .claude/skills/hooks && rm skill.zipInstalls to .claude/skills/hooks
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Hook Development RulesKey capabilities
- →Register shell-to-TypeScript hooks
- →Configure pre-execution and post-execution tasks
- →Manage session start and stop events
- →Define event-specific matchers
- →Test hooks manually via shell scripts
How it works
Hooks use a shell wrapper to pipe input into a TypeScript handler via npx tsx, which processes the event and returns a JSON response.
Inputs & outputs
When to use hooks
- →Register a custom PreToolUse hook
- →Configure a post-execution cleanup task
- →Define triggers for session start events
About this skill
Hook Development Rules
When working with files in .claude/hooks/:
Pattern
Shell wrapper (.sh) → TypeScript (.ts) via npx tsx
Shell Wrapper Template
#!/bin/bash
set -e
cd "$CLAUDE_PROJECT_DIR/.claude/hooks"
cat | npx tsx <handler>.ts
TypeScript Handler Pattern
interface HookInput {
// Event-specific fields
}
async function main() {
const input: HookInput = JSON.parse(await readStdin());
// Process input
const output = {
result: 'continue', // or 'block'
message: 'Optional system reminder'
};
console.log(JSON.stringify(output));
}
Hook Events
- PreToolUse - Before tool execution (can block)
- PostToolUse - After tool execution
- UserPromptSubmit - Before processing user prompt
- PreCompact - Before context compaction
- SessionStart - On session start/resume/compact
- Stop - When agent finishes
Testing
Test hooks manually:
echo '{"type": "resume"}' | .claude/hooks/session-start-continuity.sh
Registration
Add hooks to .claude/settings.json:
{
"hooks": {
"EventName": [{
"matcher": ["pattern"], // Optional
"hooks": [{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/hook.sh"
}]
}]
}
}
When not to use it
- →When direct TypeScript execution is sufficient without shell wrapping
Prerequisites
Limitations
- →Requires shell wrapper for execution
- →Limited to predefined hook events
How it compares
Unlike static configurations, this allows dynamic, event-driven logic execution before or after agent tool use.
Compared to similar skills
hooks side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| hooks (this skill) | 3 | 7mo | Review | Intermediate |
| bazel-build-optimization | 14 | 2mo | No flags | Advanced |
| github-workflow-automation | 11 | 2mo | Review | Advanced |
| wolf-scripts-core | 5 | 9mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by parcadei
View all by parcadei →You might also like
bazel-build-optimization
wshobson
Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
github-workflow-automation
ruvnet
Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management
wolf-scripts-core
Nice-Wolf-Studio
Core automation scripts for archetype selection, evidence validation, quality scoring, and safe bash execution
github-actions-templates
wshobson
Create production-ready GitHub Actions workflows for automated testing, building, and deploying applications. Use when setting up CI/CD with GitHub Actions, automating development workflows, or creating reusable workflow templates.
bash-defensive-patterns
wshobson
Master defensive Bash programming techniques for production-grade scripts. Use when writing robust shell scripts, CI/CD pipelines, or system utilities requiring fault tolerance and safety.
hooks-automation
ruvnet
Automated coordination, formatting, and learning from Claude Code operations using intelligent hooks with MCP integration. Includes pre$post task hooks, session management, Git integration, memory coordination, and neural pattern training for enhanced development workflows.