musingfox/cc-plugins/hook-guard
Claude Code and agent skill by musingfox/cc-plugins
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"},{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
Set up, diagnose, or update a project's git pre-commit and commit-msg scripts, with security checks and code-quality gates that run for every committer, Claude Code included. Covers first-time installation, a "hook doctor" check on an existing setup, and regenerating hooks after the project's tooling changes.
Install
npx vskill@latest install musingfox/cc-plugins/hook-guardSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as musingfox/cc-plugins/hook-guard.
Hook Guard
Dispatch by user intent:
- Setup — install is missing or user asks to set up / configure / initialize
- Doctor — user asks to check / diagnose / verify / troubleshoot
- Update — install exists and user asks to update / refresh / regenerate / sync
If ambiguous: if .githooks/pre-commit exists → default to Doctor; otherwise → Setup.
Read references/settings.md for the user-override schema (.claude/hook-guard.local.md) — applies to all three modes.
Setup
Skip if the user only wants to edit existing hooks. If jj-native only (no .git/), abort — pre-commit hooks not supported.
- Detect — follow
references/detection.md. Collect: languages, toolchain, VCS, existing hooks, monorepo. If existing hooks found, ask merge / replace / abort. - Recommend — read
.claude/hook-guard.local.mdif present. Present summary grouped by: pre-commit security / integrity / structure, pre-commit quality (lint / format / test), commit-msg. Ask to confirm. - Generate:
.githooks/pre-commitfromreferences/pre-commit-checks.md— only enabled checks, real tool commands substituted.chmod +x..githooks/commit-msgfromreferences/commit-msg.mdif enabled.chmod +x.- Run
git config core.hooksPath .githooks. - Ensure
.claude/*.local.mdgitignored.
- Verify —
bash -n .githooks/pre-commit, then in a scratch repo (git initin a temp dir,core.hooksPathpointing at the generated hooks) stage one clean file and one that trips a warning (e.g. trailing whitespace), and run the hook. Expect exit 0 with the warning printed. Any syntax error, unreplaced placeholder, or unexpected failure: return to Generate. - Summary — files touched, onboarding cmd (
git config core.hooksPath .githooks), mention Doctor / Update modes.
Doctor
Run all checks, present a status table (✓ / ✗ / ⚠ / ℹ), then offer auto-fix for FAIL/WARN.
- `git config core.hooksPath` — must equal
.githooks. Unset = FAIL. Other = WARN. - Hook files —
.githooks/pre-commitand (if conventional commits).githooks/commit-msg: exist + executable. - Legacy Claude skip — older hook-guard installs skip lint / format / test when
CLAUDECODEis set and hand them to.claude/settings.local.jsonhooks that read$CLAUDE_TOOL_ARG_*, a variable Claude Code never sets, so Claude's commits go unchecked.grep -q 'CLAUDECODE' .githooks/pre-commitorgrep -q 'CLAUDE_TOOL_ARG_' .claude/settings.local.json= FAIL. - Tools — grep pre-commit for tool names (ruff, eslint, prettier, gitleaks, jq, python3…);
command -veach. - Settings file — validate
.claude/hook-guard.local.mdfrontmatter (schema inreferences/settings.md); warn on unknown fields. - (Optional) Dry-run — offer to execute
.githooks/pre-commiton current tree.
Output ends with Result: N/M checks passed.
Remediation:
| Issue | Fix | |
|---|---|---|
| core.hooksPath not set | git config core.hooksPath .githooks | |
| Hook not executable | chmod +x .githooks/<file> | |
| Tool missing | Suggest platform install | |
| Legacy Claude skip | Delete the SKIP_* lines and their guards from pre-commit; delete those hooks and env.CLAUDECODE from .claude/settings.local.json |
Update
- Verify install —
.githooks/pre-commitexists. Otherwise → Setup. - Re-detect —
references/detection.md; read overrides from.claude/hook-guard.local.md. - Diff — parse existing pre-commit script; identify added / removed / changed tools or languages.
- Present — diff-style summary; ask to confirm.
- Apply surgically:
.githooks/pre-commit: replace only changed check-function bodies (canonical inreferences/pre-commit-checks.md); insert/remove checks in correct section; preserve structure, config vars, helpers.- Preserve user overrides throughout.
- Post-update — summarize; suggest running Doctor.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinghook-guard/skills/hook-guard/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
hookPre/post lifecycle hooksconfigConfiguration overrides
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/musingfox/cc-plugins/hook-guard)