🛠️
QualityPython

Refactor Expert

by val1813

Refactor Expert is a Quality skill for Claude Code, published by val1813 in kwcode.

688 stars92 forkson val1813/kwcodeAdded 2026/08/12Repository updated 2026/05/14
Install in seconds
Install Refactor Expert
Copy Refactor Expert into your Claude Code skills folder. Run the command in your terminal, or review the source on GitHub before installing.
terminal
npx degit https://github.com/val1813/kwcode/tree/master/kaiwu/builtin_experts/refactor ~/.claude/skills/refactor

Requires Node.js. Downloads this skill only — not the rest of the repository — into your Claude Code skills folder.

Without Node.js

git clone https://github.com/val1813/kwcode.git

Clones the whole repository, then copy the skill’s own directory into your skills folder yourself.

In this catalog

Source file
kaiwu/builtin_experts/refactor/SKILL.md in val1813/kwcode
Installs to
~/.claude/skills/refactor
Collection
One of 19 skills cataloged from this repository
Category
Quality1354 skills

What Refactor Expert does

Refactor Expert helps restructure Python code one change at a time while preserving behavior. Use it to split long functions, remove duplication, simplify conditionals, and verify the refactor with tests.

Refactor Expert is cataloged under Quality on DirSkills.

Documentation

README

领域知识

  • 每次只做一种重构,不混合多种变更,便于验证行为一致
  • 代码坏味道识别:重复代码→提取函数、过长函数→拆分、深层嵌套→提前返回/卫语句
  • SOLID原则:单一职责(类只做一件事)、开闭(扩展开放修改关闭)、依赖倒置(依赖抽象不依赖具体)
  • 提取函数:3行以上重复代码或逻辑独立片段,命名体现意图而非实现
  • 简化条件:复杂if/else链改为策略模式或查表法
  • 消除魔法数字:提取为命名常量,放在文件顶部或配置中
  • 参数过多(>4个):封装为数据类/字典/配置对象
  • 重构前确保有测试覆盖,重构后运行测试验证行为不变
  • 不改变公开API签名,除非调用方也在重构范围内
  • 大范围重构分步提交:先提取→再替换调用→最后删除旧代码

经验规则(自动生成)

Frequently asked about Refactor Expert

  • What else does val1813 publish alongside Refactor Expert?

    Refactor Expert is one of 19 skills that DirSkills catalogs from val1813/kwcode, the repository it ships in. Its siblings there include API Expert, Bug Fix Expert and DeepSeek API Expert. Each one is a separate skill with its own page in this directory, installs the same way Refactor Expert does, and is maintained by val1813 in that same repository. The rest of the collection is listed on the val1813/kwcode page.

  • How does Refactor Expert compare to other Quality skills?

    Refactor Expert ranks #1053 by stars among the 1354 Quality skills in this catalog. The most-starred ones next to it are Benchmark, Benchmark Optimization Loop and API Design Patterns. DirSkills ranks by the star count of the repository each skill ships in, so that order reflects how popular those repositories are rather than any review of Refactor Expert against them. Open each page to compare what they document and how they install.

More from val1813/kwcode

Refactor Expert is one of 19 skills cataloged on DirSkills from val1813/kwcode.

See all 19 skills