git-workflows/skills/troubleshoot-precommit/SKILL.md
Troubleshoot pre-commit hook failures and auto-fixes
npx skillsauth add jacobpevans/claude-code-plugins troubleshoot-precommitInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Diagnose and fix pre-commit hook issues that occur when committing code.
This error looks like:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
markdownlint-cli2........................................................Failed
- hook id: markdownlint-cli2
- files were modified by this hook
What happened: Pre-commit hooks auto-corrected formatting issues. The fixes weren't committed automatically.
Pre-commit hooks run BEFORE your commit. If they auto-fix files, your staged changes no longer match your working directory. Git stops to let you review the changes.
Stage the auto-fixed files and amend the commit:
git add -A
git commit --amend --no-edit
git push origin <branch>
If this happens during a rebase operation:
# In the worktree where the rebase is running:
git add -A # stage the hook changes
git commit --amend --no-edit # update the current commit in the rebase
git rebase --continue # continue the rebase
# After the rebase finishes:
git push origin <branch> # push the rebased branch
If hooks keep modifying files in a loop:
git diff # See what changed
git diff HEAD~1 # See what the hook is trying to fix
| Hook | Fixes |
| --- | --- |
| trim-trailing-whitespace | Removes spaces at end of lines |
| end-of-file-fixer | Ensures files end with newline |
| markdownlint-cli2 | Fixes markdown formatting |
| prettier | Reformats code/JSON/YAML |
| eslint with --fix | Fixes JavaScript/TypeScript issues |
git commit --no-verify to skip hookstools
Use when installing or choosing CLI tools in a Nix flake repo, editing flake.nix or home-manager config, or when tempted to pip/pipx/uv/brew/npm install anything. Tools come from the dev shell or nix shell — never ad-hoc package managers.
testing
Use when creating or editing GitHub Actions workflows that call reusable workflows (uses: OWNER/repo/.github/workflows/...) — org owner references must be the literal current org, and shared-CI homes are under dryvist.
development
Use when adding or editing .pre-commit-config.yaml, wiring pre-commit hooks into a repo, scaffolding a new repo's lint/hook setup, or deciding where a hook or shared lint config should live. Covers the canonical nix-devenv/dryvist-.github architecture, profiles, and consumer patterns.
testing
Check PR merge readiness, sync local repo, cleanup stale worktrees; optional cross-repo sweep and stale-branch prune modes