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`.
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- llms.txtllms.txt
- flow-a11ySkill
- flow-adversarial-reviewSkill
- flow-animateSkill
- flow-apiSkill
- flow-benchmarkSkill
- flow-brainstormSkill
- flow-commitSkill
- flow-data-migrateSkill
- flow-depsSkill
- flow-designSkill
- flow-diagnoseSkill
- flow-docsSkill
- flow-git-fixSkill
- flow-handoffSkill
- flow-migrateSkill
- flow-observeSkill
- flow-onboardSkill
- flow-orchestrateSkill
- flow-planSkill
- flow-pr-fixSkill
- flow-prototypeSkill
- flow-prune-agent-setupSkill
- flow-redesignSkill
- flow-releaseSkill
- flow-repo-briefSkill
- flow-reviewSkill
- flow-shipSkill
- flow-simplifySkill
- flow-specializeSkill
- flow-stylesSkill
- flow-testSkill
- flow-triageSkill
- flow-uiSkill
- flow-verifySkill
- flow-workSkill
- flow-write-skillSkill
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
- Distinctive: line 19
Verify affected callers and repository gates on the integrated result.
- Very specific: line 34
Use flow-review for the result or flow-migrate when applying a proven transformation across sites.
≈ “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
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
- Define the structural problem, affected callers, and observable contract. Read source, conventions, and relevant tests before choosing an abstraction.
- 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.
- 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.
- 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.
- 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.
- 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.
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.

