Agent skill

Fowler-Style Refactoring

by lhfer in 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.”

— description from SKILL.md by lhfer
MITAuto-check passedDevelopment

Install Fowler-Style Refactoring

skills CLI
$ npx skills add lhfer/claude-howto-zh-cn --skill refactor -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install lhfer/claude-howto-zh-cn refactor --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/lhfer/claude-howto-zh-cn.git skills-src && mkdir -p .claude/skills && cp -r skills-src/03-skills/refactor .claude/skills/refactor && rm -rf skills-src

Use ~/.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/

Facts

Skill name
refactor
GitHub stars
2.3k
Token cost
~156 tokens
SKILL.md length
50 words
Files
6 (incl. scripts, references)
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

  • Works in 6 steps: Research & Analysis → Test Coverage Assessment → Code Smell Identification → …
  • SKILL.md covers 工作流概览, 核心原则 and 输出要求
  • Runs Python scripts from its folder

About this skill

Fowler-Style Refactoring is a skill in lhfer/claude-howto-zh-cn (2.3k stars). Its SKILL.md is about 156 tokens, with 5 other files in the folder (scripts, references). Licence: MIT.

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Research & Analysis
  2. Test Coverage Assessment
  3. Code Smell Identification
  4. Refactoring Plan Creation
  5. Incremental Implementation
  6. Review & Iteration

What it can do on your machine

Read from SKILL.md and the folder at commit f0da0c6. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    Ships 2 files in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Fowler-Style Refactoring loads about 156 tokens when it runs, and up to ~672 if it reads all its reference files. Until then it costs about 41 tokens; SKILL.md has 50 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~41
When it runs · the whole SKILL.md, loaded when a task matches
~156
With references · SKILL.md plus every file in references/, read only if the agent opens them
~672

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.

Safety

Auto-check passed

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); the scripts in this folder are not scanned.

SKILL.md

The full file from lhfer/claude-howto-zh-cn at commit f0da0c6, republished under its MIT licence (© lhfer). 50 words, ~156 tokens.

Download SKILL.mdSave it as .claude/skills/refactor/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
refactor
description
基于 Martin Fowler 方法论做系统化重构。Use when users ask to refactor code, improve structure, reduce technical debt, clean up legacy code, or improve maintainability.

Code Refactoring Skill / 重构技能

这个 skill 用于安全、渐进式地做重构,重点强调:

  • 外部行为不变
  • 小步迭代
  • 测试先行
  • 每个阶段都可回退

工作流概览

  1. Research & Analysis
  2. Test Coverage Assessment
  3. Code Smell Identification
  4. Refactoring Plan Creation
  5. Incremental Implementation
  6. Review & Iteration

核心原则

  1. Behavior Preservation
  2. Small Steps
  3. Test-Driven
  4. Continuous
  5. Collaborative

输出要求

  • 先说明问题和目标
  • 再给分阶段计划
  • 每步都说明风险和验证方式

© lhfer, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts, references) in 03-skills/refactor of lhfer/claude-howto-zh-cn.

  • SKILL.md
  • references/code-smells.md
  • references/refactoring-catalog.md
  • scripts/analyze-complexity.py
  • scripts/detect-smells.py
  • templates/refactoring-plan.md

Open the folder on GitHubat commit f0da0c6

Compare with similar skills

Fowler-Style Refactoring 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.

Fowler-Style Refactoring compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Fowler-Style Refactoring this skilllhfer/claude-howto-zh-cn2.3k—~156Automated safety check: PassMIT
Code Refactoring Workflowluongnv89/claude-howto42k—~3.1kAutomated safety check: PassMIT
Refactoring Skill (Vietnamese)luongnv89/claude-howto42k—~3.1kAutomated safety check: PassMIT
Architecture Optimizationwondelai/skills2.4k—~7.4kAutomated safety check: PassMIT
Improve Code Qualitywondelai/skills2.4k—~6.2kAutomated safety check: PassMIT
Systematic Code Refactoringluongnv89/claude-howto42k—~3kAutomated safety check: PassMIT

Similar skills

  • 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.

    42k GitHub stars~3.1k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Refactoring Skill (Vietnamese)

    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.

    42k GitHub stars~3.1k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Guided journey from a working codebase grown slow and tangled to one measurably fast, cleanly bounded, and readable.

    2.4k GitHub stars~7.4k tokensUpdated 27 days ago
    DevelopmentAuto-check passed
  • Improve Code Quality

    wondelai/skills

    Guided journey from a working-but-untested vibe-coded prototype to a production-ready product with tests, clean structure, a business-rules boundary, and resilience at scale.

    2.4k GitHub stars~6.2k tokensUpdated 27 days ago
    DevelopmentAuto-check passed
  • Systematic Code Refactoring

    luongnv89/claude-howto

    Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.

    42k GitHub stars~3k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Tech Debt Analyzer

    ailabs-393/ai-labs-claude-skills

    This skill should be used when analyzing technical debt in a codebase, documenting code quality issues, creating technical debt registers, or assessing code maintainability.

    454 GitHub starsUsed in 2 repos~3.9k tokens
    DevelopmentAuto-check passed

More from lhfer/claude-howto-zh-cn

  • Claude Code Self-Assessment Advisor

    lhfer/claude-howto-zh-cn

    Quizzes you on Claude Code in a quick or deep mode, scores your level across 10 topics and recommends what to learn next, in Chinese.

    2.3k GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed
  • Blog Post Drafting Workflow

    lhfer/claude-howto-zh-cn

    Turns a topic and reference materials into a versioned blog draft through a fixed outline-first pipeline with per-source summaries.

    2.3k GitHub stars~218 tokensUpdated 2 mo ago
    Auto-check passed
  • CLAUDE.md Writer and Auditor

    lhfer/claude-howto-zh-cn

    Creates, updates or audits a project's CLAUDE.md by analyzing the codebase, drafting for review and flagging anti-patterns, aiming for under 200 lines.

    2.3k GitHub stars~254 tokensUpdated 2 mo ago
    Auto-check passed
  • Code Review Specialist

    lhfer/claude-howto-zh-cn

    Structured code review across security, performance, code quality and maintainability, with a checklist, a finding template and two Python scripts for complexity metrics.

    2.3k GitHub stars~267 tokensUpdated 2 mo ago
    Auto-check passed
  • Claude Code Lesson Quiz

    lhfer/claude-howto-zh-cn

    Runs a ten-question interactive quiz on one lesson of a Claude Code tutorial, scores it, and points out the weak spots with a review of missed questions.

    2.3k GitHub stars~781 tokensUpdated 2 mo ago
    Auto-check passed
  • Brand Voice Guide

    lhfer/claude-howto-zh-cn

    Keeps marketing copy and customer messages in one consistent brand voice, using a defined mission, tone, writing rules and lists of preferred and avoided terms.

    2.3k GitHub stars~178 tokensUpdated 2 mo ago
    Auto-check passed

Categories

Questions about Fowler-Style Refactoring

How do I install Fowler-Style Refactoring in Claude Code?

Run `npx skills add lhfer/claude-howto-zh-cn --skill refactor -a claude-code`. Or copy the skill folder (03-skills/refactor in lhfer/claude-howto-zh-cn) into .claude/skills/refactor in your project. Claude Code loads it when a task matches its description.

How do I install Fowler-Style Refactoring in Codex?

Run `npx skills add lhfer/claude-howto-zh-cn --skill refactor -a codex`. Or copy the skill folder (03-skills/refactor in lhfer/claude-howto-zh-cn) into .agents/skills/refactor in your project. Codex loads it when a task matches its description.

Can I use Fowler-Style Refactoring in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add lhfer/claude-howto-zh-cn --skill refactor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refactor, .gemini/skills/refactor, .github/skills/refactor and .opencode/skills/refactor in your project.

What does Fowler-Style Refactoring need to run?

Going by SKILL.md and its folder, Fowler-Style Refactoring needs Python for the scripts in its folder.

Does Fowler-Style Refactoring access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Fowler-Style Refactoring safe to install?

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. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Fowler-Style Refactoring use?

Fowler-Style Refactoring is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Fowler-Style Refactoring use?

About 156 tokens (SKILL.md is roughly 624 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 516 tokens, read only when the agent opens those files.

What are the alternatives to Fowler-Style Refactoring?

Skills that share tags, products or a category with Fowler-Style Refactoring: Code Refactoring Workflow (luongnv89/claude-howto, 42k stars), Refactoring Skill (Vietnamese) (luongnv89/claude-howto, 42k stars), Architecture Optimization (wondelai/skills, 2.4k stars) and Improve Code Quality (wondelai/skills, 2.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Fowler-Style Refactoring?

lhfer (a GitHub user) maintains it in lhfer/claude-howto-zh-cn, which has 2,306 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on August 6, 2026.

Source: lhfer/claude-howto-zh-cn on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.