agentleFS
emiliodominguezemiliodominguez/flow-skills/skills/flow-refactor/SKILL.md

flow-refactor

Skill1 starsChanged 47 days agoMITView on GitHub

Behavior-preserving structural change. Use to untangle dependencies, redraw module boundaries, extract responsibilities or reduce coupling; behavior changes belong in `flow-work`. Hands off to `flow-review` or `flow-migrate`.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

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

    Verify affected callers and repository gates on the integrated result.

    line 19
  2. Very specific:

    Use flow-review for the result or flow-migrate when applying a proven transformation across sites.

    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

Refactor

Change structure inside an explicit behavior boundary. Preserve outputs, errors, ordering, state lifetime, and public compatibility unless the user also requests those changes.

Process

  1. Define the structural problem, affected callers, and observable contract. Read source, conventions, and relevant tests before choosing an abstraction.
  2. Build a safety net proportional to the change: existing tests, characterisation tests, boundary fixtures, traces, or static reference checks. A private rename may need no new test; a hard I/O boundary may need a small harness. Do not extract a new architecture just to create the net meant to protect that extraction.
  3. Choose a small transformation that improves ownership or makes a module deeper without growing public surface. Similar syntax is not always the same responsibility; semantic reasons beat duplicate counts.
  4. Apply reversible steps and compare behavior after each meaningful boundary change. Keep a single-writer rule per file and index. Parallel read-only inspection is fine; parallel implementation needs disjoint ownership and integration checks.
  5. Preserve API consumers, serialization, component identity, effect cleanup, module side effects, and runtime guards at untrusted boundaries. A type annotation does not validate a runtime value. Regenerate generated output through its source tooling.
  6. Verify affected callers and repository gates on the integrated result. Keep any requested behavior change separate in the diff and explain it.

Anti-patterns

  • Turning a structural fix into a new framework or domain architecture.
  • Adding abstractions only because code appears twice.
  • Treating fewer lines or unrelated green tests as proof of preserved behavior.
  • Scope creep into adjacent features, or deleting user changes for a clean worktree.

Done when

  • The structural problem improves and the behavior boundary is backed by evidence.
  • Affected consumers and repository gates pass at the current revision.
  • The change follows local conventions, stays in scope, and single-writer ownership is clear.

Use flow-review for the result or flow-migrate when applying a proven transformation across sites.

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.