hooks-creator
Skill1 starsChanged 6 months agoApache-2.0View on GitHub
Use when the user wants to customize Gemini CLI behavior using hooks (events, blockers, loggers).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- AllanSantos-DV/skill-kittheir own version, first seen Oct 15, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- AllanSantos-DV/skill-kit★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- brainstormingSkill
- design-mdSkill
- docxSkill
- htmlSkill
- marp-slideSkill
- mcp-builderSkill
- obsidian-cliSkill
- pdfSkill
- post-writingSkill
- pptxSkill
- skill-auto-improveSkill
- skill-creatorSkill
- skill-enhancerSkill
- skill-validatorSkill
- summarizing-meetingsSkill
- text-humanizerSkill
- transcript-fetcherSkill
- vdd-adversarialSkill
- vdd-sarcasticSkill
- wiki-ingestSkill
- xlsxSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Purpose: Create robust, secure, and compliant Gemini CLI hooks that intercept and customize the agent's lifecycle (e.g., blocking tools, …
- Distinctive: line 47
Clear Request: If the user provides specific intent (e.g., "Block 'rm' commands"), SKIP clarification and proceed to implementation.
- Distinctive: line 48
Ambiguous Request: If vague (e.g., "Make it safer"), ask ONE clarifying question: "Do you want to block specific tools or scan content?"
- Very specific: line 58
Bash: Verify jq availability AND functionality.
- Very specific: line 61
Never pass raw input to eval or exec.
- Very specific: line 62
Use jq to extract fields safely before processing.
- Very specific: line 66
Use specific matchers (e.g., write_file|replace_...) instead of * to optimize performance.
- Very specific: line 67
Ensure type is "command".
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Hooks Creator
Purpose: Create robust, secure, and compliant Gemini CLI hooks that intercept and customize the agent's lifecycle (e.g., blocking tools, injecting context, logging).
1. Red Flags (Anti-Rationalization)
STOP and READ THIS if you are thinking:
- "I'll use
grepto parse JSON in Bash because it's faster" -> WRONG. This is a security vulnerability. You MUST usejq. - "I'll just print a debug message to stdout" -> WRONG. This breaks JSON parsing. ALL logs must go to
stderr. - "I can skip the dependency check" -> WRONG. Scripts will fail silently. Always check for
jqor node modules. - "I'll use
exit 1for a denial" -> WRONG. Useexit 0with{"decision": "deny"}for structured feedback, orexit 2for system errors.
2. Capabilities
- Generate Bash hooks for simple logic (using
jq). - Generate Node.js hooks for complex logic or heavy JSON processing.
- Configure
settings.jsonwith correct matchers and event types. - Validate security and performance best practices.
3. Execution Mode
- Mode:
prompt-first - Why this mode: the skill ships no
scripts/of its own — it authors hook scripts for the user's project. Choosing the event, the language (Bash vs Node.js) and the matcher is judgement over the request plusreferences/; the deterministic work lives in the generated hook, not here. - Script Contract: none of its own. The contract the generated hook must meet is §5 Phase 2: strict JSON on
stdout, logs onstderr, ajqdependency check, exit2on system failure. The I/O schemas and the exit-code table are inreferences/reference.md.
4. Safety Boundaries (SECURITY CRITICAL)
[!WARNING] SECURITY CRITICAL:
- Strict JSON: Printing to
stdoutbreaks the CLI. Usestderrfor logs.- Injection Risks: BASH hooks MUST use
jq. Never usegrepon raw input.- Dependency Checks: Scripts MUST fail gracefully (exit 2) if deps like
jqare missing.
- Scope: this skill authors hook scripts and a
settings.jsonsnippet; enabling them is the user's step — Phase 3 hands overchmod +xand the pipe test instead of running them. - Blast radius: a generated hook runs on every matching event, so prefer a specific
matcherover*(Phase 3.1). Exit2aborts the tool or the turn, so reserve it for a missing dependency or a parse failure and express a policy denial as exit0plus{"decision": "deny"}(references/reference.md§ Global hook mechanics).
5. Instruction Protocol
Phase 1: Analyze & Clarify
- Identify the Event: Map user intent to the correct Life Cycle Event.
- Example: "Stop me from committing secrets" ->
BeforeTool(triggered onwrite_file). - Example: "Add git history to context" ->
BeforeAgent(orSessionStart).
- Example: "Stop me from committing secrets" ->
- Analyze Clarity (Fast Path):
- Clear Request: If the user provides specific intent (e.g., "Block 'rm' commands"), SKIP clarification and proceed to implementation.
- Ambiguous Request: If vague (e.g., "Make it safer"), ask ONE clarifying question: "Do you want to block specific tools or scan content?"
- Select Implementation:
- Bash: For simple checks (grepping specific patterns, file existence).
- Node.js: For logic requiring array manipulation, complex JSON, or async calls.
Phase 2: Implementation (The Golden Rules)
- Strict JSON Output:
- The script MUST NOT echo anything to
stdoutexcept the final JSON object. - Redirect all intermediate logs to
stderr(e.g.,echo "Debug" >&2).
- The script MUST NOT echo anything to
- Dependency Checks (MANDATORY):
- Bash: Verify
jqavailability AND functionality.- Pattern:
command -v jq >/dev/null 2>&1 || { echo "jq is required" >&2; exit 2; }
- Pattern:
- Bash: Verify
- Security Sanitization:
- Never pass raw
inputtoevalorexec. - Use
jqto extract fields safely before processing.
- Never pass raw
Phase 3: Configuration & Validation Evidence
- Generate
settings.jsonsnippet:- Use specific matchers (e.g.,
write_file|replace_...) instead of*to optimize performance. - Ensure
typeis"command".
- Use specific matchers (e.g.,
- Verification Recommendations:
- Tell the user to run
chmod +x <script>. - Advise testing with piped JSON:
cat test.json | ./hook.sh. - Pass criteria:
out=$(mktemp); ./hook.sh < test.json > "$out"; echo "exit=$?"—0on every normal path,2only on the system-block path (missing dependency, unparseable input). On each exit-0 run,jq -se 'length == 1 and (.[0] | type == "object")' "$out" >/dev/nullproves thatstdoutcarries exactly one JSON object; on the exit-2 pathstdoutis empty by design. (jq -e .orjq -e 'type == "object"'would not:-ejudges only the last output, so both exit 0 on two concatenated objects.) Amktempfile, not a fixed/tmpname, keeps another user's link out of the path. - Worked example:
in=$(mktemp); out=$(mktemp); printf '{"tool_input":{"content":"API_TOKEN=abc"}}' > "$in"; bash examples/security_gate.sh < "$in" > "$out"; echo "exit=$?"—exit=0,"decision": "deny"in$out,Blocked secret commitmentonstderr.
- Tell the user to run
6. Canonical Resources (Source of Truth)
You MUST read these files for API details:
references/Gemini CLI Hooks.md(Core Concepts)references/reference.md(JSON Schema & Exit Codes)references/best-practices.md(Security)
7. Examples (Few-Shot)
1. Security Gate (Bash)
See examples/security_gate.sh for full implementation.
Use when: Blocking unsafe content or tools.
2. Tool Filtering (Node.js)
See examples/tool_filter.js for full implementation.
Use when: Restricting tools based on user prompt/intent.
3. Settings Configuration
See examples/settings_snippet.json.
4. Simple Logger (Bash)
See examples/log_tools.sh.
Use when: Debugging or auditing tool usage.
5. Context Injection (Bash)
See examples/inject_context.sh.
Use when: Adding environment data (Git, DB) to agent context.
6. Response Validation (Node.js)
See examples/validate_response.js.
Use when: Enforcing quality checks (e.g., "Must include Summary:") before showing output.
8. Rationalization Table
| Agent Excuse | Reality / Counter-Argument |
"I'll skip the jq check" | Systems without jq will crash unpredictably. |
"Users know not to echo" | No they don't. You must enforce it in the code. |
| "I'll use Python" | Node.js/Bash are preferred for minimal runtime deps, but Python is allowed if requested. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

