wdm0006/python-skills/git-hygiene
Claude Code and agent skill by wdm0006/python-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Prevents, detects, and remediates files that should never be committed — secrets (.env, API tokens, hardcoded credentials) and dev artifacts (build output, scratch databases, editor/OS files). Covers .gitignore (and why it does not untrack), git rm --cached, auditing tracked files, history scrubbing, and credential rotation. Use when a repo has committed secrets or junk, when setting up a new repo's ignore rules, or when reviewing what a repo actually tracks.
Install
npx vskill@latest install wdm0006/python-skills/git-hygieneSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Keeping Git Repos Clean
Two classes of files keep ending up in repos: secrets and dev artifacts. Both are cheap to prevent and expensive to clean up after the fact, because git history is forever and public repos publish everything.
The one rule everyone forgets
`.gitignore` does NOT untrack files that are already committed. Adding a path to .gitignore only prevents future untracked files from being staged. A file git is already tracking keeps getting committed regardless. This bites repeatedly: a .env is listed in .gitignore but was committed before the rule existed, so it keeps shipping.
To actually stop tracking a file while keeping your local copy:
--cached is the important flag — plain git rm deletes the working copy too.
Audit what a repo actually tracks
Don't trust .gitignore to tell you what's clean — read the index directly:
Usual suspects seen across real repos:
- Secrets:
.envwith a live token, hardcodedAWS_*/DB creds in a settings
module, SECRET_KEY = "CHANGEME"/"foobar" placeholders shipped to prod.
- Build artifacts: LaTeX
.aux/.toc/.log/.synctex.gz/.pdf, LLVM*.profraw,
compiled binaries, htmlcov/, dist/, *.egg-info/.
- Scratch / personal artifacts:
todo.dband other tool-local SQLite scratch
DBs, editor backups (*.backup, *.bak, ~$*.docx Word lock files), stray *.log.
- OS noise:
.DS_Store,Thumbs.db.
Secrets need more than git rm
Removing a secret from HEAD does not remove it from history — git log -p and the commit that introduced it still expose it. Three things must happen, in order, and the first is the only one that actually protects you:
- Rotate the credential. Treat any secret that ever touched a remote as
compromised. Issue a new token/key/password and revoke the old one. Do this first — the leaked value is public the moment it was pushed.
- Untrack going forward (
git rm --cached+.gitignore+.env.example
documenting which vars are needed, with placeholder values only).
- Scrub history if required (
git filter-repo --invert-paths --path .env,
or BFG) and force-push. This rewrites SHAs and disrupts collaborators, so it's usually a deliberate maintainer step done after rotation — not an automated PR.
A PR that does (2) and (3) but skips (1) gives false comfort: the value is still valid and still in history clones/forks. Always call out rotation as the required human follow-up.
"Committed" means "published"
For public repos — and especially static sites deployed with path: '.' (GitHub Pages uploads the entire repo) — every tracked file is fetchable at a public URL. A scratch todo.db at the repo root of a brochure site is served at /todo.db. Before committing to any public repo, assume anyone can download it.
Prevent it: global ignore + a secret scanner
Per-developer noise (editor files, OS files, tool scratch DBs like todo.db) should be ignored globally, not in every project's .gitignore — that way it never lands anywhere:
Block secrets at commit time with a pre-commit hook so they never reach history:
A starter project .gitignore (commit this):
Verification can dirty the tree
Compilers, test runners, and asset pipelines often write into the checkout even when the command is only meant to verify a change. They may create unignored cache files or regenerate a tracked distributable such as a PDF or compiled CSS. A green command does not mean the working tree still contains only your change.
Bracket verification with status checks and stage only reviewed paths:
If a tool necessarily produces noisy output, run it in a disposable copy of the checkout. This preserves a real build while keeping generated files away from the patch:
When verification modifies a tracked generated output that is intentionally out of scope, restore that exact path only after reviewing its diff:
Do not use a broad restore/reset to clean up: the checkout may already contain someone else's work. Also do not rely on git stash as cleanup for untracked artifacts; ordinary stashes omit them, and even --include-untracked can collide with files regenerated before stash pop. Prevent or remove known generated paths explicitly instead.
Checklist
For scanning source code for vulnerabilities and hardcoded-secret patterns, see the auditing-python-security skill — this skill is about what git tracks.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/common/git-hygiene/SKILL.md
Popularity
- Repository stars
- 95
- Repository forks
- 14
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
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/wdm0006/python-skills/git-hygiene)