agentleFS
gclmgclm/super-stack/skills/core/backend-refactor/SKILL.md

backend-refactor

Skill0 starsChanged 7 months agoMITView on GitHub

Refactor backend code by separating domain logic, transport, persistence, and side effects so maintainability improves without accidental behavior drift.

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    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:

    Use this skill when backend code has become tangled and the goal is to improve structure, testability, and change safety without rewriting …

    line 8
  2. Distinctive:

    leave clearer seams for testing and future changes

    line 20
  3. Distinctive:

    Keep API and storage changes out unless explicitly in scope.

    line 37
  4. Distinctive:

    Add or preserve tests around the risky seams before deeper cleanup.

    line 38
  5. Distinctive:

    Verify the original flow still works after each slice.

    line 39

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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

Backend Refactor

Use this skill when backend code has become tangled and the goal is to improve structure, testability, and change safety without rewriting the whole service.

Read First

  • the entry handlers, services, models, and side-effect boundaries involved
  • current tests and failure-prone flows
  • docs/overview/roadmap.md and harness/state.md if they exist
  • harness/history.md if it exists

Goals

  • separate transport, domain, persistence, and integration concerns
  • make behavior-preserving refactors explicit
  • leave clearer seams for testing and future changes
  • reduce hidden coupling without over-abstracting

Steps

  1. Define the refactor target:
    • fat handler
    • mixed domain and persistence logic
    • repeated integration code
    • unclear module ownership
  2. Identify behavior that must remain stable.
  3. Extract one stable seam at a time:
    • validation
    • mapping
    • domain rules
    • repository access
    • side-effect adapters
  4. Keep API and storage changes out unless explicitly in scope.
  5. Add or preserve tests around the risky seams before deeper cleanup.
  6. Verify the original flow still works after each slice.

Output

Report:

  • refactor target
  • stable behavior constraints
  • seams extracted or clarified
  • risky areas
  • verification evidence

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.

Reviews can't be read right now.

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.