parcadei / hooks
Install for your project team
Run this command in your project directory to install the skill for your entire team:
mkdir -p .claude/skills/hooks && curl -L -o skill.zip "https://fastmcp.me/Skills/Download/2194" && unzip -o skill.zip -d .claude/skills/hooks && rm skill.zip
Project Skills
This skill will be saved in .claude/skills/hooks/ and checked into git. All team members will have access to it automatically.
Important: Please verify the skill by reviewing its instructions before using it.
Hook Development Rules
0 views
0 installs
Skill Content
---
name: hooks
description: Hook Development Rules
user-invocable: false
---
# Hook Development Rules
When working with files in `.claude/hooks/`:
## Pattern
Shell wrapper (.sh) → TypeScript (.ts) via `npx tsx`
## Shell Wrapper Template
```bash
#!/bin/bash
set -e
cd "$CLAUDE_PROJECT_DIR/.claude/hooks"
cat | npx tsx <handler>.ts
```
## TypeScript Handler Pattern
```typescript
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:
```bash
echo '{"type": "resume"}' | .claude/hooks/session-start-continuity.sh
```
## Registration
Add hooks to `.claude/settings.json`:
```json
{
"hooks": {
"EventName": [{
"matcher": ["pattern"], // Optional
"hooks": [{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/hook.sh"
}]
}]
}
}
```