agentleFS
DonemebDonemeb/Donemeb-Skills/skills/software-engineering/repo-hygiene/SKILL.md

repo-hygiene

Skill0 starsChanged 3 months agoMITView on GitHub

Version control hygiene — identify and clean content that shouldn't be in the repo: third-party source, decompiled/generated artifacts, nested repos, local config files, large binaries, secrets. Quarantine before commit. Covers the 'tracked vs untracked ignore' gotcha. Use when the user says 'about to commit', 'why isn't gitignore working', 'repo has large files / third-party code / submodules', 'confirm clean before new dev'.

  • Reads credentials

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use systematic-debugging.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenAISkill

    systematic-debugging

    Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before starting new dev, confirm the repo is clean.

    line 17
  2. Very specific:

    Use trailing slash path/ for directories, no trailing slash for files.

    line 58
  3. Distinctive:

    No untracked files waiting to be added (except local references).

    line 75
  4. Very specific:

    After adding ignore rules, the decompiled directory still showed up → ls-files revealed it was already tracked (~14,000 files) → ignore was …

    line 87

“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

repo-hygiene — Version Control Hygiene

When to use

  • About to commit and want to confirm nothing improper slipped in.
  • "gitignore rule added but it's not working".
  • Found third-party code / decompiled artifacts / nested repos / large files / secrets / personal local config in the repo.
  • Before starting new dev, confirm the repo is clean.

When NOT to use

  • Active feature work — this is end-of-work cleanup, not in-flight changes.
  • Pure formatting / linting issues — use the appropriate tools.

Output

A clean repo: no improperly committed content, reasonable commit granularity, ignore rules working correctly.

The core gotcha (memorize this first)

Ignore rules only affect untracked files. Adding ignore to an already-tracked file has no effect — you must first remove it from tracking (keeping the local copy) and then add ignore.

This is the most common cause of "gitignore not working": the file was committed long ago, and a rule added after the fact cannot block a file already tracked.

Methodology

1. Identify content types that should not be in the repo

TypeIdentification
Third-party / decompiled / generated artifactsSomeone else's code, decompiled output, build output (usually large)
Nested reposDirectory contains its own VCS metadata, committed as a gitlink (mode 160000)
Personal local config.local suffix, machine-specific paths, personal keys
Large binariesImages / archives / data packs / models
Secret credentials.env / *.key / tokens

2. Layered verification tools (use as needed)

  • status — change overview.
  • check-ignore <path> — whether the path is blocked by some ignore rule (no output = not blocked).
  • ls-files <path> — whether the path is already tracked (output = tracked, ignore has no effect on it).
  • status -uall — expand collapsed untracked directories (regular status collapses directories containing non-ASCII paths or all-untracked content).

To judge whether adding ignore will help: first run ls-files to see if the file is tracked. Tracked → ignore won't work, go to step 4 to remove from tracking. Untracked → ignore works directly.

3. Inspect the ignore rules themselves

  • Wrong path syntax (extra prefix characters, wrong case, wrong slash direction) — incorrect rules fail silently.
  • Use trailing slash path/ for directories, no trailing slash for files.

4. Disposition

SituationAction
Tracked file that should not be in repoRemove from tracking (keep local) + add ignore: git rm --cached -r <path> then commit
Untracked fileJust add ignore
Nested repo (gitlink)First identify (mode 160000 + no modules config = dangling gitlink), then choose one: ① ignore (local reference) ② convert to a proper submodule ③ remove inner VCS and commit as ordinary files

5. Commit granularity

Code / docs / config / cleanup go in separate commits so history is clear and each can be reverted independently. Avoid one giant commit mixing all types.

6. Pre-dev cleanliness check

  • Working tree clean (no uncommitted changes).
  • No untracked files waiting to be added (except local references).
  • No dangling gitlinks.
  • Ignore rules correct (improperly committed content removed from tracking).

Red lines (reasoned, not absolute)

  • Do not run git add . (stage everything) without checking first — it sweeps improperly committed content (especially large files / third-party code) into the commit.
  • Do not just add ignore without removing from tracking — for already-tracked files, ignore alone has no effect (the core gotcha).
  • Do not physically delete local files for cleanup — use "remove from tracking, keep local" (git rm --cached), not actual deletion.

Worked example: one repo slim-down (sanitized)

  1. After adding ignore rules, the decompiled directory still showed up → ls-files revealed it was already tracked (~14,000 files) → ignore was ineffective.
  2. The original ignore rule had an extra character in the path prefix causing silent failure → fixed the rule.
  3. A nested repo (peer code cloned in) was committed as a dangling gitlink → removed from tracking + ignore (kept local as reference).
  4. Personal local permission config (.local) kept changing → removed from tracking + ignore.
  5. Split into multiple commits: code / docs / cleanup separated.

This is one instance, not the methodology itself.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.