claude-hook-writer
Expert guidance for writing secure, reliable, and performant Claude Code hooks - validates design decisions, enforces best practices, and prevents common…
Skill by Claude Skills Maintainers
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/jsonlee12138-claude-hook-writer
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, writing, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/claude-hook-writer
What's inside
- Skill name
claude-hook-writer- Description
- Expert guidance for writing secure, reliable, and performant Claude Code hooks - validates design decisions, enforces best practices, and prevents common pitfalls. Use when creating, reviewing, or debugging Claude Code hooks.
- License
- MIT
- Metadata
- author: Claude Skills Maintainers · version: 2.0.0 · last_verified: 2025-12-17 · token_savings: ~55% · errors_prevented: 5 · optimization_date: 2025-12-17
- Instructions
- 414 lines in SKILL.md · view on GitHub
Agent Skills spec issues
- files: referenced but missing: references/hook-templates.md
Files (7)
- SKILL.md
- code-templates.md · references/
- publishing-guide.md · references/
- quick-reference.md · references/
- reliability-performance.md · references/
- security-requirements.md · references/
- testing-debugging.md · references/
SKILL.md (first lines)
# Claude Hook Writer
**Status**: Production Ready
**Version**: 2.0.0 (Optimized with progressive disclosure)
**Last Updated**: 2025-12-17
---
## Overview
Expert guidance for writing secure, reliable, and performant Claude Code hooks. This skill validates design decisions, enforces best practices, and prevents common pitfalls.
---
## When to Use This Skill
- Designing a new Claude Code hook
- Reviewing existing hook code
- Debugging hook failures
- Optimizing slow hooks
- Securing hooks that handle sensitive data
- Publishing hooks as PRPM packages
---
## Core Principles
### 1. Security is Non-Negotiable
Hooks execute automatically with user permissions and can read, modify, or delete any file the user can access.
**ALWAYS validate and sanitize all input.** Hooks receive JSON via stdin—never trust it blindly.
**For complete security patterns**: Load `references/security-requirements.md` when implementing validation or securing hooks.
### 2. Reliability Over Features
A hook that works 99% of the time is a broken hook. Edge cases (Unicode filenames, spaces in paths, missing tools) will happen.
**Test with edge cases before deploying.**
**For reliability patterns**: Load `references/reliability-performance.md` when handling errors or edge cases.
### 3. Performance Matters
Hooks block operations. A 5-second hook means Claude waits 5 seconds before continuing.
**Keep hooks fast. Run heavy operations in background.**
**For performance optimization**: Load `references/reliability-performance.md` when optimizing hook speed.
### 4. Fail Gracefully
Missing dependencies, malformed input, and disk errors will occur.
**Handle errors explicitly. Log failures. Return meaningful exit codes.**
---
## Hook Design Checklist
Before writing code, answer these questions:
### What Event Does This Hook Target?
- `PreToolUse` - Before tool execution (modify input, validate, block)
- `PostToolUse` - After tool completes (format, log, cleanup)
- `UserPromptSubmit` - Before user input processes (validate, enhance)
- `SessionStart` - When Claude Code starts (setup, env check)
- `SessionEnd` - When Claude Code exits (cleanup, persist state)
- `Notification` - During alerts (desktop notifications, logging)
- `Stop` / `SubagentStop` - When responses finish (cleanup, summary)
- `PreCompact` - Before context compaction (save important context)
**Common mistake:** Using PostToolUse for validation (too late—tool already ran). Use PreToolUse to block operations.
### Which Tools Should Trigger This Hook?
Be specific. `matcher: "*"` runs on every tool call.
**Good matchers:**
- `"Write"` - Only file writes
- `"Edit|Write"` - File modifications
- `"Bash"` - Shell commands
- `"mcp__github__*"` - All GitHub MCP tools
**Bad matchers:**
- `"*"` - Everything (use only for logging/metrics)
### What Input Does This Hook Need?
Different tools provide different input. Check what's available:
```bash
# PreToolUse / PostToolUse
{
"input": {
"file_path": "/path/to/file.ts", // Read, Write, Edit
"command": "npm test", // Bash
"old_string": "...", // Edit
"new_string": "..." // Edit
}
}
```
**Validate fields exist before using them:**
```bash
FILE=$(echo "$INPUT" | jq -r '.input.file_path // empty')
if [[ -z "$FILE" ]]; then
echo "No file path provided" >&2
exit 1
fi
```
### Should This Be a Command Hook or Prompt Hook?
**Command hooks** (`type: "command"`):
- Fast (milliseconds)From JsonLee12138/agent-team, MIT.
More from JsonLee12138/agent-team
- 0.502score
task-splitting
JsonLee12138
Decompose requirement, design, or brainstorming documents into reviewable task drafts with one function per task and one file per task, then create…
SkillDFreshness: D★ 33Claude Code +9 - 0.502score
prompt-engineering-patterns
JsonLee12138
Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability in production.
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
go-backend
JsonLee12138
Go CLI 核心代码开发者,负责 agent-team 项目 internal/ 和 cmd/ 目录下的所有 Go 代码改动 Use when the user asks for go-backend-related work such as: go 代码开发 (internal/ + cmd/), cobra…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
pencil-designer
JsonLee12138
Senior Pencil UI/UX Designer specializing in design systems, responsive interfaces, and accessible applications with mandatory Pencil MCP integration Use when…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
mckinsey-consultant
JsonLee12138
McKinsey-style business consultant for hypothesis-driven problem solving, structured analysis, and strategic recommendations Use when the user asks for…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
qa-tester
JsonLee12138
测试编写与集成验证工程师,负责 agent-team 项目的单元测试、CLI 命令测试和端到端集成验证 Use when the user asks for qa-tester-related work such as: go 单元测试编写, cli 命令测试, 端到端集成测试, 构建验证 (go…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
uniapp-dev
JsonLee12138
资深 UniApp 开发工程师,专精于 UnoCSS 原子化 CSS、Vite 工程化、UniApp 跨平台开发和 UCharts 数据可视化,具有丰富的小程序/H5/App 全场景交付经验 Use when the user asks for uniapp-dev-related work such as…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
rules-writer
JsonLee12138
规则文件与 Provider 文件编写者,负责 .agents/rules/*.md、CLAUDE.md、AGENTS.md、GEMINI.md 的内容编写与维护 Use when the user asks for rules-writer-related work such as: markdown…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
vite-react-dev
JsonLee12138
资深 Vite-React 开发工程师,专精于 UnoCSS 原子化 CSS、Vite 工程化、Vitest 测试、React 现代开发模式和 TanStack 全家桶(Router/Query/Form/Table),具有丰富的 SPA 应用交付经验 Use when the user asks for…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
pd
JsonLee12138
产品总监角色,精通产品战略、用户研究、优先级排序、路线图规划、SaaS 指标分析、研讨会引导和团队领导力发展,覆盖从发现到交付的完整产品管理生命周期 Use when the user asks for pd-related work such as: 产品战略与定位, 用户研究与客户发现, 优先级排序与路线图…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
pm
JsonLee12138
Full-stack product manager covering strategy, discovery, execution, go-to-market, market research, data analytics, marketing growth, and PM toolkit Use when…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
growth-marketer
JsonLee12138
Growth marketing role for project promotion across social media platforms, content creation, and community engagement Use when the user asks for…
SkillDFreshness: D★ 33Claude Code +9
Signals
- Stars
- 33
- Forks
- 4
- Open issues
- 1
- Last commit (this folder)
- Mar 21, 2026 (7 months ago)
- Last release
- Mar 22, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 2.0.0
- License
- MIT
- Repository
- github.com/JsonLee12138/agent-team
- Website
- role-hub.vercel.app/
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Claude Skills Maintainers
Cite this page
claude-hook-writer skill. Agent Mart. https://agentmart.dev/skills/jsonlee12138-claude-hook-writer (last updated 2026-10-24)