From cosmo-agent-skills
Audit and tidy a repo or working folder: fix layout drift, consolidate misplaced files, remove stale artifacts, align docs with disk. Use when organizing any project, scratch folder, or new repo — before release or after a refactor.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cosmo-agent-skills:repo-hygieneThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Keep a tree **navigable, documented, and free of stale cruft** — without
Keep a tree navigable, documented, and free of stale cruft — without breaking active work or deleting anything the user still needs.
Complements code-writing (implementation) and code-reviewer (diff quality).
Do not prescribe a fixed layout. Derive structure from the project type and
whatever the repo already documents (README, CLAUDE.md, package manifest,
framework defaults).
find . -maxdepth 4 -not -path './.git/*' | sort
git status 2>/dev/null || true
Read README, CLAUDE.md, pyproject.toml / package.json / Cargo.toml if
present. Compare disk vs documented intent. List issues:
| Issue type | Example |
|---|---|
| Path drift | README says src/ but code lives at repo root |
| Duplicate trees | Old copy left after a move |
| Empty scaffolds | Placeholder dirs with no files |
| Stale outputs | Old run artifacts, caches, build dirs |
| Mixed concerns | Tests, scripts, and results all in one flat folder |
| Local-only files | Editor config, large data that should be gitignored |
Start from what the repo is, not a template from another project:
| Context | Typical anchors (adapt, don't copy blindly) |
|---|---|
| Library / package | src/ or <pkg>/, tests/, docs/, root README |
| App / service | app code, config, tests/, deploy/infra if any |
| Research / scratch | scripts/, notebooks/ or doc/, results/ or outputs/ (often gitignored) |
| Monorepo | one top-level dir per package; shared docs at root |
| Pre-git experiment | minimal: README stub, .gitignore, one clear output dir |
Principles (always):
src/ layout, Node package.json at root, etc..gitignore for junk,
delete failed experiments rather than accumulating old/, backup/, test2/.If the repo has no stated convention yet, propose the smallest layout that fits the work — do not import structure from unrelated repos (plugins, monorepos, etc.).
| Safe to delete (usually) | Confirm with user first |
|---|---|
| Empty directories | Anything under results/, outputs/, benchmarks/, runs/ |
__pycache__/, .pytest_cache/, *.egg-info/, node_modules/ (reinstallable) | Plots, checkpoints, or logs that might be the only record of a run |
| Duplicate copies superseded by a move | WIP code still referenced in docs or scripts |
| Editor-local config not meant to be shared | Data files the user still needs |
Never delete without checking: uncommitted work, the only copy of a file, or paths referenced in README, CI, imports, or scripts.
git mv when tracked)..gitignore.git status is clean or changes are intentional.When reporting a hygiene pass:
## Repo hygiene report
### Context
- Project type: ...
- Conventions read from: ...
### Layout (before → after)
- ...
### Removed
- ...
### Moved
- ...
### Docs updated
- ...
### Left alone (and why)
- ...
### Follow-ups
- ...
| Approach | Use when |
|---|---|
This skill (repo-hygiene) | Inline cleanup; need a checklist |
| repo-organizer subagent | Large tree or many deletes; audit first, apply after confirmation |
Do not fold this into code-writing or code-reviewer — those focus on code diffs, not tree structure.
npx claudepluginhub licongxu/cosmo-agent-skills --plugin cosmo-agent-skillsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.