setup-hooks

Generates and refreshes stack-specific Claude Code format-on-edit hooks for a repository.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/Sassy-Dog/sassydog-skills --skill setup-hooks-sassy-dog
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-hooks
Source: https://github.com/Sassy-Dog/sassydog-skills/tree/main/skills/setup-hooks
Command: npx skills add https://github.com/Sassy-Dog/sassydog-skills --skill setup-hooks-sassy-dog

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, shellcheck, and includes scripts (resource) and references (resource) components.

What problem does it solve? Formatting and lint feedback often arrives too late — in PR review — instead of at edit time, and hand-written per-repo hooks drift out of sync as a project's stack evolves. This Skill inspects a repository's actual toolchain, renders a tailored PostToolUse formatter/linter dispatcher plus a stray-artifact guard, wires them into .claude/settings.json, and reconciles everything on re-runs. ## Core Features & Use Cases - Stack detection probe: Runs scripts/detect-hook-stack.sh to detect ruff, prettier, markdownlint, shellcheck, dart, rustfmt, gofmt, and dotnet-format from repo config evidence (never from what happens to be installed locally), including monorepo-safe manifest matching and vendored-path exclusion. - Template-based rendering: Renders .claude/hooks/sassydog-post-edit.sh and sassydog-artifact-guard.sh from conditional templates — formatters fix silently, linters with unfixable findings exit 2 so findings feed back immediately. - Surgical settings merge: Adds or removes only the hook entries it owns (those referencing .claude/hooks/sassydog-), never touching hand-written hooks or unrelated settings keys, with a preview-then-approve gate before any write. - Use Case: A team adopts ruff and markdownlint mid-project; re-running the Skill refreshes the generated dispatcher to route *.py and *.md edits through the new tools, pins markdownlint-cli2 to the version CI enforces, and normalizes legacy ownership markers. ## Quick Start Ask the agent to set up the sassydog format-on-edit hooks for this repository and approve the rendered scripts and settings diff it shows you.

Frequently Asked Questions about setup-hooks

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

FAQPage Schema
How do I set up format-on-edit hooks in Claude Code for my repo?

Run the setup-hooks generator from inside the target repository. It probes your stack, renders a PostToolUse dispatcher under .claude/hooks/, wires it into .claude/settings.json, and writes only after you approve the full preview.

How does the hook decide which formatters and linters to run?

Detection is based on repo evidence — config files like ruff.toml, .prettierrc, or .markdownlint-cli2.jsonc, plus tracked file types — never on what is installed locally. Each rendered route also self-guards with command -v so missing tools degrade to a no-op.

Can I re-run the hook generator after my repo's stack changes?

Yes, it is designed to be re-runnable. Refresh mode re-detects the stack, re-renders the scripts, reconciles only the settings entries it owns, and normalizes legacy generated-by markers from older plugin versions.

Why does the markdownlint hook sometimes render without blocking behavior?

When no markdownlint-cli2 version pin is found in CI workflows, scripts, Makefile, justfile, or package.json, the route renders fix-only. Blocking on rules CI does not enforce would train users to ignore the exit-2 signal, so pinning the version restores the blocking half on the next refresh.

Will the generator overwrite my hand-written hooks or settings?

No. It only touches scripts matching .claude/hooks/sassydog-*.sh with a recognized generated-by header and settings entries whose command references that path. All other hooks and settings keys are left untouched, and every write requires your approval.