
Cs Refactor
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-codeInstalls 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- Cs Refactor Ff1.2K
- Cs Req1.2K
- Cs Roadmap1.2K
- Cs Arch1.1K
- Cs Decide1.1K
- Cs Explore1.1K
- Cs Guide1.1K
- Cs Learn1.1K
- Cs Libdoc1.1K
- Cs Trick1.1K
- Cs Note1K
- Cs Audit942
- Browser Bridge672
- Cs1.2K
- Cs Brainstorm1.2K
- Cs Feat1.2K
- Cs Feat Accept1.2K
- Cs Feat Design1.2K
- Cs Feat Ff1.2K
- Cs Feat Impl1.2K
- Cs Issue1.2K
- Cs Issue Analyze1.2K
- Cs Issue Fix1.2K
- Cs Issue Report1.2K