This is a structured three-phase refactoring workflow that forces you to scan for issues, design a plan, and apply changes one step at a time with human checkpoints between each. It exists because AI tends to either miss equivalence constraints or blow past context limits when refactoring. The scan phase runs seven preflight checks to route you elsewhere if you're actually fixing a bug or adding features, then produces a checklist of concrete problems mapped to a built-in methods library covering parallel change, strangler fig, and the usual extract-method stuff. Each apply step blocks until you confirm it worked, either through tests or by clicking through the UI. There's a fastforward mode for single-function tweaks, but the main path assumes you don't trust the AI to rewrite three files at once without supervision.

skills.sh installs
1.2K
GitHub stars
1.1K
last updated
Jul 14, 2026

Install

$ npx -y skills add liuzhengdongfortest/codestable --skill cs-refactor --agent claude-code

Installs into .claude/skills of the current project.

Files

cs-refactor

改结构,不改行为,并且能证明行为没变。

开工

  • 有 .codestable/attention.md 就先读。
  • 按目标模块关键词检索 .codestable/lessons/、项目文档,以及存在的 v1 只读知识目录:.codestable/roadmap/、.codestable/features/、.codestable/issues/、.codestable/refactors/、.codestable/goals/、.codestable/compound/、.codestable/audits/、.codestable/brainstorms/、.codestable/feedback/;命中要报告来源路径。上述 v1 目录不得继续生成、原地改写或批量迁移,新结论按归属进入 v2 Epic、项目文档、ADR 或 lesson。
  • 先确认诉求真是行为不变:一旦包含"顺便支持 X / 改成 Y",把那部分拆出去转 cs-feat 或 cs-issue,不夹带。
  • 结构好坏用深度衡量:小接口承载大行为是深,接口和实现一样复杂是浅;重构应让调用方用更少认知换更多能力,不为"看起来干净"搬家,不把模块越拆越碎。

持续学习

检索到 lesson 后先做 read-repair。只做一次有界、最低成本的定向核实,优先读取已有代码、测试或 canonical 文档;不得仅为核实 lesson 运行大范围测试或反复复现。仍不足时跳过该 lesson,不阻塞正常任务。 只有 scope 符合、未退役、当前事实成立,并真实改变计划或验证,或明确排除一个具体且合理的错误路径 的条目才算有效命中;按 经验命中:{path}({status});核验:{fact};影响:{plan_or_check} 报告。retired 不应用; observed / validated 先核实再用;旧 lesson 缺 status 按 observed 读取,不批量迁移。只是相关 但没有改变行为时不制造复用证据;当前事实明确反证时立即停止应用,证据不足时不猜。

任务内只在内存保留最多 3 条候选,按新证据替换低价值项,不暂停或询问。强信号只包括:owner 纠正实际改变方案/代码/术语/验证;可复现证据推翻根因;同一路径失败两次后更换假设; blocking/important finding 暴露未编码不变量;新 red -> green 捕获可复发失败;lesson 真实改变本次行为 或被反证;重复 workaround;方法显著降低重试、成本或风险。

Sponsors

Details

Repository
github.com/liuzhengdongfortest/codestable
Category
Code Review & Quality
First seen
May 16, 2026

More from liuzhengdongfortest/codestable

All 26
1sickn33 avatararchitecturesickn33/antigravity-awesome-skillsarchitecture1.2Kskills.sh installs
2mastepanoski avatarui-design-reviewmastepanoski/claude-skillsComprehensive visual design and aesthetics evaluation. Analyzes typography, color, spacing, hierarchy, consistency, branding, and current product-category conve1.2Kskills.sh installs
3ruvnet avataragent-repo-architectruvnet/rufloAgent skill for repo-architect - invoke with $agent-repo-architect1.2Kskills.sh installs
4decebals avatarjava-code-reviewdecebals/claude-code-javaSystematic code review for Java with null safety, exception handling, concurrency, and performance checks. Use when user says "review code", "check this PR", "c1.1Kskills.sh installs
5jnmetacode avatarreceiving-code-reviewjnmetacode/superpowers-zh收到代码审查反馈后、实施建议之前使用,尤其当反馈不明确或技术上有疑问时——需要技术严谨性和验证,而非敷衍附和或盲目执行1.1Kskills.sh installs
6theqtcompanyrnd avatarqt-cpp-reviewtheqtcompanyrnd/agent-skills>-1.1Kskills.sh installs