关于 request-refactor-plan
该 skill 指导 Agent 与用户共同梳理重构需求、核查代码库,并将决策和测试要求整理成细粒度提交计划。最终按指定模板创建 GitHub issue,明确范围、方案与待办事项。
主要功能
- 01访谈并澄清重构问题
- 02探索代码库并核实现状
- 03比较替代方案并确定范围
- 04检查测试覆盖并讨论测试计划
- 05拆分为保持可运行状态的细小提交
- 06按模板创建 GitHub issue
适用场景
- 01将模糊的重构想法转成明确请求
- 02在实施前记录架构与接口决策
- 03为重构安排细粒度提交步骤
- 04整理测试策略和范围外事项
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ vinvcn/ mattpocock-skills-zh-cn --skill request-refactor-plan安装后在 Claude Code 中输入/request-refactor-plan确认已加载。
附带文件agents/openai.yaml
详细介绍
来自项目 README当用户想创建 refactor request 时调用此 skill。按以下步骤执行。你可以跳过你认为不必要的步骤。
-
让用户详细描述他们想解决的问题,以及可能的 solution ideas。
-
探索 repo,验证他们的 assertions,并理解 codebase 当前状态。
-
询问他们是否考虑过其他 options,并向他们展示其他 options。
-
围绕 implementation 访谈用户。要非常详细、彻底。
-
敲定 implementation 的 exact scope。弄清你计划改什么,以及不改什么。
-
在 codebase 中检查该区域的 test coverage。如果 coverage 不足,询问用户的 testing plans。
-
把 implementation 拆成 tiny commits 的计划。记住 Martin Fowler 的建议:“make each refactoring step as small as possible, so that you can always see the program working.”
-
使用 refactor plan 创建 GitHub issue。issue description 使用下面模板:
Problem Statement
developer 面对的问题,从 developer 视角描述。
Solution
问题的 solution,从 developer 视角描述。
Commits
一份很长、详细的 implementation plan。用 plain English 写,把 implementation 拆到尽可能小的 commits。每个 commit 都应让 codebase 保持 working state。
Decision Document
已作出的 implementation decisions 列表。可以包括:
- 将 build/modify 的 modules
- 将 modify 的 module interfaces
- 来自 developer 的 technical clarifications
- Architectural decisions
- Schema changes
- API contracts
- Specific interactions
不要包含具体 file paths 或 code snippets。它们可能很快过时。
Testing Decisions
已作出的 testing decisions 列表。包括:
- 什么是好测试的描述(只测试 external behavior,不测试 implementation details)
- 哪些 modules 会被测试
- 测试的 prior art(即 codebase 中类似类型的 tests)
Out of Scope
本 refactor 范围外事项的描述。
Further Notes (optional)
关于 refactor 的其他 notes。