code-structure-cleanup
Skill2 starsChanged 31 days agoMITView on GitHub
After a feature works, extracts duplicated mechanics into service-layer modules under a separate approved plan without changing behavior
In this repository52 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/00-core-operating-model.mdcCursor rule
- .cursor/rules/01-plan-approval-gate.mdcCursor rule
- .cursor/rules/02-git-worktree-policy.mdcCursor rule
- .cursor/rules/03-validation-definition-of-done.mdcCursor rule
- .cursor/rules/04-documentation-memory.mdcCursor rule
- accessibility-reviewSkill
- agent-skills-packagingSkill
- autonomy-budgetSkill
- bounded-autonomySkill
- candidate-promotionSkill
- capability-planningSkill
- code-reviewerSkill
- compass-evaluatorSkill
- context-inodesSkill
- dependency-supply-chainSkill
- docker-cloudSkill
- embedding-providersSkill
- execution-telemetrySkill
- experience-routingSkill
- experience-skill-trainingSkill
- external-knowledge-ingestSkill
- github-integrationSkill
- goose-agent-orchestrationSkill
- harness-gcSkill
- hosted-vector-dbSkill
- implementation-planningSkill
- ios-engineeringSkill
- knowledge-stewardSkill
- linear-integrationSkill
- node-engineeringSkill
- northstar-connected-routineSkill
- notion-integrationSkill
- package-registry-tiSkill
- persistent-role-promotionSkill
- playwright-browser-validationSkill
- postgres-prismaSkill
- procedure-playbooksSkill
- project-overseerSkill
- pull-request-preparationSkill
- python-mlSkill
- react-engineeringSkill
- repository-discoverySkill
- review-fix-loopSkill
- security-audit-proceduresSkill
- security-reviewSkill
- skill-learning-loopSkill
- skill-lifecycleSkill
- source-code-contextSkill
- technology-intelligence-liveSkill
- testing-validationSkill
- worktree-orchestrationSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Do not fold cleanup into the original feature plan after the fact.
- Distinctive: line 34
Run applicable validation.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Code Structure Cleanup
Use this Skill when
A feature already works locally, but the touched code has duplicated runtime mechanics, repeated API calls, repeated parsing/validation, or messy structure that will confuse future agents.
Inputs
- Files touched by the completed feature
- A separate approved
IMPLEMENTATION_PLAN.mdfor this cleanup (required) - Project test commands from
TESTING.md
Approval rule (hard)
Cleanup that modifies product implementation files always requires its own IMPLEMENTATION_PLAN.md at APPROVED status.
Do not fold cleanup into the original feature plan after the fact. Do not start cleanup while the feature plan is still open unless the Captain has approved a distinct cleanup plan.
Procedure
- Confirm the feature is green (relevant tests pass or blockers are documented).
- Confirm a cleanup-specific plan is APPROVED.
- Inspect only the feature area (and direct callers), not the whole app.
- Name each duplication clearly (e.g. “three slightly different sendEmail helpers”).
- Propose the smallest service-layer extraction:
- UI/route/action keeps domain policy (what should happen)
- Service module owns mechanics (how it happens: API calls, parsing, streaming, I/O)
- Implement without changing user-facing behavior.
- Run applicable validation; capture evidence if required by DoD.
- Summarize what got simpler and what was deliberately left alone.
Output
Focused cleanup diff, validation evidence, and a short “what simplified” report for the Captain.
Prohibited actions
- Redesigning the whole application
- Mixing new features into the cleanup PR
- Changing user-facing behavior “while we’re here”
- Moving domain/business decisions into generic services
- Renaming broadly for aesthetics
- Proceeding without a separate approved cleanup plan
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.

