waterfall-refactor
Skill0 starsChanged 52 days agoMITView on GitHub
Identify refactoring opportunities in code that a feature will touch. Runs at strategic level during design (looking for structural moves that could change which approach is chosen) or tactical level before implementation (looking for pre-work that gives the feature a better foundation). Primarily invoked by waterfall-design or waterfall-implement; avoid auto-triggering on casual mentions of "refactor".
In this repository26 other files it gives its agents.
- ask-mattSkill
- code-reviewSkill
- create-prSkill
- draft-prSkill
- ready-prSkill
- developSkill
- self-review-docsSkill
- implement-reviewSkill
- implementSkill
- implement-specSkill
- librarianSkill
- nemesisSkill
- refactorSkill
- research-codebaseSkill
- researchSkill
- review-docsSkill
- self-reviewSkill
- simplifySkill
- tddSkill
- test-auditSkill
- waterfall-challengeSkill
- waterfall-designSkill
- waterfall-implementSkill
- waterfall-planSkill
- waterfall-reviewSkill
- zero-tech-debtSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
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 15
Strategic: Run during design, before approaches are generated.
- Distinctive: line 18
Tactical: Run before implementation, after the plan is approved.
- Distinctive: line 30
If running at the strategic level, the scope is broader — look at the modules and services the feature touches, not just individual files.
- Distinctive: line 36
Read the affected code with the feature in mind.
- Distinctive: line 57
Unrelated: Not relevant to this feature.
- Distinctive: line 60
Pre-work: Do before implementation starts.
- Distinctive: line 63
Skip: Not relevant to the planned changes.
≈ “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
Analyze the codebase for refactoring opportunities relevant to the feature being built. This is not a general cleanup pass — it focuses on code the feature touches and asks what changes would give it a better foundation.
The analysis adapts to when it runs. The caller provides a review level:
- Strategic: Run during design, before approaches are generated. Surface structural opportunities that could influence which approach to take.
- Tactical: Run before implementation, after the plan is approved. Surface pre-work and incorporated refactors that make the implementation cleaner.
Step 1: Determine scope
Extract from the conversation:
- The feature being built.
- Which areas of the codebase are involved.
- The review level (strategic or tactical).
If running at the strategic level, the scope is broader — look at the modules and services the feature touches, not just individual files. If tactical, focus on the specific files in the plan's manifest.
Step 2: Analyze
Read the affected code with the feature in mind. The question is not "what is wrong with this code?" but "will this code give the feature a good foundation?"
At the strategic level, be willing to consider larger structural moves. A refactor that turns the feature from complex to trivial is worth naming, even if the user ultimately decides not to take it.
At the tactical level, look for smaller moves: pre-work that keeps the implementation diff clean, or cleanups that fold naturally into the planned changes.
Step 3: Classify
For each opportunity:
- Strategic level:
- Enables new approach: A refactor that opens up a design option that would otherwise be impractical. Note what approach it enables.
- Simplifies all approaches: A refactor that benefits the feature regardless of which approach is chosen.
- Unrelated: Not relevant to this feature. Do not include.
- Tactical level:
- Pre-work: Do before implementation starts.
- Incorporate: Fold into the implementation alongside planned changes.
- Skip: Not relevant to the planned changes. Do not include.
At the tactical level, also assess two signals the implementation gate keys on, for each included opportunity:
- Magnitude: bounded — localized to a small area — or large — spread across many files, or structural.
- Shape: self-contained, or risky — it changes a contract other code depends on, regardless of diff size.
Report these as factual assessments; do not decide whether to proceed —
the orchestrator (waterfall-implement Step 2) owns the gate.
Step 4: Present
Return the opportunities with file paths, descriptions, and why each matters for the feature. At the strategic level, explicitly note how opportunities connect to potential approaches. At the tactical level, include each opportunity's magnitude and shape so the implementation gate can act on them.
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.

