Skip to content
Agentmart
Submit a tool

create-hook

Use when creating, editing, or auditing hooks.

Skill by tyjpark0317

IndexedMIT★ 1
Write a review

Chalk Labs

Need help deploying create-hook?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

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/tyjpark0317-create-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.

We use your email only for this newsletter. Privacy

About

Use when creating, editing, or auditing hooks. Enforces diagnostic message standards, timeout rules, and security patterns. Triggers on "create hook", "modify hook", "edit hook", "improve hook", "add hook".

Use cases: security, writing

No 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/create-hook

What's inside

Skill name
create-hook
Description
Use when creating, editing, or auditing hooks. Enforces diagnostic message standards, timeout rules, and security patterns. Triggers on "create hook", "modify hook", "edit hook", "improve hook", "add hook".
License
MIT
Instructions
242 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

## Create/Modify Hook — Production-Grade Hook Engineering

All hooks are **fail-open** — timeout means silent pass. Quality = system stability.

> bash script based (no Python dependency).

---

## Step 1: Behavior Analysis — What to Block

### 1A: Explicit Request
User specifies the behavior to block → proceed to Step 2.

### 1B: Conversation Analysis
If the request is ambiguous, detect patterns from recent conversation:
- Behaviors the user corrected or reverted
- Repeated mistakes (same hook bypassed 2+ times)
- Frustration signals

Confirm detected patterns with user before proceeding.

---

## Step 2: Hook Design

### Event + Matcher Decision

| Event | Matcher | Purpose |
|-------|---------|---------|
| PreToolUse | Bash | Command blocking/warning |
| PreToolUse | Edit\|Write | File modification control |
| PreToolUse | Agent | Agent spawn control |
| PreToolUse | TeamCreate | Team creation control |
| PreToolUse | TaskUpdate | Task status change control |
| PostToolUse | Bash | Post-commit checks |
| PostToolUse | Edit\|Write | Post-modification audit |
| SubagentStop | (all) | Agent exit report verification |
| Stop | (all) | Session end checks |
| SessionStart | (all) | Session initialization |

### Action Type Decision

| Type | exit code | Behavior | Purpose |
|------|-----------|----------|---------|
| BLOCK | `exit 1` | Stop tool call | Rule violation blocking |
| HARD BLOCK | `exit 2` | Stop tool call | Severe violation blocking |
| WARNING | `exit 0` + stdout | Proceed with tool call | Warning only |
| PASS | `exit 0` (silent) | Proceed with tool call | Normal pass |

> **timeout exceeded = fail-open** — tool call proceeds. Hook is neutralized.

---

## Step 3: Code Writing

### Required Template

```bash
#!/usr/bin/env bash
# Hook: {name} — {one-line description}
# Trigger: {PreToolUse|PostToolUse|SubagentStop|Stop} -> {matcher}
# Action: {BLOCK|HARD BLOCK|WARNING|PASS}
# Created: {YYYY-MM-DD}

INPUT=$(cat)

# === PARSE ===
# Use printf '%s' (shell injection prevention — never echo "$VAR")
FIELD=$(printf '%s' "$INPUT" | jq -r '.tool_input.field // empty')

# === FAST EXIT ===
# Most calls are irrelevant → pass quickly
if [ -z "$FIELD" ]; then
  exit 0
fi

# === VALIDATE ===
# Validation logic...

# === BLOCK (4-field diagnostic message) ===
cat >&2 <<EOF
BLOCKED: {one-line summary}
HOOK: {filename}.sh
ATTEMPTED: {what was tried — tool, parameters, target}
REASON: {why blocked — specific rule/Standing Order violated}
FIX: {how to resolve — specific command or steps}
EOF
exit 1
```

### 4-Field Diagnostic Message (Required on BLOCK)

All BLOCK/HARD BLOCK messages must include:

| Field | Purpose | Example |
|-------|---------|---------|
| `BLOCKED:` | One-line summary | "C-Suite spawned without team" |
| `HOOK:` | Which hook | "layer3-gate.sh" |
| `ATTEMPTED:` | What was tried | "Agent(subagent_type=cto, team_name=none)" |
| `REASON:` | Why blocked | "Standing Order #1: All C-Suite must spawn in team" |
| `FIX:` | How to fix | "TeamCreate('exec-cto') then pass team_name" |

### Security Rules

```bash
# DO — use printf '%s'
ATYPE=$(printf '%s' "$INPUT" | jq -r '.tool_input.subagent_type // empty')

# DON'T — never use echo (injection vector)
# ATYPE=$(echo "$INPUT" | jq -r '.tool_input.subagent_type // empty')

# DO — quote all variables
if [ -f "$ROOT/.claude/agents/$AGENT.md" ]; then

# DON'T — never eval/exec external input
# eval "$USER_INPUT"
```

---

From tyjpark0317/enterprise-os, MIT.

More from tyjpark0317/enterprise-os

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Mar 29, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from tyjpark0317

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get create-hook running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying create-hook?

CallGet help
Cite this page

create-hook skill. Agent Mart. https://agentmart.dev/skills/tyjpark0317-create-hook (last updated 2026-10-24)