Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Hooks Builder

ASecurity

Creates Claude Code hooks executing shell commands, prompt evaluations, or multi-turn agents at 15 lifecycle events. Use when building PreToolUse validation, PostToolUse formatting, PermissionRequest auto-approval, Stop/SubagentStop evaluation, TeammateIdle prevention, TaskCompleted gating, Setup provisioning, SessionStart context injection, or deterministic agent control via blocking/non-blocking hooks.

2 stars
0 votes
0 copies
0 views
Added 9/19/2026
testingpythongoshellreacttestinggitsecurity

Works with

claude code

Security Analysis

A100/100

Scanned 9/19/2026

Install to Claude Code

$npx -y skills add bsamiee/Parametric_Portal --skill hooks-builder --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Hooks Builder?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Hooks Builder
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/bsamiee-hooks-builder/badge)](https://www.skillsdirectory.com/skills/bsamiee-hooks-builder)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: hooks-builder
description: >-
  Creates Claude Code hooks executing shell commands, prompt evaluations, or multi-turn agents at 15 lifecycle events. Use when building PreToolUse validation, PostToolUse formatting, PermissionRequest auto-approval, Stop/SubagentStop evaluation, TeammateIdle prevention, TaskCompleted gating, Setup provisioning, SessionStart context injection, or deterministic agent control via blocking/non-blocking hooks.
---

# [H1][HOOKS-BUILDER]
>**Dictum:** *Deterministic behavior requires hooks; prompts fail execution guarantees.*

<br>

Build Claude Code hooks—shell commands, prompt evaluations, or multi-turn agents execute at 15 agent lifecycle events.

**Tasks:**
1. Read [lifecycle.md](./references/lifecycle.md) — 14 events, input schemas, exit codes, blocking behavior
2. Read [schema.md](./references/schema.md) — Configuration structure, matchers, JSON responses, hook types
3. (integration) Read [integration.md](./references/integration.md) — Environment variables, context injection
4. (scripting) Read [scripting.md](./references/scripting.md) — Python standards, security patterns
5. (recipes) Read [recipes.md](./references/recipes.md) — Proven implementation patterns
6. (troubleshooting) Read [troubleshooting.md](./references/troubleshooting.md) — Known issues, platform workarounds
7. (prose) Load `style-standards` skill — Voice, formatting, constraints
8. Validate — Quality gate; see §VALIDATION

**Scope:**
- *Event Selection:* Choose hook type by automation goal (blocking vs observing).
- *Configuration:* Author settings.json entries with matchers and timeouts.
- *Response Handling:* Control agent via exit codes, JSON responses, or prompt evaluation.

**References:**

| Domain          | File                                                   |
| --------------- | ------------------------------------------------------ |
| Schema          | [schema.md](references/schema.md)                     |
| Lifecycle       | [lifecycle.md](references/lifecycle.md)                |
| Integration     | [integration.md](references/integration.md)            |
| Scripting       | [scripting.md](references/scripting.md)                |
| Recipes         | [recipes.md](references/recipes.md)                    |
| Troubleshooting | [troubleshooting.md](references/troubleshooting.md)    |
| Validation      | [validation.md](references/validation.md)              |

---
## [1][EVENT_SELECTION]
>**Dictum:** *Automation goal determines hook type; blocking capability varies by event.*

<br>

**Decision Gate:**<br>
- *Intercept before execution?* → PreToolUse (validate/block/modify parameters)
- *Control permission dialogs?* → PermissionRequest (auto-approve/deny)
- *React after completion?* → PostToolUse (format, lint, add context)
- *React after failure?* → PostToolUseFailure (error handling, retry logic)
- *Inject at session boundaries?* → SessionStart (context), UserPromptSubmit (per-message)
- *One-time provisioning?* → Setup (tool installation, dependency setup via `claude --init`)
- *Evaluate task completion?* → Stop/SubagentStop (prompt/agent type for LLM judgment)
- *Coordinate teams?* → TeammateIdle (prevent idle), TaskCompleted (validate completion)
- *Observe subagent lifecycle?* → SubagentStart/SubagentStop (logging)

**Blocking Events (exit 2 blocks action):**

| [INDEX] | [EVENT]           | [EXIT_2_EFFECT]                                       |
| :-----: | ----------------- | ----------------------------------------------------- |
|   [1]   | PreToolUse        | Blocks tool call; stderr shown to Claude              |
|   [2]   | PermissionRequest | Denies the permission                                 |
|   [3]   | UserPromptSubmit  | Blocks prompt processing; erases prompt from context  |
|   [4]   | Stop              | Prevents Claude from stopping; continues conversation |
|   [5]   | SubagentStop      | Prevents subagent from stopping                       |
|   [6]   | TeammateIdle      | Prevents teammate from going idle; stderr = feedback  |
|   [7]   | TaskCompleted     | Prevents task completion; stderr = feedback to model  |

**Non-blocking Events (exit 2 shows stderr only):**

| [INDEX] | [EVENT]            | [EXIT_2_EFFECT]                              |
| :-----: | ------------------ | -------------------------------------------- |
|   [1]   | PostToolUse        | Shows stderr to Claude (tool already ran)    |
|   [2]   | PostToolUseFailure | Shows stderr to Claude (tool already failed) |
|   [3]   | SessionStart       | Shows stderr to user only                    |
|   [4]   | Setup              | Shows stderr to user only                    |
|   [6]   | SessionEnd         | Shows stderr to user only                    |
|   [7]   | Notification       | Shows stderr to user only                    |
|   [8]   | SubagentStart      | Shows stderr to user only                    |
|   [9]   | PreCompact         | Shows stderr to user only                    |

---
## [2][CONFIGURATION]
>**Dictum:** *Centralized configuration enables scope-aware hook precedence.*

<br>

| [INDEX] | [SCOPE] | [PATH]                        | [USE]                | [GIT]  |
| :-----: | ------- | ----------------------------- | -------------------- | :----: |
|   [1]   | User    | `~/.claude/settings.json`     | Global, all projects |  N/A   |
|   [2]   | Project | `.claude/settings.json`       | Shared, committed    | Commit |
|   [3]   | Local   | `.claude/settings.local.json` | Personal, testing    | Ignore |

**Precedence:** Local > Project > User. Same-event hooks from all scopes run in parallel.

**Snapshot:** Hooks captured at startup; mid-session edits require `/hooks` review to reload.

---
## [3][IMPLEMENTATION]
>**Dictum:** *Deterministic and evaluative patterns require distinct execution modes.*

<br>

| [INDEX] | [TYPE]  | [USE_CASE]                       | [TIMEOUT] | [CHARACTERISTICS]            |
| :-----: | ------- | -------------------------------- | :-------: | ---------------------------- |
|   [1]   | command | Validation, formatting, rules    |   600s    | Deterministic, shell scripts |
|   [2]   | prompt  | Complex evaluation, LLM judgment |    30s    | Single-turn, context-aware   |
|   [3]   | agent   | Tool-using evaluation            |    60s    | Multi-turn, up to 50 turns   |

**Prompt/Agent Eligible Events:** PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, UserPromptSubmit, Stop, SubagentStop, TaskCompleted.

[CRITICAL] TeammateIdle does NOT support prompt or agent hooks — exit codes only.

**Prompt/Agent Response Schema:**
```json
{"ok": true}
{"ok": false, "reason": "Explanation shown to Claude"}
```

`ok: true` allows the action. `ok: false` blocks it with the provided reason.

**Command Hook Fields:**

| [INDEX] | [FIELD]         | [TYPE]  |   [DEFAULT]   | [EFFECT]                                  |
| :-----: | --------------- | ------- | :-----------: | ----------------------------------------- |
|   [1]   | `type`          | string  |       —       | `"command"`, `"prompt"`, or `"agent"`     |
|   [2]   | `command`       | string  |       —       | Shell command or script path              |
|   [3]   | `timeout`       | number  | type-specific | Seconds: command=600, prompt=30, agent=60 |
|   [4]   | `async`         | boolean |    `false`    | Background execution; non-blocking        |
|   [5]   | `statusMessage` | string  |       —       | Custom spinner text during execution      |
|   [6]   | `once`          | boolean |    `false`    | Run once per session (skills only)        |

**Prompt/Agent Hook Fields:**

| [INDEX] | [FIELD]  | [TYPE] | [DEFAULT]  | [EFFECT]                                       |
| :-----: | -------- | ------ | :--------: | ---------------------------------------------- |
|   [1]   | `prompt` | string |     —      | Instructions for LLM; `$ARGUMENTS` = hook JSON |
|   [2]   | `model`  | string | fast model | Model to use for evaluation                    |

---
## [4][SCRIPTING]
>**Dictum:** *Hook reliability requires functional pipeline patterns.*

<br>

Python 3.14+ with strict typing. Zero imperative patterns.

---
## [5][VALIDATION]
>**Dictum:** *Gates prevent incomplete artifacts.*

<br>

[VERIFY] Completion:
- [ ] Event: Selected correct hook type for automation goal.
- [ ] Blocking: Verified event supports blocking (7 events) or observing (8 events).
- [ ] Schema: Configuration structure validated per schema.md.
- [ ] Timeout: Correct units (seconds): command=600, prompt=30, agent=60.
- [ ] Integration: Environment variables and context injection applied.
- [ ] Scripting: Security patterns and tooling gates passed.
- [ ] Quality: JSON syntax valid, timeouts appropriate.

[REFERENCE] Operational checklist: [->validation.md](./references/validation.md)

Attribution

bsamieebsamiee
View sourceMore from bsamiee →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Screen Reader Testing

Practical guide to testing web applications with screen readers for comprehensive accessibility validation.

393431 votes

Python Testing

使用pytest、TDD方法、夹具、模拟、参数化和覆盖率要求的Python测试策略。

2456590 votes

Tdd Workflow

在编写新功能、修复错误或重构代码时使用此技能。强制执行测试驱动开发,包含单元测试、集成测试和端到端测试,覆盖率超过80%。

2456590 votes

Springboot Tdd

使用JUnit 5、Mockito、MockMvc、Testcontainers和JaCoCo进行Spring Boot的测试驱动开发。适用于添加功能、修复错误或重构时。

2456590 votes

Eval Harness

克劳德代码会话的正式评估框架,实施评估驱动开发(EDD)原则

2456590 votes
View all in testing →