$npx -y skills add alexei-led/cc-thingz --skill configuring-git-hygieneSet up project-local git hygiene. Keep hooks fast enough to stay enabled. Do not overwrite hooks, change global config, remove tracked files, or install tools without user approval.
| 1 | # Configure Git Hygiene |
| 2 | |
| 3 | Set up project-local git hygiene. Keep hooks fast enough to stay enabled. Do not overwrite hooks, change global config, remove tracked files, or install tools without user approval. |
| 4 | |
| 5 | ## Scope |
| 6 | |
| 7 | Use this skill for: |
| 8 | |
| 9 | - Git hook setup or migration to a project hooks directory. |
| 10 | - Staged-file pre-commit checks. |
| 11 | - Full pre-push validation. |
| 12 | - Gitleaks secret scanning. |
| 13 | - `.gitignore` rules and tracked-file cleanup. |
| 14 | - Local git config such as `core.hooksPath`, `includeIf`, signing, pull behavior, and pruning. |
| 15 | |
| 16 | Do not use this skill for: |
| 17 | |
| 18 | - Commit grouping or commit messages — use `committing-code`. |
| 19 | - Worktree creation — use `using-git-worktrees`. |
| 20 | - Branch/worktree cleanup — use `cleanup-git`. |
| 21 | |
| 22 | ## Step 1: Inspect Current State |
| 23 | |
| 24 | Run read-only checks first: |
| 25 | |
| 26 | ```bash |
| 27 | git rev-parse --show-toplevel |
| 28 | git status --short |
| 29 | git config --show-origin --get core.hooksPath || true |
| 30 | git config --show-origin --list | rg '^(file:.*\s+)?(user\.|commit\.|tag\.|pull\.|fetch\.|rerere\.|core\.hooksPath|includeIf\.)' || true |
| 31 | git ls-files .gitignore .pre-commit-config.yaml .gitleaks.toml 2>/dev/null || true |
| 32 | ls -la .git/hooks .githooks scripts/git-hooks 2>/dev/null || true |
| 33 | ``` |
| 34 | |
| 35 | If a hook framework already exists, extend it. Do not replace it. |
| 36 | |
| 37 | ## Step 2: Load Focused References |
| 38 | |
| 39 | - Hook files or `core.hooksPath` changes: read [hooks.md](references/hooks.md). |
| 40 | - Gitleaks setup or secret scanning: read [gitleaks.md](references/gitleaks.md). |
| 41 | - `.gitignore` or `git rm --cached`: read [gitignore.md](references/gitignore.md). |
| 42 | |
| 43 | ## Step 3: Propose Before Editing |
| 44 | |
| 45 | State current facts, proposed files/config, verification, and risks. Ask before: |
| 46 | |
| 47 | - writing or replacing hook files |
| 48 | - running `git config --local` or any global config command |
| 49 | - running `chmod` |
| 50 | - running `git rm --cached` |
| 51 | - choosing skip-vs-fail behavior for missing tools |
| 52 | |
| 53 | ## Step 4: Apply Safely |
| 54 | |
| 55 | Rules: |
| 56 | |
| 57 | - Prefer existing project convention, then `pre-commit`, then project-local `core.hooksPath`. |
| 58 | - Use project-local config for shared repos: `git config --local core.hooksPath scripts/git-hooks`. |
| 59 | - Keep pre-commit staged/affected-file only; do not run full tests, full builds, installs, or network calls there. |
| 60 | - Put full build/test/type/lint validation in pre-push. |
| 61 | - Redact secret-scan output. Never paste secret values into external tools. |
| 62 | - Use narrow `.gitignore` patterns derived from actual artifacts. |
| 63 | - Do not auto-commit from hooks unless the project already has that convention. |
| 64 | |
| 65 | ## Step 5: Verify |
| 66 | |
| 67 | Run the narrowest proof for the changed component: |
| 68 | |
| 69 | - Hook path/config: `git config --local --get core.hooksPath` and direct hook execution with safe fixture input when possible. |
| 70 | - Gitleaks: staged or repo scan command with `--redact` when the tool is available. |
| 71 | - `.gitignore`: `git check-ignore -v <path>` and `git ls-files <path>` for affected files. |
| 72 | - Hook scripts: project shell lint/format/test gate when available. |
| 73 | |
| 74 | ## Output |
| 75 | |
| 76 | ```text |
| 77 | GIT HYGIENE CONFIG |
| 78 | ================== |
| 79 | Scope: hooks | gitleaks | gitignore | config | guardrails |
| 80 | Status: PROPOSED | APPLIED | BLOCKED |
| 81 | |
| 82 | Current state: |
| 83 | - <facts from git config/files> |
| 84 | |
| 85 | Plan: |
| 86 | - <change and why> |
| 87 | |
| 88 | Changes: |
| 89 | - <file/config edited> |
| 90 | |
| 91 | Verification: |
| 92 | - <command> — pass/fail/not run |
| 93 | |
| 94 | Next: |
| 95 | - <install tool, run hook, or push validation> |
| 96 | ``` |
| 97 | |
| 98 | ## Failure Handling |
| 99 | |
| 100 | - Not a git repo: say so and stop. |
| 101 | - Existing hook would be overwritten: stop and merge manually. |
| 102 | - Tool missing: ask whether the hook should fail closed or skip with a clear message. |
| 103 | - Dirty repo before hook/config edits: show `git status --short` and ask before proceeding. |
| 104 | - Hook blocks legitimate work: diagnose and tune the hook; do not recommend `--no-verify` as the fix. |