agentleFS
loganware05loganware05/captains-compass-cursor/.cursor/skills/code-structure-cleanup/SKILL.md

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

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
  1. Distinctive:

    Do not fold cleanup into the original feature plan after the fact.

    line 22
  2. Distinctive:

    Run applicable validation.

    line 34

≈ “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.

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

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.md for 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

  1. Confirm the feature is green (relevant tests pass or blockers are documented).
  2. Confirm a cleanup-specific plan is APPROVED.
  3. Inspect only the feature area (and direct callers), not the whole app.
  4. Name each duplication clearly (e.g. “three slightly different sendEmail helpers”).
  5. 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)
  6. Implement without changing user-facing behavior.
  7. Run applicable validation; capture evidence if required by DoD.
  8. 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

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.