author-claude-hook
Write a new Claude Code hook script for this repo following its established conventions, then wire it into claude/settings.json and give the user the settings…
Skill by Ronnasayd Machado - github.com/Ronnasayd
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/ronnasayd-author-claude-hook
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: 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/author-claude-hook
What's inside
- Skill name
author-claude-hook- Description
- Write a new Claude Code hook script for this repo following its established conventions, then wire it into claude/settings.json and give the user the settings snippet. Use when the user says "criar um hook", "fazer um hook que", "create a hook", "comando para colar no settings", or describes an automated behavior that should fire on a tool call / session event (PreToolUse, PostToolUse, SessionStart, Stop, UserPromptSubmit, SubagentStart/Stop).
- License
- CC-BY-4.0
- Metadata
- author: Ronnasayd Machado - github.com/Ronnasayd · version: 1.0.0
- Instructions
- 53 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- conventions.md · references/
SKILL.md (first lines)
# Author a Claude Code Hook
Create a hook that matches the existing ~40 hooks in `hooks/scripts/`, wire it in `claude/settings.json`, add an eval.
## Phase 1 — Understand the trigger
Clarify with the user (use `grilling` if ambiguous):
- **Event**: `PreToolUse` (can block/allow), `PostToolUse` (inject context after), `SessionStart`, `Stop`, `UserPromptSubmit`, `SubagentStart`/`SubagentStop`, `PreCompact`.
- **Matcher**: tool regex (`Edit|Write`, `Bash`, `Read`) or `""` for all.
- **Effect**: inject `additionalContext` (most common), or gate a tool (`exit 2` = deny, with reason on stderr).
- **Dedup need**: should it re-announce every call, or back off (`NOTIFY_EVERY` pattern)?
Read 1–2 nearby hooks of the same event type before writing (`dir_context_refs.py` for PreToolUse+context, `impact_surface_hint.py` for PostToolUse+context, `protect_files.py` for gating, `start_context.py` for SessionStart).
## Phase 2 — Write the script
Follow `references/conventions.md` exactly: shebang `#!/usr/bin/python3`, `utils` import via `sys.path`, `get_hooks_logger("Name")`, read stdin with a `MAX_STDIN` cap, parse JSON defensively (exit 0 on any failure), use `get_by_key` for payload access, resolve project via `CLAUDE_PROJECT_DIR` env, wrap `main()` in `try/except logger.exception; sys.exit(0)`. A hook must never crash the tool call — every failure path is `sys.exit(0)`.
Output shape for context injection:
```python
json.dumps({"hookSpecificOutput": {
"hookEventName": "PreToolUse", # match the actual event
"additionalContext": json.dumps({...})
}})
```
Save to `hooks/scripts/<snake_name>.py`, `chmod +x`.
## Phase 3 — Wire settings.json
Add the hook command under the right event/matcher block in `claude/settings.json`, using `$CLAUDE_PROJECT_DIR/.claude/hooks/scripts/<name>.py` (that is the deployed path — `.claude/` symlinks to the repo). Place it near sibling hooks of the same purpose. Keep the `log_hooks.py` entry last in its block.
Give the user the exact JSON snippet to paste, showing the full event block with the new entry in place.
## Phase 4 — Eval
Add `hooks/evals/<name>.json` (`mode`: `stdout` for context hooks, `exit_code` for gating hooks) with cases covering: the happy path (`expect_output: true` + `expect_pattern`), non-matching tool (no output), missing `file_path`/field (no output), malformed JSON (`raw_stdin`), empty stdin. Run `python3 hooks/evals/eval.py hooks/evals/<name>.json` and confirm all pass.
## Delivery
Report: hook path, the settings.json snippet (verbatim), eval result. One or two lines on what it does. Do not paste the full script body into chat.
## Reference files
- `references/conventions.md` — the exact boilerplate skeleton, `utils` helpers available, output shapes for each event, the dedup/back-off pattern, gating (`exit 2`) pattern, and the "never crash the tool call" rule.
---
_Traceability: recurring across 16+ session prompts ("criar um hook que…", "comando para colar no settings", "fazer um hook equivalente em python") and 29 `fix(hooks)` commits (Jul–Aug 2026) fixing the same classes of mistake — wrong env var for project root, missing dedup, matcher not covering `AskUserQuestion`, non-atomic cache writes, silent exceptions. Sources: `$CLAUDE_CONFIG_DIR/projects/-home-ronnas-develop-personal-aipp/*.jsonl`, git log._From Ronnasayd/aipp, CC-BY-4.0.
More from Ronnasayd/aipp
- 0.582score
skill-inspector
Ronnasayd
Review AI agent skills before installation using NVIDIA SkillSpector and source-aware semantic review.
SkillAFreshness: A★ 1Claude Code +9 - 0.569score
skill-judge
Ronnasayd
Evaluate Agent Skill design quality against official specifications and best practices.
SkillAFreshness: A★ 1Claude Code +9 - 0.542score
adversarial-dev
Ronnasayd Machado - github.com/Ronnasayd
Orchestrates a code task through two separate agents in an adversarial loop — an executor that implements and a strict evaluator (no write tools) that scores…
SkillBFreshness: B★ 1Claude Code +9 - 0.542score
analyze-comfyui-workflow-json
Ronnasayd Machado - github.com/Ronnasayd
Analyze a ComfyUI workflow JSON and produce a structured map of nodes, links, subgraphs, and data flow before making changes.
SkillBFreshness: B★ 1Claude Code +9 - 0.542score
code-review
Ronnasayd Machado - github.com/Ronnasayd
A skill for performing structured code reviews based on git diffs and specialist instructions.
SkillBFreshness: B★ 1Claude Code +9 - 0.542score
compress-skill
Ronnasayd Machado - github.com/Ronnasayd
Compresses a verbose SKILL.md into a short, scannable core file by moving prose into tables, mermaid flowcharts, and reference files — without losing…
SkillBFreshness: B★ 1Claude Code +9 - 0.493score
apk-reverse
Ronnasayd Machado - github.com/Ronnasayd
Reverse engineering of Android APK files.
SkillCFreshness: C★ 1Claude Code +9 - 0.492score
auto-improve
Ronnasayd Machado - github.com/Ronnasayd
After completing any task, extract reusable rules from what worked and what failed.
SkillCFreshness: C★ 1Claude Code +9 - 0.489score
codebase-linguistic-analysis-to-csv-export
Ronnasayd Machado - github.com/Ronnasayd
Identify all non-English text in a codebase (specifically Portuguese characters) and export findings to a structured CSV for translation/remediation workflows.
SkillCFreshness: C★ 1Claude Code +9 - 0.489score
codebase-rules-extractor
Ronnasayd Machado - github.com/Ronnasayd
Extract and document coding rules, patterns, conventions, and anti-patterns from a codebase.
SkillCFreshness: C★ 1Claude Code +9 - 0.483score
agent-creator
Ronnasayd Machado - github.com/Ronnasayd
Create new specialist agents, modify and improve existing agents, and validate agent behavior.
SkillCFreshness: C★ 1Claude Code +9 - 0.472score
mcp-builder
Ronnasayd
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools.
SkillCFreshness: C★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 10, 2026 (18 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0.0
- License
- CC-BY-4.0
- Repository
- github.com/Ronnasayd/aipp
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Ronnasayd Machado - github.com/Ronnasayd
- 0.542score
adversarial-dev
Ronnasayd Machado - github.com/Ronnasayd
Orchestrates a code task through two separate agents in an adversarial loop — an executor that implements and a strict evaluator (no write tools) that scores…
SkillBFreshness: B★ 1Claude Code +9 - 0.542score
analyze-comfyui-workflow-json
Ronnasayd Machado - github.com/Ronnasayd
Analyze a ComfyUI workflow JSON and produce a structured map of nodes, links, subgraphs, and data flow before making changes.
SkillBFreshness: B★ 1Claude Code +9 - 0.542score
code-review
Ronnasayd Machado - github.com/Ronnasayd
A skill for performing structured code reviews based on git diffs and specialist instructions.
SkillBFreshness: B★ 1Claude Code +9 - 0.542score
compress-skill
Ronnasayd Machado - github.com/Ronnasayd
Compresses a verbose SKILL.md into a short, scannable core file by moving prose into tables, mermaid flowcharts, and reference files — without losing…
SkillBFreshness: B★ 1Claude Code +9 - 0.493score
apk-reverse
Ronnasayd Machado - github.com/Ronnasayd
Reverse engineering of Android APK files.
SkillCFreshness: C★ 1Claude Code +9 - 0.492score
auto-improve
Ronnasayd Machado - github.com/Ronnasayd
After completing any task, extract reusable rules from what worked and what failed.
SkillCFreshness: C★ 1Claude Code +9
Cite this page
author-claude-hook skill. Agent Mart. https://agentmart.dev/skills/ronnasayd-author-claude-hook (last updated 2026-10-24)