From madi
Identifies and deletes session-generated artefacts (planning docs, specs, self-grill outputs, code review working docs, .claude/specs) that were created during development but have no value in the merged codebase. Invoke when the user says "clean up docs", "remove slop docs", "clean up before merge", "tidy up the branch artefacts", or "clean up the session docs".
How this skill is triggered — by the user, by Claude, or both
Slash command
/madi:clean-upThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Audit the current branch for docs and files created during the development session (planning, review, grilling, specs) rather than as permanent codebase additions. Present a classified list for confirmation, then delete only what the user approves.
Audit the current branch for docs and files created during the development session (planning, review, grilling, specs) rather than as permanent codebase additions. Present a classified list for confirmation, then delete only what the user approves.
# Tracked files added on this branch
git diff --name-only --diff-filter=A $(git merge-base HEAD origin/develop 2>/dev/null || git merge-base HEAD develop) HEAD
# Untracked files (check .claude/specs/, docs/, etc.)
git ls-files --others --exclude-standard
For every non-code file discovered, read it before assigning a verdict — filename heuristics alone are unreliable. Look for:
Status: fields (e.g. draft, pre-grill, sharp (self-grilled)) → DELETEAssign one of three verdicts:
DELETE — created to serve the session, now superseded by the code:
.claude/specs/ — all files (draft plans, self-grill specs, implementation specs).planning/ — if tracked (should be gitignored; if not, remove and add to gitignore)Status: draft, pre-grill, or self-grilledKEEP — has genuine value for future readers of the codebase:
DESIGN-SPEC.mddocs/adr/)description: field; if it's well-formed and covers a domain the codebase will keep touching, lean KEEPASK — genuinely ambiguous; ask the user before deciding:
CODE-REVIEW.md files — lean KEEP if the file contains deferred rationale, "verified not a bug" sections, or named architectural decisions; lean DELETE if it's purely a list of findings that are all resolved and in commits~/.claude/agents/ globally); if it looks accidental or low-quality, suggest deletingdocs/ that doesn't clearly fit KEEP or DELETEShow a numbered list before touching anything — numbers are required so the user can skip specific items:
Session artefacts to DELETE:
1. .claude/specs/foo-draft.md [untracked] — draft pre-grill spec
2. .claude/specs/foo-final.md [untracked] — self-grill implementation spec
3. docs/feature/CODE-REVIEW.md [tracked] — code review working doc (all findings resolved)
Files to KEEP (no action):
- docs/feature/DESIGN-SPEC.md [untracked] — design rationale, worth keeping
- .claude/agents/my-agent.md [tracked] — useful ongoing agent
Files to ASK about:
? .claude/agents/unrelated-agent.md [tracked] — unrelated to this feature; keep or delete?
Note: [tracked] deletions will be staged with git rm and require a commit.
[untracked] deletions are permanent immediately — not recoverable from git.
All [tracked] deletions are recoverable via git after commit.
Also flag any KEEP files that are untracked — they may need to be staged:
Note: docs/feature/DESIGN-SPEC.md is KEEP but currently untracked — run `git add` if you want it in the PR.
Ask: "Delete the items listed above? Enter y to delete all, n to cancel, or numbers to skip (e.g. '1 3' to skip items 1 and 3)."
For each confirmed deletion, check whether tracked or untracked:
# Tracked files:
git rm <file>
# Untracked files:
rm <file>
# Remove any directories that are now empty (only the ones affected):
for dir in $(dirname <deleted-files> | sort -u); do
find "$dir" -type d -empty -delete 2>/dev/null || true
done
If any tracked files were deleted, show the staged diff and ask before committing:
Staged deletions:
deleted: .claude/agents/pbs-scripting-expert.md
deleted: docs/feature/CODE-REVIEW.md
Commit these as "chore: remove session artefacts before merge"? (y/n)
If yes:
git commit -m "chore: remove session artefacts before merge"
Note: lefthook will run on this commit (prettier, lint, typecheck). If hooks fail, fix them before proceeding.
| File pattern | Default | Notes |
|---|---|---|
.claude/specs/* | DELETE | Always session artefacts |
.planning/* (if tracked) | DELETE | Should be gitignored; also add to .gitignore |
*-PLAN.md, *-RESEARCH.md | DELETE | Planning artefacts |
*-CONTEXT.md in .claude/ | DELETE | GSD context docs |
*-CONTEXT.md in docs/ or repo root | ASK | Could be a Matt-Pocock domain vocabulary doc — read it first |
DESIGN-SPEC.md | KEEP | Explains WHY |
docs/adr/* | KEEP | Always keep |
CODE-REVIEW.md | ASK | Read content — keep if WHY rationale exists, delete if pure findings list |
.claude/agents/*.md — well-formed, future-useful | KEEP | Read description; if covers a domain the codebase will keep touching, keep |
.claude/agents/*.md — accidental / low-quality | ASK | Suggest delete or move to global ~/.claude/agents/ |
| Grilling transcript files | DELETE |
.ts, .tsx, .py, .tf, etc.), tests, or config.claude/specs/ before classifyingnpx claudepluginhub madiabio/madi-skills-marketplace --plugin madiGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.