install-hooks

Installs git-native hooks into a repository to enforce commit and push guardrails.

4|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/laicluse/agent-fieldkit --skill install-hooks-laicluse
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: install-hooks
Source: https://github.com/laicluse/agent-fieldkit/tree/main/.agents/plugins/generated/git-discipline/skills/install-hooks
Command: npx skills add https://github.com/laicluse/agent-fieldkit --skill install-hooks-laicluse

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Claude Code's PreToolUse guard only covers commits made through the agent; commits and pushes made directly from the shell or an IDE bypass those checks entirely. This Skill closes that gap by installing git-native hooks (pre-commit, commit-msg, prepare-commit-msg, post-commit, post-rewrite, pre-push) into the current repository so every commit path gets the same validation. ## Core Features & Use Cases - Idempotent hook installation: Copies hook scripts into the repo's hooks directory, skipping identical files and refusing to overwrite conflicting ones unless --force is passed (which creates timestamped backups first). - Smart path resolution: Detects repo-local core.hooksPath, creates a repo-local override when a global hooks path is inherited, and bakes the absolute plugin install path and Node.js executable into each hook. - Dry-run and conflict reporting: --dry-run previews every action without writing, and conflicts produce a unified diff so you can review before replacing. - Use Case: After installing the git-discipline plugin, run this Skill in each repository so that commits made from your IDE or terminal are validated by the same validate-body.sh logic as agent-driven commits, and re-run with --force after every plugin update to refresh the baked-in paths. ## Quick Start Ask the agent to run /git-discipline:install-hooks in the current repository to install the git hooks, optionally with --dry-run to preview or --force to overwrite existing hooks.

Frequently Asked Questions about install-hooks

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

FAQPage Schema
How do I install git hooks for commit message validation in a repo?▼

Run /git-discipline:install-hooks inside the repository. It copies pre-commit, commit-msg, prepare-commit-msg, post-commit, post-rewrite, and pre-push hooks into the repo's hooks directory, sets the executable bit, and bakes in the plugin path.

How do I preview git hook installation without changing files?▼

Run the skill with the --dry-run flag. It prints which hooks would be installed, the target hooks directory, and any core.hooksPath change it would make, without writing anything to disk.

What happens when a git hook already exists with different content?▼

The installer prints a unified diff between the existing hook and the new version, refuses to overwrite, and exits with status 1. Re-run with --force to create a timestamped backup and replace the hook.

Does the installer work with a custom core.hooksPath configuration?▼

Yes. A repo-local core.hooksPath is used as the install target. An inherited global core.hooksPath is never modified; instead the installer sets a repo-local override pointing at the repo's own hooks directory.

Why do I need to re-run install-hooks after a plugin update?▼

Each installed hook has the absolute plugin path baked in at install time. After an update or reinstall that path may be stale, so run /git-discipline:install-hooks --force in every repo to refresh it with automatic backups.

Can I bypass the installed git hooks in an emergency?▼

Yes, git commit --no-verify bypasses the git-native hooks, but the installed post-commit hook logs every such usage to a file under ~/.laicluse/git-discipline/ so bypasses remain reviewable after the fact.