prd2plan-refactor
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "prd2plan-refactor" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c5a7dfaa0312afe0deb87acfe48efb2765609a5473bc9c9611c1014f2b847aee. Verify the upstream source and version against https://skillhub.cn/skills/user_a4c2f3d2/prd2plan-refactor before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Sub-skill: Refactoring/optimization scenario. Responsible for Phase 7 (output refactor design document template) and Phase 8 (cross-audit). No API/DB changes, does not generate YAML/SQL. Automatically loaded by the prd2plan scheduler.
Introduction source: third_party · user_a4c2f3d2 · 1.0.1 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Inputs and outputs
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: prd2plan-refactor
description: "[PRD2PLAN] 子 Skill —— ⚪重构优化场景。负责 Phase 7(重构设计文档模板输出)、Phase 8(交叉审计)。无 API/DB 变更,不生成 YAML/SQL。由 prd2plan 调度器自动加载。"⚪ 重构优化 —— 输出与交付
前置条件:prd2plan 调度器已完成 Phase 1~10,场景判定为 ⚪ 重构优化。
本 Skill 职责:Phase 10(接收设计资产) → Phase 7(重构设计文档) → Phase 8(审计)。无 API/DB 变更,不生成 YAML/SQL。
Phase 10:获取设计资产 【强制】
在开始 Phase 7 前,必须从调度器获取以下资产——不得重新推导或猜测:
| 资产 | 用途 | 来源 Phase |
|---|---|---|
| 项目感知卡片 | 代码组织、现有 Service/Controller 清单、框架约定 | Phase 3 |
| 场景判定结论 | 重构范围、不涉及的模块 | Phase 4 |
| 模块设计(新旧架构对比) | 文档 §1 架构对比 | Phase 6 |
| 架构设计(Service 职责、调用链) | 文档 §2 重构步骤 | Phase 6 |
| 澄清记录(含等价性、回滚讨论) | 附录 A | Phase 5 |
若缺少任一项,暂停并向调度器索取。
Phase 7:输出重构设计文档
7.1 文件命名
{feature-name}重构设计.md
7.2 重构设计模板
不涉及 API/DB 变更,重点在架构对比:
# [重构名称] 重构设计文档
> 基于 PRD: [文件名] | 日期: YYYY-MM-DD | 版本: v1.0 | 场景: 重构优化
---
## 0. 重构概览
### 0.1 现状问题
- 可量化的问题描述(如:XxxServiceImpl 1200 行,包含 4 种职责)
- 当前架构痛点
### 0.2 重构目标
- 要达成的具体效果(如:每个 Service < 300 行,职责单一)
### 0.3 重构范围(基于 Phase 4 场景判定)
- 会变的模块/文件清单
- 明确不变的部分(防止范围蔓延)
## 1. 架构对比
### 1.1 Before(现状架构图,来自 Phase 6 设计资产)
### 1.2 After(目标架构图)
### 1.3 变更清单
| 文件 | 变更类型 | 说明 | 新文件(如拆分) |
|------|----------|------|-----------------|
| XxxServiceImpl | 拆分 | 拆为 A/B/C 三个 Service | AServiceImpl / BServiceImpl / CServiceImpl |
| ... | ... | ... | ... |
## 2. 重构步骤
### Step 1: xxx — 预计工时
### Step 2: xxx — 预计工时
### Step 3: xxx — 预计工时
(步骤必须可独立验证,每步完成后可运行测试确认等价性)
## 3. 等价性验证
| 验证点 | 验证方式 | 预期结果 |
|--------|----------|----------|
| API 响应一致 | 对比重构前后接口 JSON | 完全一致 |
| DB 操作结果一致 | 对比重构前后 SQL 输出 | 完全一致 |
| 异常行为一致 | 同样输入触发同样异常 | 异常类型+message 一致 |
## 4. 风险评估与回滚方案
| 风险 | 概率 | 影响 | 缓解 | 回滚方式 |
|------|------|------|------|----------|
| 拆分后事务边界变化 | 中 | 高 | Step1 先不动事务 | Git revert |
## 5. 时间线
| 阶段 | 内容 | 预计工时 | 依赖 |
|------|------|----------|------|
| Step 1 | ... | ... | — |
## 附录 A:澄清记录(引用 Phase 10 澄清记录)
## 附录 B:变更记录
7.3 质量标准
A. 完整性检查
- [ ] 现状问题描述清晰(可量化的问题)
- [ ] 重构目标明确(解决什么问题,达成什么效果)
- [ ] Before/After 架构对比图完整
- [ ] 变更清单覆盖所有受影响文件
- [ ] 重构步骤可执行(Step by Step,每步可独立验证)
B. 规范符合性检查
- [ ] 重构后的架构符合 design-code 规范
- [ ] 方法拆分合理(体量可控)
- [ ] 职责单一(一个 Service 只做一件事)
- [ ] 抽象层次正确(接口隔离、依赖倒置)
C. 一致性检查
- [ ] 等价性验证点覆盖所有对外接口
- [ ] 风险评估合理,有缓解措施
- [ ] 回滚方案可行
D. PRD 忠实度检查
- [ ] 重构范围不超过 PRD 定义和 Phase 4 场景判定范围
- [ ] 没有借重构之名塞入新功能
Phase 8:交叉验证与质量审计
Phase 7 产出 {feature-name}重构设计.md 后,必须执行本阶段。
8.1 变更影响分析
| 变更文件 | 影响范围 | 依赖方 | 是否需要协调 | 状态 |
|----------|----------|--------|-------------|------|
| XxxServiceImpl(拆分) | TaskController 调用方 | 前端接口 | 否(接口不变) | ✅ |
| YyyServiceImpl(合并) | ReportServiceImpl | 无 | 否 | ✅ |
8.2 等价性校验
- [ ] 所有对外 API 的请求/响应结构不变
- [ ] 所有数据库操作的输入输出不变
- [ ] 副作用(日志、通知、缓存)行为不变
- [ ] 异常抛出行为不变(同样条件抛同样异常)
8.3 边界条件遍历
□ 事务边界:拆分后,原来一个事务内的操作现在跨 Service/跨代理调用?
→ 注意框架代理机制:同类内部调用可能不触发代理,事务/切面可能失效!
□ 循环依赖:新拆的 Service 会不会产生 A→B→A 的循环依赖?
□ 线程安全:拆出的 Service 是否仍然线程安全(共享状态检查)?
□ 测试覆盖:重构前后有没有自动化测试保证等价性?
8.4 复杂度校验
- [ ] 拆分后的每个方法体量合理(预判在可维护范围内)
- [ ] 没有产生新的超大类(任何类保持合理行数)
- [ ] 依赖深度 ≤3 层
- [ ] 没有重复代码(拆分出的公共逻辑已提取)
8.5 审计签章
---
## 审计记录
| 审计项 | 结果 | 审计人 | 时间 |
|--------|------|--------|------|
| 变更影响分析 | ✅ / ⚠️ 待修复 | AI | YYYY-MM-DD |
| 等价性校验 | ✅ / ⚠️ 待修复 | AI | YYYY-MM-DD |
| 边界条件覆盖 | ✅ / ⚠️ 待修复 | AI | YYYY-MM-DD |
| 复杂度校验 | ✅ / ⚠️ 待修复 | AI | YYYY-MM-DD |
只有 全部 ✅ 才能交付。
Phase 9:跳过
重构优化不改变 API,不生成 OpenAPI YAML。× 跳过。
Phase 10:跳过
重构优化不涉及 DDL 变更,不生成 SQL 文件。× 跳过。
禁止事项(⚪ 重构优化)
- ❌ ⚪场景输出 API 设计或 DDL(重构不改变外部接口和数据模型)
- ❌ 跳过 Phase 10 资产获取
- ❌ 重构范围超出 Phase 4 场景判定的范围(借重构加新功能)
- ❌ 不画 Before/After 架构对比图
- ❌ 不验证等价性(可能导致接口行为变化)
- ❌ 不检查框架代理自调用陷阱(同类方法调用时拦截器/事务可能不生效)
- ❌ 不提供回滚方案
- ❌ 新架构违反 design-code 规范
- ❌ 跳过 Phase 8 审计直接交付
- ❌ 输出文件命名不用
重构设计.md后缀
Current listing version
1.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 作为 prd2plan 调度器的子 Skill,专门负责重构优化场景的设计文档输出与审计
- 直接解决架构重构中的标准化、风险控制、等价性验证等核心痛点
- 显著提升重构效率与质量,避免重构过程中引入隐性缺陷
Highlights
- 触发词精准完整,明确限定为 'prd2plan 子 Skill'、'重构优化场景'
- 前置条件清晰,边界明确,不易误触或漏触
Highlights
- Phase/步骤清晰,有明确的出口条件
- 包含完整的重构设计模板和端到端示例
- frontmatter 完整,单文件结构清晰易读
Highlights
- 包含完整的审计签章机制,确保交付质量
- 覆盖等价性验证、边界条件遍历、复杂度校验等关键检查点
- 提供明确的风险评估与回滚方案
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.