/adr-kit:install-hooks [--uninstall]from adr-kit
Installs or removes the adr-kit pre-commit hook for ADR enforcement. Handles hook detection, backup, and git hooksPath configuration.
Ships in adr-kit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Reply in the language the user writes in; default to English. Keep command output, identifiers, paths, and ADR file content unchanged.
This is the hooks mode of /adr-kit:setup (spec R19: one entry point,
four modes). Invoked directly or via /adr-kit:setup hooks, the procedure
is identical -- this file owns it.
Use $ARGUMENTS only for --uninstall; empty means install. Reject all other
arguments.
You install or uninstall the adr-kit pre-commit hook in the project the user is currently in (pwd should be the project root).
ADR_KIT="${ADR_KIT_ROOT:-${CLAUDE_PLUGIN_ROOT}}"
[ -n "$ADR_KIT" ] || { echo "adr-kit: plugin root not found; set ADR_KIT_ROOT, or update or reinstall the plugin" >&2; exit 1; }
TEMPLATE="$ADR_KIT/templates/githooks/pre-commit"
If $TEMPLATE does not exist or is empty, exit with an error: the plugin install is broken; tell the user to reinstall via /plugin install adr-kit@rvdbreemen-adr-kit.
Three cases:
.githooks/pre-commit. Mkdir .githooks/, copy the template, chmod +x, set core.hooksPath. Done..githooks/pre-commit is byte-identical to the template. No-op. Tell the user it's already installed..githooks/pre-commit differs. Read both. Show the user the existing content (truncated to first 30 lines). Ask:
prepend adr-kit before existing — write a wrapper script that calls adr-kit then execs the original. Save the original as .githooks/pre-commit.adr-kit-saved.replace — overwrite. Save the old hook as .githooks/pre-commit.backup-<timestamp> for safety.abort — do nothing.
Apply the user's choice.Run git config core.hooksPath .githooks. Confirm with git config --get core.hooksPath. If the project already has core.hooksPath set to a different directory, do NOT overwrite — tell the user, ask whether to change the config or to symlink the hook into the existing hooks dir.
Print:
Pre-commit ADR judge installed.
- hook: .githooks/pre-commit (mode 755)
- core.hooksPath: .githooks
- disable a single commit: ADR_KIT_HOOK_DISABLE=1 git commit ...
- remove permanently: /adr-kit:install-hooks --uninstall
- LLM pass is opt-in (off by default). Enable per-project: judge.llm_enabled:true in docs/adr/.adr-kit.json. Enable one commit: ADR_KIT_LLM=1 git commit ...
- ADR-suggest is opt-in too: suggest.enabled:true, or ADR_KIT_SUGGEST=1 for one commit.
--uninstallWhen invoked as /adr-kit:install-hooks --uninstall:
.githooks/pre-commit. Verify it is the adr-kit hook (look for the line # adr-kit pre-commit hook near the top). If it is NOT the adr-kit hook, refuse — tell the user the hook in place isn't ours and we won't touch it..githooks/pre-commit.adr-kit-saved does not exist). Remove .githooks/pre-commit. If .githooks/ is now empty, remove it too. Run git config --unset core.hooksPath..githooks/pre-commit.adr-kit-saved → .githooks/pre-commit. Leave core.hooksPath set to .githooks..githooks/pre-commit.backup-<timestamp> exists (from a prior replace install). Tell the user the backup is there and ask whether to restore that instead. Apply choice.Pre-commit ADR judge uninstalled. (restored prior hook | removed .githooks/ | unset core.hooksPath)The ADR Guardian has two registration paths (spec §7):
SessionStart hook in its manifest. It auto-registers in every Claude Code session when the plugin is enabled globally, and self-guards (exits silently when no docs/adr/ with ADRs is present). This is the recommended path.SessionStart entry directly to the project's .claude/settings.json. Contained to this project only. Use when the user wants explicit per-project control or does not enable the plugin globally.When the user asks to add the guardian hook to the project's .claude/settings.json:
Read .claude/settings.json (create it as {} if missing).
Check if hooks.SessionStart already contains an entry whose command contains the string adr-guardian. If yes: print "Already installed" and stop.
If no SessionStart array exists: create it. Parse the JSON structurally — never do text substitution on a JSON file.
Append the hook object the plugin ships in its template to hooks.SessionStart[0].hooks (create the array path if absent):
ADR_KIT="${ADR_KIT_ROOT:-${CLAUDE_PLUGIN_ROOT}}"
[ -n "$ADR_KIT" ] || { echo "adr-kit: plugin root not found; set ADR_KIT_ROOT, or update or reinstall the plugin" >&2; exit 1; }
ENTRY="$ADR_KIT/templates/cc-settings/guardian-hook-entry.json"
Copy the object unchanged, _-prefixed keys included. adr-guardian reads its _wrapper_version stamp to report the copy as stale after the plugin updates, and its command ranks the installed versions portably (TASK-220). Never retype the command from memory: a hand-written copy loses both properties.
Write the updated JSON back. The existing SessionStart hooks (if any) are preserved byte-for-byte — only the new entry is appended.
Confirm: "Guardian hook added to .claude/settings.json. It will fire at the next session start."
When the user asks to remove the guardian hook from .claude/settings.json:
.claude/settings.json. Parse as JSON.hooks.SessionStart[*].hooks[*] whose command contains adr-guardian. If none found: print "Guardian hook not found in .claude/settings.json" and stop.hooks array becomes empty after removal, remove the empty array (but keep the parent SessionStart entry if other entries exist in other groups).Safety invariant: Never remove or modify any hook entry that does not contain adr-guardian in its command. This is the cozempic lesson — a remove that also clobbers unrelated hooks is worse than not removing at all.
After adding the guardian hook (project-scoped or as part of /adr-kit:init):
echo "docs/adr/.adr-kit-state.json" >> .gitignore
Verify it is not already present first (idempotent). The state file is per-machine and must never be committed.
The git hook judges one commit. Two gates that a hook cannot cover ship as
copyable workflows in templates/github-workflows/; offer them, do not install
them silently, because a workflow file is the project's business:
adr-judge.yml — judges the whole branch on every pull request. This is
what the reviewer is actually being asked to accept, and it uses the CI-sized
diff budget so raising it never weakens the commit-time gate.adr-readiness.yml — refuses to merge implementation that is linked to a
Proposed decision nobody accepted.adr-guardian-audit.yml — the weekly staleness sweep, reported into one
tracking issue.adr-index-check.yml — fails when the generated indexes no longer match
the ADRs. The commit hook can only warn about this, because it reads the
worktree while the commit is the staged snapshot; CI checks out the commit
itself, so it is the only place the block is honest.Copy on request into .github/workflows/, and tell the user the checkout must
use fetch-depth: 0 or the diff has only one side.
Note for Claude Code users: the branch is also judged before the pull request
exists, by the pre-tool guard on gh pr create. The workflow remains worth
installing anyway - it covers pushes from a laptop, a different client, and
anyone not working through an agent at all.
core.hooksPath only when needed. If the user already has it pointing at a custom dir, propose a symlink rather than redirecting their config.chmod +x the hook after writing — without the executable bit, git silently ignores it..githooks/, which the project may or may not have in .gitignore. Don't add it to git here; the user decides whether to track it.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub rvdbreemen/adr-kit --plugin adr-kit17 skills in this plugin
/adrCreate or review Architecture Decision Records. Use for ADRs, architecture decisions, durable trade-offs, new dependencies, contracts, or patterns./auditAre we still on course? Lint the decisions and judge the code in one run. Use for ADR audit, architecture drift, a whole-codebase compliance check, or a governance report. Read-only./contextFind ADRs relevant to a task before implementation. Use for ADR context, governing decisions, architecture constraints, or why a design exists. Read-only./grillInteractively complete, reconstruct, or revalidate Architecture Decision Records from repository facts, pull requests, git ranges, chat logs, or documents. Use when an ADR is Proposed, rationale or alternatives are uncertain, shipped code needs a decision record, or an Accepted decision may need supersession or retirement.Other plugins' skills for the same job