browser-testing-with-s…
Use when testing web applications with visual verification - automates Chrome browser interactions, element selection, and…
Use when creating or publishing Claude Code hooks - covers executable format, event types, JSON I/O, exit codes, security requirements, and PRPM package structure
Claude Code
$ npx -y skills add AgentWorkforce/relay --skill creating-claude-hooks-skill --agent claude-code
Codex
$ npx skills add AgentWorkforce/relay --skill creating-claude-hooks-skill -a codex -y
Cursor
$ npx skills add AgentWorkforce/relay --skill creating-claude-hooks-skill -a cursor -y
Gemini CLI
$ npx skills add AgentWorkforce/relay --skill creating-claude-hooks-skill -a gemini-cli -y
GitHub Copilot
$ npx skills add AgentWorkforce/relay --skill creating-claude-hooks-skill -a github-copilot -y
OpenCode
$ npx skills add AgentWorkforce/relay --skill creating-claude-hooks-skill -a opencode -y
Windsurf
$ npx skills add AgentWorkforce/relay --skill creating-claude-hooks-skill -a windsurf -y
name: creating-claude-hooks description: Use when creating or publishing Claude Code hooks - covers executable format, event types, JSON I/O, exit codes, security requirements, and PRPM package structure skillType: skill allowed-tools: Read, Write, Edit, Grep, Glob, Bash
Use this skill when creating, improving, or publishing Claude Code hooks. Provides essential guidance on hook format, event handling, I/O conventions, and package structure.
Activate this skill when:
| Aspect | Requirement | | --------------- | ------------------------------------------------- | | **Location** | `.claude/hooks/<event-name>` | | **Format** | Executable file (shell, TypeScript, Python, etc.) | | **Permissions** | Must be executable (`chmod +x`) | | **Shebang** | Required (`#!/bin/bash` or `#!/usr/bin/env node`) | | **Input** | JSON via stdin | | **Output** | Text via stdout (shown to user) | | **Exit Codes** | `0` = success, `2` = block, other = error |
| Event | When It Fires | Common Use Cases | | -------------------- | --------------------------- | ---------------------------------------- | | `session-start` | New session begins | Environment setup, logging, checks | | `user-prompt-submit` | Before user input processes | Validation, enhancement, filtering | | `tool-call` | Before tool execution | Permission checks, logging, modification | | `assistant-response` | After assistant responds | Formatting, logging, cleanup |
**Project hooks:**
.claude/hooks/session-start .claude/hooks/user-prompt-submit
**User-global hooks:**
~/.claude/hooks/session-start ~/.claude/hooks/tool-call
Every hook MUST:
1. **Have a shebang line:**
#!/bin/bash # or #!/usr/bin/env node # or #!/usr/bin/env python3
2. **Be executable:**
chmod +x .claude/hooks/session-start
3. **Handle JSON input from stdin:**
#!/bin/bash INPUT=$(cat) FILE=$(echo "$INPUT" | jq -r '.input.file_path // empty')
4. **Exit with appropriate code:**
exit 0 # Success exit 2 # Block operation exit 1 # Error (logs but continues)
Hooks receive JSON via stdin with event-specific data:
{
"event": "tool-call",
"timestamp": "2025-01-15T10:30:00Z",
"session_id": "abc123",
"current_dir": "/path/to/project",
"input": {
"file_path": "/path/to/file.ts",
"command": "npm test",
"old_string": "...",
"new_string": "..."
}
}| Code | Meaning | Behavior | | ------------ | ------- | -------------------------- | | `0` | Success | Continue normally | | `2` | Block | Stop operation, show error | | `1` or other | Error | Log error, continue |
Hooks should validate against the JSON schema:
**Schema URL:** https://github.com/pr-pm/prpm/blob/main/packages/converters/schemas/claude-hook.schema.json
**Required frontmatter fields:**
| Mistake | Problem | Solution | | ---------------------- | ------------------------- | ------------------------------------ | | Not quoting variables | Breaks on spaces | Always use `"$VAR"` | | Missing shebang | Won't execute | Add `#!/bin/bash` | | Not executable | Permission denied | Run `chmod +x hook-file` | | Logging to stdout | Clutters transcript | Use stderr: `echo "log" >&2` | | Wrong exit code | Doesn't block when needed | Use `exit 2` to block | | No input validation | Security risk | Always validate JSON fields | | Slow operations | Blocks Claude | Run in background or use PostToolUse | | Absolute paths missing | Can't find scripts | Use `$CLAUDE_PLUGIN_ROOT` |
#!/bin/bash # .claude/hooks/session-start # Log session start echo "Session started at $(date)" >> ~/.claude/session.log # Check environment if ! command -v node &> /dev/null; then echo "Warning: Node.js not installed" >&2 fi # Output to user echo "Development environment ready" exit 0
#!/usr/bin/env node
// .claude/hooks/user-prompt-submit
import { readFileSync } from 'fs';
// Read JSON from stdin
const input = readFileSync(0, 'utf-8');
const data = JSON.parse(input);
// Validate prompt
if (data.prompt.includes('API_KEY')) {
console.error('Warning: Prompt may contain secrets');
process.exit(2); // Block
}
console.log('Prompt validated');
process.exit(0);Target < 100ms for PreToolUse hooks:
Tired of copy/pasting from Claude Code into Slack so your coworker can paste it into their agent? Ever put an important rule in a skill or AGENTS.md, only for the agent to completely ignore it? You and your teammates agents ever build the same thing?
Use when testing web applications with visual verification - automates Chrome browser interactions, element selection, and…
Use when coordinating multiple AI agents with Agent Relay's workflow engine and need to pick the right orchestration pattern -…
Use when creating or improving Claude Code agents. Expert guidance on agent file structure, frontmatter, persona definition, tool…
Use when creating or fixing .claude/rules/ files - provides correct paths frontmatter (not globs), glob patterns, and avoids…
Use when creating new Claude Code skills or improving existing ones - ensures skills are discoverable, scannable, and effective…
Use when seeing WebSocket errors like "Invalid frame header", "RSV1 must be clear", or "WS_ERR_UNEXPECTED_RSV_1" - covers…
Direct browser control via CDP for web interaction: automation, scraping, testing, screenshots, and site/app work. Also covers…
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…