prd2plan-new

[PRD2PLAN] sub-skill — responsible for Phase 7 (full design document template output), Phase 8 (cross-audit), Phase 9 (full OpenAPI YAML generation), and Phase 10 (full DDL SQL splitting). Auto-loaded by the prd2plan scheduler, for new-feature scenarios.

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-new" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-ecf7e847639bea2d6e4141e00859c19ae0ed032686768e2c894a04034a9484e9. Verify the upstream source and version against https://skillhub.cn/skills/user_a4c2f3d2/prd2plan-new 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

[PRD2PLAN] sub-skill — responsible for Phase 7 (full design document template output), Phase 8 (cross-audit), Phase 9 (full OpenAPI YAML generation), and Phase 10 (full DDL SQL splitting). Auto-loaded by the prd2plan scheduler, for new-feature scenarios.

0 Downloads

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

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: prd2plan-new
description: "[PRD2PLAN] 子 Skill —— 🟢全新功能场景。负责 Phase 7(全量设计文档模板输出)、Phase 8(交叉审计)、Phase 9(OpenAPI YAML 全量生成)、Phase 10(DDL SQL 全量拆分)。由 prd2plan 调度器自动加载。"

🟢 全新功能 —— 输出与交付

前置条件:prd2plan 调度器已完成 Phase 1~10(代码感知 → PRD 解析 → 场景分类 → 澄清 → 模块 → API → DB → 架构 → 资产打包),场景判定为 🟢 全新功能。

本 Skill 职责:Phase 10(接收设计资产) → Phase 7(全量设计文档) → Phase 8(审计) → Phase 9(全量 OpenAPI YAML) → Phase 10(全量 DDL SQL)。


Phase 10:获取设计资产 【强制】

在开始 Phase 7 前,必须从调度器获取《设计资产传递清单》中的以下数据,作为本文档生成的唯一依据——不得重新推导或猜测:

资产 用途 来源 Phase
项目感知卡片 文档第 0 章:技术栈、URL 前缀、响应格式、审计字段约定 Phase 3
场景判定结论 确认走 🟢 全量模板 Phase 4
模块划分图 + 模块明细表 + 状态机 文档第 2 章 Phase 6
资源建模表 + 接口清单 + DTO 字段定义 + 错误码清单 文档第 4 章 Phase 7
ER 关系 + 表结构 DDL + 索引设计 + 数据量预估 文档第 3 章 Phase 8
分层结构 + Service 职责表 + 时序图 + 技术决策 文档第 5 章 Phase 9
澄清记录 附录 A Phase 5

若缺少任一项,暂停并向调度器索取。


Phase 7:输出全量需求设计文档

7.1 文件命名

{feature-name}需求设计.md

{feature-name} 从 PRD 标题或核心功能中提取,用中文简洁描述,与 Phase 2 中确认的一致。

7.2 全量模板

# [项目名称] 技术设计文档

> 基于 PRD: [文件名] | 日期: YYYY-MM-DD | 版本: v1.0 | 场景: 全新功能

---

## 0. 项目感知(引用 Phase 10 感知卡片)
## 1. 需求概述(引用 Phase 2 需求提取清单)
## 2. 功能模块(含 Phase 6 状态机)
## 3. 数据模型(含 Phase 8 CREATE TABLE / 索引 / 数据量预估)
## 4. API 设计(含 Phase 7 资源建模 / 接口清单 / DTO / 错误码)
## 5. 架构设计(含 Phase 9 分层 / Service / 时序图 / 技术决策)
## 6. 非功能需求
## 7. 待办与风险
## 附录 A:澄清记录(引用 Phase 5 澄清记录)
## 附录 B:变更记录

7.3 质量标准(交付前自查)

A. 完整性检查

  • [ ] 每个功能点都有对应的 API 和表(功能→API→表 全链路覆盖)
  • [ ] 每个有状态的实体都画了状态机图
  • [ ] 每个 API 接口都有完整的 DTO 字段定义(不含"略"/"按需")
  • [ ] 每个模块都有全局唯一错误码清单
  • [ ] 核心流程至少 3 条时序图(正常 + 异常 + 边界)

B. 规范符合性检查

  • [ ] API URL:名词复数 / 短横线 / 层级 ≤3(design-api)
  • [ ] HTTP 方法语义正确:GET 不修改 / POST 创建 / PUT 全量 / DELETE 删除
  • [ ] 分页参数有硬上限(≤100),排序字段有白名单
  • [ ] 表/列/索引命名:小写+下划线 / 主键统一 / 外键有索引(design-db)
  • [ ] 每表有主键、审计字段(与 Phase 10 感知卡片中的项目审计字段约定一致)
  • [ ] 无 ENUM 类型、无 FLOAT/DOUBLE 存金额
  • [ ] Service 分层明确,Handler/Controller 不写业务逻辑(design-code)
  • [ ] 方法体量合理(预判 ≤ 建议上限),卫语句优先

C. 一致性检查

  • [ ] API 资源与 DB 表的 1:1 映射(交叉校验通过)
  • [ ] API 状态码枚举值与 DB COMMENT 注释值一致
  • [ ] DTO 字段驼峰名 ↔ 表列名下划线名可对应
  • [ ] 时序图中的调用链与 Service 职责表一致
  • [ ] 响应格式与 Phase 3 感知卡片中提取的项目统一格式一致

D. PRD 忠实度检查

  • [ ] 所有 PRD 中的歧义点已在 Phase 5 澄清,记录在附录 A
  • [ ] 没有硬编码假设(要么 PRD 明确,要么已提问确认)
  • [ ] 所有技术决策都有理由(不写"惯例"、"大家都这样")

Phase 8:交叉验证与质量审计

Phase 7 产出 {feature-name}需求设计.md 后,必须执行本阶段,这是质量兜底。

8.1 API ↔ DB ↔ 模块 三方对齐

画以下对照表,标注不匹配处:

| 功能点 | 模块 | API 端点 | 数据库表 | 状态 |
|--------|------|----------|----------|------|
| 创建订单 | 订单管理 | POST /{prefix}/orders | orders | ✅ |
| 查看订单 | 订单管理 | GET /{prefix}/orders/{id} | orders | ✅ |
| 订单审批 | 审批流程 | POST /{prefix}/orders/{id}/approve | orders + approval_records | ✅ |
| 批量导出 | [未设计] | ❌ 缺失 | orders | ⚠️ 待补充 |

8.2 状态机一致性扫描

遍历设计文档中所有状态字段,检查:

  • [ ] 状态机图覆盖了 API 中标注的所有状态码
  • [ ] 每个变迁在 API 清单中有对应接口
  • [ ] DB 列 COMMENT 中的枚举值与状态机一致

8.3 边界条件遍历

对每个接口,用以下问题逐个扫描:

□ 并发:两人同时提交怎么办?
□ 空值:列表为空时返回什么?
□ 超量:批量操作超过上限时返回什么?
□ 过期:Token/会话过期后调用会发生什么?
□ 重放:同一请求发两次会不会出问题?

发现缺口立即回到 Phase 5 格式提问。

8.4 数据流校验

选一个核心功能,从 UI 输入推导到 DB 写入,检查中间是否缺环节:

用户操作 → 前端请求 → API → Service → Repository → DB
                                                        ↓
用户看到 ← 前端渲染 ← API 响应 ← DTO ← Entity ← SELECT

任一环节缺失,标注 ⚠️ 数据流断裂。

8.5 审计签章

全部 5 项检查通过后,在设计文档末尾追加审计签章:

---
## 审计记录

| 审计项 | 结果 | 审计人 | 时间 |
|--------|------|--------|------|
| API↔DB↔模块 三方对齐 | ✅ / ⚠️ 待修复 | AI | YYYY-MM-DD |
| 状态机一致性 | ✅ / ⚠️ 待修复 | AI | YYYY-MM-DD |
| 边界条件覆盖 | ✅ / ⚠️ 待修复 | AI | YYYY-MM-DD |
| 数据流完整性 | ✅ / ⚠️ 待修复 | AI | YYYY-MM-DD |
| OpenAPI YAML 覆盖率(100% API) | ✅ / ⚠️ 待修复 | AI | YYYY-MM-DD |

只有 全部 ✅ 才能交付。


Phase 9:生成全量 OpenAPI YAML

9.1 文件命名

{feature-name}_openapi.yaml

存放位置:与设计文档同目录。

9.2 生成规则

从 Phase 10 传递的设计资产中提取以下信息映射到 OpenAPI 3.0:

设计文档中的内容 OpenAPI 映射
接口清单 (Phase 7) 中的方法+URL paths → {method}: {url}
DTO 字段定义 (Phase 7) components.schemas → JSON Schema
错误码清单 (Phase 7) components.schemas.ErrorResponse + 每个接口的 responses
接口清单中的说明 summary / description
接口清单中的认证/权限 security

9.3 格式骨架

所有具体字段从 Phase 7 设计资产中提取,不套用示例中的业务名:

openapi: "3.0.3"
info:
  title: "{feature-name} API"
  description: "基于 {feature-name}需求设计.md 自动生成"
  version: "1.0.0"

servers:
  - url: "{Phase 3 感知卡片中的 base URL}"
    description: "开发环境"

paths:
  {prefix}/{resource}:
    get:
      summary: "查询{资源}列表"
      tags: ["{模块名}"]
      parameters:
        - name: page
          in: query
          schema:
            type: integer
            default: 1
        - name: pageSize
          in: query
          schema:
            type: integer
            default: 20
            maximum: 100
        # ... 其他筛选参数从 Phase 7 接口清单提取
      responses:
        "200":
          description: "成功"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/{Resource}ListResponse"
        "400":
          $ref: "#/components/responses/BadRequest"

  {prefix}/{resource}/{id}:
    get:
      summary: "查询{资源}详情"
      # ... 从 Phase 7 接口清单提取

components:
  schemas:
    ApiResponse:
      # Phase 3 感知卡片中的统一响应格式
    PaginatedData:
      # 分页结构
    ErrorResponse:
      # Phase 7 错误码清单映射

  responses:
    BadRequest:
      description: "参数校验失败"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    Conflict:
      description: "资源冲突"
      # ...
    NotFound:
      description: "资源不存在"
      # ...
    # 从 Phase 7 错误码清单补充所有错误响应

9.4 质量要求

  • [ ] 覆盖设计文档中 100% 的 API 接口(不遗漏任何一个)
  • [ ] 每个接口的 Request/Response Schema 字段与 Phase 7 DTO 定义一致
  • [ ] 每个接口标注所有可能的错误响应码(来自 Phase 7 错误码清单)
  • [ ] 使用 $ref 消除重复 Schema 定义
  • [ ] 分页参数有 maximum 硬上限
  • [ ] 响应 Schema 与 Phase 3 感知卡片中的项目统一响应格式一致

Phase 10:拆分全量 DDL SQL 文件

10.1 输出结构

从 Phase 8 的数据模型提取 DDL,为每张表生成独立 SQL 文件,遵循 Flyway 命名规范(Java 生态标准数据库迁移工具):

sql/{feature-slug}/
├── V1.0__create_{table_name}.sql
├── V1.1__create_{table_name}.sql
└── ...
  • {feature-slug} 使用英文短横线命名(如 order-management),避免中文路径在 CI/CD 中出现编码问题
  • Flyway 按 V 前缀 + 版本号排序执行,天然保证了外键依赖顺序

10.2 拆分规则

  1. 从 Phase 8 表结构设计中,每个 CREATE TABLE 语句拆为独立文件
  2. 文件名格式:V{major}.{minor}__create_{表名}.sql,版本号按 ER 关系依赖排序(先主表后子表)
  3. 每个文件开头加注释头:
-- ============================================
-- 表名: {table_name}
-- 说明: {COMMENT}
-- 来源: {feature-name}需求设计.md §3.2
-- 生成日期: YYYY-MM-DD
-- ============================================

10.3 生成示例

sql/order-management/
├── V1.0__create_orders.sql          -- 主表:订单
├── V1.1__create_order_items.sql     -- 子表:订单项(依赖 orders)
├── V1.2__create_payments.sql        -- 子表:支付记录(依赖 orders)
└── V1.3__create_order_logs.sql      -- 日志表

10.4 与 Flyway 集成

Flyway 是 Java 生态标准的数据库迁移工具(Spring Boot 内置支持),无需手写 00_all.sql 合并脚本。

使用方式:

  • Spring Boot 自动执行:将 SQL 文件放入 src/main/resources/db/migration/,应用启动时 Flyway 自动按版本号顺序执行
  • 手动执行:mvn flyway:migrate 或使用 Flyway CLI
  • 纯 SQL 回退:若项目未集成 Flyway,仍可按版本号顺序手动执行每个 .sql 文件(mysql < V1.0__create_xxx.sql)

10.5 质量要求

  • [ ] 每张表一个 SQL 文件,不遗漏
  • [ ] Flyway 版本号按外键依赖排序(主表版本号小)
  • [ ] 每个 SQL 文件可独立执行(含完整 DDL)
  • [ ] 索引随 CREATE TABLE 一并写入(不在单独文件)
  • [ ] 目录名使用英文短横线命名(如 order-management)
  • [ ] 审计字段与 Phase 3 感知卡片中项目约定一致

禁止事项(🟢 全新功能)

  • ❌ 🟢场景按🟡/🔵/⚪模板输出(必须用全量需求设计模板)
  • ❌ 跳过 Phase 10 资产获取,基于不完整信息生成文档
  • ❌ 跳过 Phase 8 审计直接交付
  • ❌ 审计未全部通过就跳过 Phase 9/10
  • ❌ OpenAPI YAML 遗漏接口 / Schema 字段与 Phase 7 设计资产不一致
  • ❌ DDL SQL 不分文件、不排序、不可独立执行
  • ❌ DDL SQL 目录名使用中文(可能导致 CI/CD 编码问题)
  • ❌ 输出文件命名不按场景分类(必须用 需求设计.md 后缀)

Current listing version

1.0.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 面向全新功能场景,提供从设计文档到 OpenAPI YAML、DDL SQL 的全链路自动化输出
  • 显著提升工程化交付效率,解决 PRD 到技术资产转换的高频痛点
Trigger Precision95/100

Highlights

  • 触发条件清晰限定为 🟢 全新功能场景,由 prd2plan 调度器自动加载,边界明确
Structure and Standards93/100

Areas to improve

  • 缺少独立 When to Use 章节 Reported severity: Minor

    文档中前置条件已说明使用场景,但未设独立 When to Use 章节

    Recommendation: 建议在 Phase 10 前增加独立 When to Use 章节,提升可读性

Highlights

  • Phase 划分清晰,步骤完整,出口条件明确
  • 包含端到端示例和完整模板,frontmatter 规范
Execution Reliability91/100

Highlights

  • 资产缺失暂停机制、审计兜底检查、Flyway 标准工具集成,保障执行可靠性
Evidence Verifiability (mean of the first four)93/100

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.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

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.