Code Refactoring Workflow
luongnv89/claude-howto
Guides systematic, test-backed refactoring in the style of Martin Fowler, moving through research, planning and small incremental changes with your approval at each phase.
Plans incremental migrations of aging systems with the strangler fig pattern, using dependency maps, rollback plans, characterization tests and gradual traffic shifts.
$ npx skills add Jeffallan/claude-skills --skill legacy-modernizer -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install Jeffallan/claude-skills legacy-modernizer --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/Jeffallan/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/legacy-modernizer .claude/skills/legacy-modernizer && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "legacy-modernizer" agent skill from https://github.com/Jeffallan/claude-skills/tree/main/skills/legacy-modernizer into .claude/skills/legacy-modernizer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "legacy-modernizer", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/Jeffallan/claude-skills/tree/main/skills/legacy-modernizerType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add Jeffallan/claude-skills --skill legacy-modernizer -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install Jeffallan/claude-skills legacy-modernizer --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Jeffallan/claude-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/legacy-modernizer .agents/skills/legacy-modernizer && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "legacy-modernizer" agent skill from https://github.com/Jeffallan/claude-skills/tree/main/skills/legacy-modernizer into .agents/skills/legacy-modernizer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "legacy-modernizer", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add Jeffallan/claude-skills --skill legacy-modernizer -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install Jeffallan/claude-skills legacy-modernizer --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Jeffallan/claude-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/legacy-modernizer .cursor/skills/legacy-modernizer && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "legacy-modernizer" agent skill from https://github.com/Jeffallan/claude-skills/tree/main/skills/legacy-modernizer into .cursor/skills/legacy-modernizer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "legacy-modernizer", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/Jeffallan/claude-skills.git --path skills/legacy-modernizer--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add Jeffallan/claude-skills --skill legacy-modernizer -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install Jeffallan/claude-skills legacy-modernizer --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Jeffallan/claude-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/legacy-modernizer .gemini/skills/legacy-modernizer && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "legacy-modernizer" agent skill from https://github.com/Jeffallan/claude-skills/tree/main/skills/legacy-modernizer into .gemini/skills/legacy-modernizer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "legacy-modernizer", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install Jeffallan/claude-skills legacy-modernizerInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add Jeffallan/claude-skills --skill legacy-modernizer -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/Jeffallan/claude-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/legacy-modernizer .github/skills/legacy-modernizer && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "legacy-modernizer" agent skill from https://github.com/Jeffallan/claude-skills/tree/main/skills/legacy-modernizer into .github/skills/legacy-modernizer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "legacy-modernizer", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add Jeffallan/claude-skills --skill legacy-modernizer -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install Jeffallan/claude-skills legacy-modernizer --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Jeffallan/claude-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/legacy-modernizer .opencode/skills/legacy-modernizer && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "legacy-modernizer" agent skill from https://github.com/Jeffallan/claude-skills/tree/main/skills/legacy-modernizer into .opencode/skills/legacy-modernizer/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "legacy-modernizer", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
legacy-modernizerPlans incremental migrations of aging systems with the strangler fig pattern, using dependency maps, rollback plans, characterization tests and gradual traffic shifts.
The skill runs five phases, each with a validation checkpoint: assess the system and produce a dependency map and risk register, plan an incremental roadmap with a rollback trigger and owner per phase, build a safety net of characterization tests and monitoring, migrate behind a facade with feature flags, then validate and iterate. The safety net targets 80% or more coverage of existing behavior and must pass on the unmodified legacy system.
During migration, traffic moves in steps such as 5%, 25%, 50% and 100% while error rates and latency stay within baseline, and legacy code is removed only after the new path has been stable at full traffic for a release cycle. Reference files cover strangler fig, refactoring patterns such as branch by abstraction, migrations for databases, UI, APIs and frameworks, golden master testing, and system assessment. Python examples show a routing facade and a feature-flag wrapper.
5 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 1be15d8. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are python).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
github.comsynergetic.solutionsjeffallan.github.ioFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Legacy Modernizer loads about 1.6k tokens when it runs, and up to ~16k if it reads all its reference files. Until then it costs about 104 tokens; SKILL.md has 415 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from Jeffallan/claude-skills at commit 1be15d8, republished under its MIT licence (© Jeffallan). 415 words, ~1,568 tokens.
.claude/skills/legacy-modernizer/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.Assess system — Analyze codebase, dependencies, risks, and business constraints. Produce a dependency map and risk register before proceeding.
Plan migration — Design an incremental roadmap with explicit rollback strategies per phase. Reference references/system-assessment.md for code analysis templates.
Build safety net — Create characterization tests and monitoring before touching production code. Target 80%+ coverage of existing behavior.
Migrate incrementally — Apply strangler fig pattern with feature flags. Route traffic via a facade; shift load gradually.
Validate & iterate — Run full test suite, review monitoring dashboards, and confirm business behavior is preserved before retiring legacy code.
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Strangler Fig | references/strangler-fig-pattern.md | Incremental replacement, facade layer, routing |
| Refactoring | references/refactoring-patterns.md | Extract service, branch by abstraction, adapters |
| Migration | references/migration-strategies.md | Database, UI, API, framework migrations |
| Testing | references/legacy-testing.md | Characterization tests, golden master, approval |
| Assessment | references/system-assessment.md | Code analysis, dependency mapping, risk evaluation |
# facade.py — routes requests to legacy or new service based on a feature flag
import os
from legacy_service import LegacyOrderService
from new_service import NewOrderService
class OrderServiceFacade:
def __init__(self):
self._legacy = LegacyOrderService()
self._new = NewOrderService()
def get_order(self, order_id: str):
if os.getenv("USE_NEW_ORDER_SERVICE", "false").lower() == "true":
return self._new.fetch(order_id)
return self._legacy.get(order_id)# feature_flags.py — thin wrapper around an environment or config-based flag store
import os
def flag_enabled(flag_name: str, default: bool = False) -> bool:
"""Check whether a migration feature flag is active."""
return os.getenv(flag_name, str(default)).lower() == "true"
# Usage
if flag_enabled("USE_NEW_PAYMENT_GATEWAY"):
result = new_gateway.charge(order)
else:
result = legacy_gateway.charge(order)# test_characterization_orders.py
# Captures existing legacy behavior as a golden-master safety net.
import pytest
from legacy_service import LegacyOrderService
service = LegacyOrderService()
@pytest.mark.parametrize("order_id,expected_status", [
("ORD-001", "SHIPPED"),
("ORD-002", "PENDING"),
("ORD-003", "CANCELLED"),
])
def test_order_status_golden_master(order_id, expected_status):
"""Fail loudly if legacy behavior changes unexpectedly."""
result = service.get(order_id)
assert result["status"] == expected_status, (
f"Characterization broken for {order_id}: "
f"expected {expected_status}, got {result['status']}"
)When implementing modernization, provide:
Strangler fig pattern, branch by abstraction, characterization testing, incremental migration, feature flags, canary deployments, API versioning, database refactoring, microservices extraction, technical debt reduction, zero-downtime deployment
Maintained by @jeffallan, Principal Consultant at Synergetic Solutions
© Jeffallan, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 5 other files (references) in skills/legacy-modernizer of Jeffallan/claude-skills.
Open the folder on GitHubat commit 1be15d8
Legacy Modernizer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Legacy Modernizer this skillJeffallan/claude-skills | 12k | — | ~1.6k | Automated safety check: Pass | MIT | |
| Code Refactoring Workflowluongnv89/claude-howto | 42k | — | ~3.1k | Automated safety check: Pass | MIT | |
| Rails Upgrade Assistantombulabs/claude-code_rails-upgrade-skill | 391 | — | ~2.7k | Automated safety check: Pass | MIT | |
| Fowler-Style Refactoringlhfer/claude-howto-zh-cn | 2.3k | — | ~156 | Automated safety check: Pass | MIT | |
| Extract Command from Git::Libruby-git/ruby-git | 1.8k | — | ~4.4k | Automated safety check: Pass | MIT | |
| Refactoring Skill (Vietnamese)luongnv89/claude-howto | 42k | — | ~3.1k | Automated safety check: Pass | MIT |
luongnv89/claude-howto
Guides systematic, test-backed refactoring in the style of Martin Fowler, moving through research, planning and small incremental changes with your approval at each phase.
ombulabs/claude-code_rails-upgrade-skill
Analyzes a Rails app and builds an upgrade report with breaking changes, deprecations and step-by-step migration guides, one version at a time from Rails 2.3 through 8.1.
lhfer/claude-howto-zh-cn
基于 Martin Fowler 方法论做系统化重构。Use when users ask to refactor code, improve structure, reduce technical debt, clean up legacy code, or improve maintainability.
ruby-git/ruby-git
Migrates a direct command call in Ruby Git's Git::Lib to a Git::Commands class, as part of a Strangler Fig redesign, with a plan, legacy tests and a pull request.
luongnv89/claude-howto
Vietnamese edition of a systematic refactoring skill based on Martin Fowler's book, working in approved phases with small, test-backed changes.
modu-ai/moai-adk
Domain-Driven Development workflow specialist using ANALYZE-PRESERVE-IMPROVE cycle for behavior-preserving code transformation.
Jeffallan/claude-skills
Designs REST and GraphQL APIs from resource modeling to an OpenAPI 3.1 contract, with versioning, pagination and RFC 7807 error handling.
Jeffallan/claude-skills
Walks through designing, building and polishing a command-line tool: user workflow and command hierarchy, implementation in commander, click, typer or cobra, completions and cross-platform testing.
Jeffallan/claude-skills
Creates and checks Kubernetes manifests, Helm charts, RBAC and network policies, and helps debug pod problems, with kubectl checks and rollback steps.
Jeffallan/claude-skills
Builds Laravel 10+ applications with Eloquent models, Sanctum authentication, Horizon queues, API resources and Livewire components, tested with Pest or PHPUnit.
Jeffallan/claude-skills
Handles pandas DataFrame work: cleaning, merging, groupby aggregation, pivots, time-series resampling and memory tuning, with checks on dtypes, shapes and nulls.
Jeffallan/claude-skills
Guides writing and tuning Apache Spark jobs: DataFrame and RDD code, Spark SQL, partitioning, caching, shuffle tuning and structured streaming.
Categories
Plans incremental migrations of aging systems with the strangler fig pattern, using dependency maps, rollback plans, characterization tests and gradual traffic shifts. The skill runs five phases, each with a validation checkpoint: assess the system and produce a dependency map and risk register, plan an incremental roadmap with a rollback trigger and owner per phase, build a safety net of characterization tests and monitoring, migrate behind a facade with feature flags, then validate and iterate. The safety net targets 80% or more coverage of existing behavior and must pass on the unmodified legacy system.
Legacy Modernizer fits situations like: replacing a legacy module piece by piece without a big-bang rewrite; mapping dependencies and risks before touching an old codebase; adding characterization tests around code nobody dares to change; routing traffic between old and new services behind a feature flag.
Run `npx skills add Jeffallan/claude-skills --skill legacy-modernizer -a claude-code`. Or copy the skill folder (skills/legacy-modernizer in Jeffallan/claude-skills) into .claude/skills/legacy-modernizer in your project. Claude Code loads it when a task matches its description.
Run `npx skills add Jeffallan/claude-skills --skill legacy-modernizer -a codex`. Or copy the skill folder (skills/legacy-modernizer in Jeffallan/claude-skills) into .agents/skills/legacy-modernizer in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Jeffallan/claude-skills --skill legacy-modernizer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/legacy-modernizer, .gemini/skills/legacy-modernizer, .github/skills/legacy-modernizer and .opencode/skills/legacy-modernizer in your project.
SKILL.md names no scripts, command-line tools or credentials: Legacy Modernizer is instructions for the agent only.
SKILL.md names 3 domains. As links in the text: github.com, synergetic.solutions and jeffallan.github.io. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Legacy Modernizer is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 15k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Legacy Modernizer: Code Refactoring Workflow (luongnv89/claude-howto, 42k stars), Rails Upgrade Assistant (ombulabs/claude-code_rails-upgrade-skill, 391 stars), Fowler-Style Refactoring (lhfer/claude-howto-zh-cn, 2.3k stars) and Extract Command from Git::Lib (ruby-git/ruby-git, 1.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
Jeffallan (a GitHub user) maintains it in Jeffallan/claude-skills, which has 11,802 GitHub stars. The repository holds 58 skills in this directory. The repository was last updated on October 3, 2026.
Source: Jeffallan/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.