bootstrapping-hooks

Surveys a repository and scaffolds captain-hook guardrails with inline-tested Python hooks.

13|Updated Jun 2, 2026
One-click install
npx skills add https://github.com/yasyf/captain-hook --skill bootstrapping-hooks-yasyf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bootstrapping-hooks
Source: https://github.com/yasyf/captain-hook/tree/main/captain_hook/skills/bootstrapping-hooks
Command: npx skills add https://github.com/yasyf/captain-hook --skill bootstrapping-hooks-yasyf

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Teams repeatedly correct AI coding agents for the same mistakes — force-pushes, skipped tests, wrong package managers — because those conventions live in docs the agent never reads. This Skill turns a repository's own CONTRIBUTING.md, CI workflows, lint configs, and git history into enforced Claude Code hooks so violations are blocked or flagged before they run. ## Core Features & Use Cases - Repository survey and candidate mining: Reads docs, CI workflows, lint configs, task runners, and git history, then maps every signal onto a taxonomy of command-safety, code-quality, test-integrity, and workflow-ritual hooks. - Approval-first hook authoring: Proposes categorized candidates with source quotes via an interactive menu, writes nothing before user approval, then delegates drafting to the authoring-hooks skill with one file per category. - Inline-tested verification: Every deterministic hook ships with inline tests and must pass uvx --isolated capt-hook test before the final report; scaffolds the framework and enables the session reviewer up front. - Use Case: Point it at a repo whose CONTRIBUTING.md says "always run make lint before pushing" and it proposes a blocking PreToolUse gate on git push, writes .claude/hooks/workflow.py with tests, and verifies them green. ## Quick Start Ask the agent to set up captain-hook guardrails for this repository and approve the proposed hooks when prompted.

Frequently Asked Questions about bootstrapping-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Claude Code hooks for my repository?

Run the bootstrapping workflow: it scaffolds .claude/hooks/ with capt-hook init, surveys your docs and CI for conventions, proposes hooks for approval, then writes tested Python hook files. Verification runs via uvx --isolated capt-hook test.

How do I block force-push or rm -rf in Claude Code?

Use the block_command primitive in a captain-hook Python file under .claude/hooks/, declaring the command pattern, a reason, and inline tests. The hook fires at PreToolUse so the blocked command never executes.

Does captain-hook work with non-Python repositories?

Yes, hooks are always written in Python regardless of the target repo's language. Conditions like Command and FilePath are language-agnostic; only AST-based lint rules are Python-specific.

What happens to existing hooks when bootstrapping captain-hook?

If .claude/hooks/ already contains capt-hook hooks, the workflow switches to additive mode: existing files are never overwritten, new categories go in new files, and the proposal menu only offers candidates not already covered.

Why do some captain-hook hooks ship without inline tests?

LLM-based hooks (llm_gate, llm_nudge, prompt_check) and signal-scored nudges skip tests because inline tests would only exercise a stubbed model. Deterministic hooks must always ship at least one firing Input and one Allow case.