session-cleanup
Skill2 starsChanged 4 months agoMITView on GitHub
Use at the end of substantial coding work or when asked for a final cleanup or integrity pass over the current branch/work delta; compare against a verified integration baseline, remove in-scope debris and unnecessary complexity, preserve unrelated changes, and report validation honestly. It is not an audit after every edit or authorization for destructive cleanup.
2 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- ArcanEdge-AI/coding-agent-playbook-claude-codeedited, first seen Jul 8, 2026
- ChristopherA/claude_code_toolstheir own version, first seen Dec 31, 2025
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 1
Wrote their own version · 1
- ChristopherA/claude_code_tools★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- feature-branch-lifecycleSkill
- handoffSkill
- legacy-path-retirementSkill
- multi-session-coordinationSkill
- reference-doc-routingSkill
- senior-code-reviewSkill
- subagent-orchestrationSkill
- task-graph-orchestrationSkill
- worktree-lifecycleSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 15 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use this skill at the end of substantial coding work or when the user asks for a deliberate cleanup and integrity pass.
- Distinctive: line 12
Do not use conversational memory as the boundary of the cleanup.
- Distinctive: line 16
Read the supplied methodology reference for the checks relevant to the current work delta: post-session-cleanup-methodology.md.
- Distinctive: line 23
If the current branch is itself the integration baseline or there is no meaningful committed divergence, use the verified working-tree …
- Distinctive: line 27
Never use destructive reset, clean, stash, or history manipulation, and do not make implicit production or deployment changes.
- Distinctive: line 28
Prefer the smallest complete correction and the smallest maintainable implementation surface.
- Distinctive: line 29
Prefer one canonical implementation path.
- Distinctive: line 30
Do not add compatibility behavior for hypothetical users, old data, API consumers, deployments, or integrations.
- Distinctive: line 58
Remove or correct clear work-delta-introduced debris, defects, abandoned approaches, speculative compatibility code, and unnecessary …
- Distinctive: line 65
Treat search matches as leads.
- Distinctive: line 66
Do not preserve work-delta compatibility code merely because an earlier commit on the same unmerged branch used an older interface or …
- Distinctive: line 67
Keep validation evidence tied to the changed behavior and distinguish a failed check from a check that could not run.
- Distinctive: line 68
If a work-delta defect is found, fix it only when the correction is reversible, in scope, and verifiable.
- Distinctive: line 69
If ownership, baseline, compatibility evidence, or material behavior remains unresolved, stop short of a clean-completion claim and put the …
- Very specific: line 99
Use not yet safe to consider complete for required work-delta defects or material unvalidated behavior.
- Distinctive: line 101
Do not claim success when required validation was not performed or material changed behavior remains unverified.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Session Cleanup
Use this skill at the end of substantial coding work or when the user asks for a deliberate cleanup and integrity pass. The work may have spanned a long-running session, multiple context compactions, many commits, interrupted runs, or more than one coding agent.
Do not use conversational memory as the boundary of the cleanup. Define the work from repository evidence.
The purpose of this skill is to leave the changed portion of the codebase in the smallest, clearest, production-appropriate state that satisfies the demonstrated requirement: no accidental debris, abandoned approaches, speculative compatibility paths, redundant abstractions, or unnecessary complexity.
Read the supplied methodology reference for the checks relevant to the current work delta: post-session-cleanup-methodology.md. Its numbered sections are the detailed procedure and its Completion Report is the required reporting shape.
Scope and authority
- Establish the repository's verified integration baseline before cleanup. Prefer
stagingwhen it exists and repository evidence shows it is the normal integration target; otherwise usemainor the repository's verified primary integration branch. Do not choose a baseline solely because of its branch name. - Find the merge base between the current branch and the verified baseline. Treat the complete committed delta from that merge base through current
HEAD, together with staged, unstaged, and untracked changes, as the primary cleanup surface. This is the work delta. - Long-running work may span multiple context compactions or sessions. Never shrink the cleanup surface to only what the current conversation remembers.
- If the current branch is itself the integration baseline or there is no meaningful committed divergence, use the verified working-tree changes and explicit task evidence as the work delta. If the baseline remains uncertain, report that uncertainty and do not claim a clean completion.
- Preserve unrelated edits, staging, and user files, including files with mixed ownership. If ownership is uncertain, report it and continue independently verified work; do not silently rewrite or delete it.
- "Clean" means the work delta contains no unexpected debris, unresolved work-delta defect, abandoned implementation, or unnecessary complexity that should reasonably be removed now. It does not mean an empty Git status. Do not automatically stage, commit, discard, reset, or deploy.
- A cleanup request permits reversible, in-scope cleanup. An explicit inspection-only request remains read-only. Existing approval carries forward only within the stated scope; do not invent a universal approval gate.
- Never use destructive reset, clean, stash, or history manipulation, and do not make implicit production or deployment changes. Scope security checks to touched surfaces and do not expose secrets.
- Prefer the smallest complete correction and the smallest maintainable implementation surface. Preserve complexity only when required for correctness, security, data integrity, accessibility, maintainability, or a demonstrated compatibility requirement. Do not redesign, blanket-format, add dependencies merely for cleanup, or repair unrelated pre-existing issues.
- Prefer one canonical implementation path. Remove work-delta code that exists only because implementation churn, experimentation, or an abandoned design left it behind.
- Do not add compatibility behavior for hypothetical users, old data, API consumers, deployments, or integrations. New compatibility code requires evidence of a real supported dependency.
- Valid compatibility evidence includes currently deployed older versions, real persisted data using the old representation, active consumers using the old contract, documented supported-version requirements, an active migration window, or equivalent repository/runtime evidence.
- Confirm that the consumer or data actually requires continued support. Obsolete test accounts, fixtures, and hypothetical users are not support commitments; use
legacy-path-retirementto separate that decision from data preservation or an authorized reset. Alpha status does not justify rebuilding the flow. - "Someone might use it," "for backwards compatibility," "to be safe," "future-proofing," or similar speculation is not sufficient evidence.
- Existing baseline compatibility code is not automatically junk. Before removing it, verify callers, data, supported clients, deployments, migrations, configuration, and dynamic usage. If its necessity cannot be established either way, leave the pre-existing path unchanged and report the uncertainty.
- Branch history is not production history. Code introduced and superseded entirely within an unmerged development branch does not require backwards compatibility merely because an earlier commit used it.
Review sequence
- Establish the verified baseline and reconstruct the full work delta before editing. Determine the intended outcome, changed paths, ownership, and change classes. Include committed branch changes, staged/unstaged/untracked work, files, renames, configuration, dependencies, schemas/migrations, tests, docs, generated artifacts, and tooling.
- Inspect the methodology sections in the linked reference using this routing map. Apply all relevant checks and do not skip a section merely because the visible diff is small:
- 1: establish the integration baseline and reconstruct the complete committed and working-tree work delta.
- 2: search affected surfaces for debug debris, placeholders, temporary values, leaked local paths, credentials, unused code, and disabled checks.
- 3: identify abandoned implementations, duplicate helpers, obsolete types, stale flags, branch-only transitional paths, and speculative compatibility code.
- 4: minimize implementation surface by simplifying unnecessary layers, state, wrappers, configuration, dependencies, indirection, and meaningful duplication when the improvement is obvious, low-risk, and in scope.
- 5: review naming, structure, readability, comments, responsibility boundaries, and meaningful duplication in affected code.
- 6: inspect errors and edge cases wherever behavior, inputs, network calls, permissions, retries, or state transitions changed.
- 7: inspect data and state integrity wherever persistence, APIs, schemas, migrations, serialization, or state management changed; retain old-state handling only when a demonstrated compatibility requirement exists.
- 8: inspect touched security boundaries for secrets, auth, authorization, ownership, input handling, logs, dynamic execution, and file safety; this is not a full unrelated security audit.
- 9: inspect dependencies and configuration whenever packages, lockfiles, environment variables, build settings, or deployment configuration changed.
- 10: inspect actual loading, empty, error, success, disabled, navigation, responsive, keyboard, accessibility, focus, and mutation flows whenever UI changed; source inspection alone does not prove UI behavior.
- 11: retain E2E behavioral tests only; every created unit test is temporary, regardless of purpose, and none may remain in the completed change. Verify corresponding E2E assertions pass before removing them and exclusively used support code. Review failure and boundary coverage, weakened assertions, skipped tests, unrealistic fixtures, redundant coverage, and abandoned fixes; keep existing-suite migration within authorized scope.
- 12: select the smallest meaningful checks from the project's existing commands and run required affected gates; broaden only for changed behavior, repository requirements, or unresolved risk, preserving valid results.
- 13: check directly affected README, setup, environment, API, example, architecture, configuration, and user-facing documentation against reality.
- 14: resolve, remove, or classify work-delta-introduced TODO, FIXME, HACK, TEMP, XXX, workaround, and deferred-work markers.
- 15: verify status, secrets, editor/OS debris, generated files, binaries, duplicates, ignore rules, and investigation scripts for repository hygiene.
- 16: perform a fresh next-developer review for one obvious implementation path, clarity, misleading permanence, magic values, responsibilities, errors, and obvious maintainability debt.
- 17: before every additional cleanup change, ask: "Is this necessary to correctly complete, simplify, stabilize, or clean up the current work delta?" If no, leave it alone and record the unrelated issue separately.
- Remove or correct clear work-delta-introduced debris, defects, abandoned approaches, speculative compatibility code, and unnecessary complexity. Before each cleanup mutation, verify ownership and usages; preserve unrelated baseline behavior and record pre-existing problems separately. Re-review the resulting baseline comparison and status.
- Validate with the project's defined commands, starting with the smallest relevant checks and then the broader required gates. Record actual pass, fail, unrun, or uncertain outcomes and classify each failure or blocker as work-delta-introduced, pre-existing, environmental/tooling, or unknown when evidence is insufficient. A material changed behavior that cannot be validated cannot be called complete and clean.
- Report blockers and unresolved ownership or compatibility evidence plainly. Do not turn inability to inspect or validate into a success claim, and do not silently expand scope to make the report look clean.
Evidence and stopping rules
- Base conclusions on the verified baseline comparison, current source, repository history, status, configuration, tests, and runtime evidence; do not rely on session memory alone.
- Treat search matches as leads. Confirm callers, dynamic references, configuration loading, persisted data, deployment/support requirements, and compatibility requirements before deleting pre-existing behavior.
- Do not preserve work-delta compatibility code merely because an earlier commit on the same unmerged branch used an older interface or representation.
- Keep validation evidence tied to the changed behavior and distinguish a failed check from a check that could not run.
- If a work-delta defect is found, fix it only when the correction is reversible, in scope, and verifiable; then repeat the affected checks and review the baseline diff.
- If ownership, baseline, compatibility evidence, or material behavior remains unresolved, stop short of a clean-completion claim and put the uncertainty in the report.
Required report
Return exactly these categories, even when a category is empty:
Cleaned Up
List meaningful cleanup performed.
Validation
List checks actually run and their outcomes.
Problems Found
List defects, incomplete work, accidental technical debt, abandoned approaches, speculative compatibility paths, or unnecessary complexity discovered.
Remaining Issues
Separate work-delta-introduced issues, pre-existing issues, and optional future improvements, with reasons for anything left unresolved.
Final State
Choose exactly one of:
complete and cleancomplete with documented remaining issuesnot yet safe to consider complete
Use not yet safe to consider complete for required work-delta defects or material unvalidated behavior; documented remaining issues may use a complete state only when they do not block validated requirements.
Do not claim success when required validation was not performed or material changed behavior remains unverified.
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
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.

