refactor-planning
Skill0 starsChanged 5 months agoApache-2.0View on GitHub
Plan safe refactors that preserve behavior — seams, steps, tests,
1 other project uses a version of this.
Adopted by
Most recently taken up by
- gray-matter/skillstheir own version, first seen Oct 4, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- gray-matter/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository128 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessibility-implementationSkill
- accessibility-reviewSkill
- api-changelogSkill
- api-designSkill
- auth-designSkill
- caching-strategiesSkill
- chaos-experiment-designSkill
- ci-cd-pipelinesSkill
- cli-designSkill
- cloudformation-reviewSkill
- codebase-orientationSkill
- code-commentsSkill
- code-reviewSkill
- commit-messagesSkill
- container-reviewSkill
- database-indexingSkill
- database-migrationsSkill
- debuggingSkill
- dependency-upgradesSkill
- design-system-contributionSkill
- design-tokensSkill
- desktop-releaseSkill
- error-handlingSkill
- feature-flagsSkill
- finops-reviewSkill
- frontend-performanceSkill
- git-conflict-resolutionSkill
- graphql-schema-designSkill
- helm-chart-scaffoldingSkill
- i18n-reviewSkill
- kubernetes-reviewSkill
- load-test-planningSkill
- logging-observabilitySkill
- message-queue-designSkill
- migration-playbooksSkill
- mobile-releaseSkill
- multi-region-active-activeSkill
- observability-alertsSkill
- openapi-spec-designSkill
- partner-api-integrationSkill
- performance-reviewSkill
- pr-descriptionsSkill
- prompt-injection-hardeningSkill
- pulumi-reviewSkill
- rate-limitingSkill
- secrets-managementSkill
- security-reviewSkill
- sql-query-reviewSkill
- terraform-reviewSkill
- test-generationSkill
- threat-modelingSkill
- webhook-designSkill
- websocket-designSkill
- ab-test-analysisSkill
- anomaly-detectionSkill
- cost-anomaly-investigationSkill
- csv-analysisSkill
- data-cleaningSkill
- data-contract-designSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
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 26
Choose a seam: Prefer the smallest boundary that lets you move one concept at a time (function extract, interface, module split).
- Distinctive: line 69
Never combine user-visible behavior change with structural refactor in the same step.
- Distinctive: line 71
Prefer many small PR-sized steps over one "big bang" rewrite.
- Distinctive: line 72
Do not invent framework APIs or file layouts you have not seen.
- Distinctive: line 77
If the right answer is "don't refactor yet," say so and propose a smaller improvement.
- Distinctive: line 83
Strangler vs rewrite: default to strangler (new path beside old, switch traffic, delete old) for systems in production.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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 Planning
Refactoring is behavior-preserving change under test. Plan first so the work is reviewable, reversible, and does not mix product changes with structure.
Workflow
- State the goal and non-goals. What pain (readability, coupling, test friction, performance seam) and what must not change for users.
- Characterize the current design. Boundaries, ownership of state, call graph hotspots, and the worst coupling.
- Choose a seam. Prefer the smallest boundary that lets you move one concept at a time (function extract, interface, module split).
- Lock behavior. List existing tests that protect the seam; add characterization tests before moving code when coverage is thin.
- Sequence the steps. Each step should leave main green and deployable.
- Define done and rollback. How you know it worked; how to undo mid-way.
Output format
## Refactor plan: <target>
**Goal:** …
**Non-goals:** …
**Risk:** low | medium | high — why
### Current shape
2–5 bullets on how it works today and the main smell.
### Target shape
What modules/types exist after; one sentence on the new invariant.
### Safety net
- Existing tests to run: …
- Characterization tests to add first: …
### Steps
1. [safe] …
2. [safe] …
3. …
### Verification
Commands and behaviors to check after each step / at the end.
### Rollback
How to stop or revert without half-migrated state.
### Out of scope
Product changes deliberately deferred.Rules
- Never combine user-visible behavior change with structural refactor in the same step. Split into two PRs when needed.
- Prefer many small PR-sized steps over one "big bang" rewrite.
- Do not invent framework APIs or file layouts you have not seen; mark assumptions.
- Name the tests that must pass after every step. If none exist, the first step is tests, not renames.
- Flag data migrations, serialization formats, and public APIs as high risk.
- If the right answer is "don't refactor yet," say so and propose a smaller improvement.
Edge cases
- No tests: characterization tests + manual script first; shrink scope.
- Strangler vs rewrite: default to strangler (new path beside old, switch traffic, delete old) for systems in production.
- Performance-motivated: require a measurement plan; structure-only plans that claim speedups without metrics are incomplete.
- User already has a partial refactor: replan from current branch state, not from ideal greenfield.
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.

