ProSkillsLibraryFreePassScan
Agent Ops

Agent Ops · agent skill

Hook Smith

Hooks and CI checks the agent can't skip.

What it does

Loads when it is needed

Your agent loads it when a rule must always run or must never be broken. It carries 5 rules and reads a profile.md with your details before it starts, so the output matches your brand and project.

Same prompt, with and without

Block generated edits, test on stop

Prompt · The agent keeps hand-editing our generated client and says it's done while tests are red. Set up guardrails.

src/generated/ is the output of `npm run generate` (from openapi.yaml).
Tests: `npm test` (vitest, about 25s).
Last week the agent hand-edited src/generated/client.ts, and twice reported done with failing tests.
Existing .claude/settings.json has no hooks.

Profile used: Agents: Claude Code; Project: acme-sdk, TypeScript API client generated from openapi.yaml; Stack: TypeScript, npm, vitest, prettier; Team size: 6

Without the skill
Add this to `.claude/settings.json` (project file, so all 6 teammates get it). ```json { "hooks": { "PreToolUse": [ { "matcher": "Edit|Write|MultiEdit", "hooks": [{ "type": "command", "command": ".claude/hooks/block-generated.sh" }] } ], "Stop": [ { "hooks": [{ "type": "command", "command": ".claude/hooks/test-on-stop.sh" }] } ] } } ``` `.claude/hooks/block-generated.sh`: ```bash #!/bin/bash f=$(jq -r '.tool_input.file_path // ""') case "$f" in *src/generated/*) echo "src/generated is generated. Edit openapi.yaml and run npm run generate." >&2 exit 2 ;; esac exit 0 ``` `.claude/hooks/test-on-stop.sh`: ```bash #!/bin/bash input=$(cat) [ "$(echo "$input" | jq -r '.stop_hook_active')" = "true" ] && exit 0 if ! out=$(npm test 2>&1); then echo "Tests failing, fix before finishing:" >&2 echo "$out" | tail -30 >&2 exit 2 fi ``` Exit code 2 blocks the edit or the stop and feeds stderr back to the agent. Make both scripts executable. Tests take about 25s, so every stop pays that cost.
With the skill
Team of 6, so shared config in .claude/settings.json: agent hooks for instant feedback, CI as the backstop. protect-paths: before Edit, Write, MultiEdit. Exit 2 for src/generated/, env and key files, package-lock.json. Reads only the path, writes nothing, no network. Undo: delete the PreToolUse entry. tests-before-stop: on Stop. If the tree changed, runs `npm test` (120s timeout); on red exits 2 with the last 30 lines. Exits 0 when stop_hook_active is true, so it cannot loop. No network. Undo: delete the Stop entry. Tests run: file_path src/generated/client.ts -> "Blocked edit to src/generated/client.ts: Generated code. Edit openapi.yaml and run npm run generate." exit 2 file_path src/client.ts -> exit 0 {"stop_hook_active":true} -> exit 0 Not yet run: the red-tests path, which needs uncommitted changes. Run it once by hand. Diff to .claude/settings.json, waiting for your yes: + "PreToolUse": [{ "matcher": "Edit|Write|MultiEdit", "hooks": [{ "type": "command", "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/protect-paths.mjs\"" }] }], + "Stop": [{ "hooks": [{ "type": "command", "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/tests-before-stop.mjs\"", "timeout": 150 }] }] Backstop: a CI job running `npm test` and failing on src/generated changes without an openapi.yaml change. Still advisory only: keeping PRs small.

Both answers from the same model (Claude sonnet), 2026-10-16. The one without the skill was written in a separate session that never saw it. Shortened where marked with …

Install

One command, in your project

It detects your agent; add --agent all for every agent.

npx proskills-cli add hook-smith --order <order id from your receipt>

Or copy the skill folder (the one holding SKILL.md) into the directory your agent reads, then restart it or start a new session.

AgentThis projectEvery project
Claude Code.claude/skills/~/.claude/skills/
Cursor.agents/skills/ (or .cursor/skills/)~/.cursor/skills/
Codex.agents/skills/~/.agents/skills/
Gemini CLI.agents/skills/ (or .gemini/skills/)~/.gemini/skills/

Changelog

What changed

  • v1.0.0 · 2026-10-16
    • First versioned release: Hooks and CI checks the agent can't skip.
    • Scanned 100/100 before release.

Keep it current with npx proskills-cli update; your profile.md is never touched. Everyone who bought it gets the update free and an email when it lands.

Same collection

More from Agent Ops

The scan checks spec compliance, token cost, clarity and security patterns. A clean scan is not a guarantee: static scanners can be evaded. Scan any skill yourself.