refactor-plan
Skill412 starsChanged 4 months agoApache-2.0View on GitHub
Generate a structured refactoring plan for a Cacti package or module. Analyzes current code structure, identifies improvement opportunities, and produces a phased plan with risk assessment.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- Aboudjem/ui-ux-suitetheir own version, first seen Nov 8, 2026
- momentmaker/kaijutsutheir own version, first seen Nov 1, 2026
- GangJaeYu/harness_loop_full_koreantheir own version, first seen Oct 29, 2026
- github/awesome-copilottheir own version, first seen Oct 25, 2026
- BuilderIO/agent-nativetheir own version, first seen Oct 17, 2026
- Cosmian/kmstheir own version, first seen Oct 8, 2026
Used with
Projects with it also use pr-review.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
MicrosoftSkillpr-review
Verify the technical accuracy of a vscode-docs pull request against the VS Code source code in microsoft/vscode. Use when reviewing a docs PR for factual correctness: setting names, command IDs, default values, API shapes, keybindings, versioned availability, and described behavior.
Also in 3 projects that use this
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- github/awesome-copilot★ 41ksame name
- BuilderIO/agent-native★ 7.6ksame name
- Cosmian/kms★ 372same name
- Aboudjem/ui-ux-suite★ 8same name
- GangJaeYu/harness_loop_full_korean★ 4same name
- momentmaker/kaijutsu★ 3same name
- DingGao1124/skills★ 2same name
- GA14-hub/claude-code-kit-ja★ 1same name
- khanashes/claude-skills★ 0same name
- ReaperOAK/ForgeOS★ 0same name
1 more not listed
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 repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- ci-triageSkill
- codeql-scanningSkill
- code-reviewSkill
- doublecheckSkill
- package-removalSkill
- <skill-name>Skill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Before starting a significant refactoring effort
- Distinctive: line 13
When code complexity exceeds maintainability thresholds
- Distinctive: line 14
When migrating between patterns or architectures
- Distinctive: line 15
When consolidating related functionality across packages
- Distinctive: line 21
Read the target code and evaluate:
- Very specific: line 34
Extract interface: Create I-prefixed interfaces for dependency injection and testing.
- Very specific: line 43
Barrel file cleanup: Ensure public-api.ts exports are accurate and minimal.
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Refactor Plan Skill
Generate a structured, risk-assessed refactoring plan for a package or module.
When to Use
- Before starting a significant refactoring effort
- When code complexity exceeds maintainability thresholds
- When migrating between patterns or architectures
- When consolidating related functionality across packages
Analysis Steps
1. Current State Assessment
Read the target code and evaluate:
- Size: Line counts for files and functions. Flag functions > 50 lines.
- Complexity: Nesting depth, cyclomatic complexity, branching density.
- Coupling: External dependencies, tight coupling between modules.
- Cohesion: How well each module focuses on a single responsibility.
- Type safety: Usage of
any,unknown, and proper type narrowing. - Test coverage: Which public functions have corresponding tests.
2. Identify Improvement Opportunities
Common refactoring targets in Cacti:
- Extract interface: Create
I-prefixed interfaces for dependency injection and testing. - Consolidate duplicates: Merge identical logic across modules.
- Simplify conditionals: Replace nested if/else with early returns, guard clauses, or strategy pattern.
- Reduce coupling: Introduce dependency injection, event-driven patterns, or facade classes.
- Improve naming: Rename to follow Cacti conventions (
Iprefix,isItype guards). - Barrel file cleanup: Ensure
public-api.tsexports are accurate and minimal. - Package boundary: Move code to the correct package to avoid circular dependencies.
3. Risk Assessment
For each proposed change, evaluate:
- Breaking changes: Will this change public API signatures?
- Downstream impact: Which packages depend on the changed code?
- Test coverage: Are there tests to catch regressions?
- Rollback difficulty: How easy is it to revert if something breaks?
4. Phase Planning
Break the refactoring into phases that:
- Each phase is independently mergeable
- Tests pass at the end of every phase
- Breaking changes are isolated and documented
- Higher-risk changes come later after confidence is built
Output Format
# Refactoring Plan: [Package/Module]
## Current State
- **Files**: [count] | **Functions**: [count] | **Lines**: [total]
- **Key concerns**: [summary of issues found]
## Proposed Changes
### Phase 1: [Safe, Non-Breaking Changes]
| # | Change | Files | Risk | Tests |
|---|--------|-------|------|-------|
| 1 | [description] | [files] | Low | [existing/needed] |
### Phase 2: [Structural Improvements]
| # | Change | Files | Risk | Tests |
|---|--------|-------|------|-------|
| 1 | [description] | [files] | Medium | [existing/needed] |
### Phase 3: [Higher-Risk Changes]
| # | Change | Files | Risk | Tests |
|---|--------|-------|------|-------|
| 1 | [description] | [files] | High | [existing/needed] |
## Dependency Map
[which packages are affected by each phase]
## Rollback Strategy
[how to revert each phase independently]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.

