بنقرة واحدة
pdd-generate-spec
根据功能点矩阵生成开发规格和验收标准。当用户想要生成功能点的技术规格时调用此Skill。支持中文触发:生成规格、开发规格、技术规格、PDD规格。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
根据功能点矩阵生成开发规格和验收标准。当用户想要生成功能点的技术规格时调用此Skill。支持中文触发:生成规格、开发规格、技术规格、PDD规格。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
"PDD框架下的业务分析Skill,运用专业方法论进行需求分析和业务建模。当用户输入/analyze、/audit、/doc等命令,或需要对业务流程、管理制度、Excel表单进行专业分析时触发。支持中文触发:业务分析、需求分析、需求建模、5W1H分析、MECE、流程分析。"
"PDD熵减智能体,持续监控和偿还技术债务,防止系统腐化。当用户需要代码清理、文档更新、技术债务管理、架构对齐、熵减、垃圾回收、清理技术债务时自动触发。即使用户只说'熵减'、'清理技术债务'或'垃圾回收',也应触发此Skill。支持中文触发:熵减、技术债务、代码清理、文档更新、架构对齐、垃圾回收。"
根据开发规格实现功能点代码的核心Skill。当用户想要开始编码实现、根据规格文档生成代码、实现功能点时调用此Skill。此Skill会自动调用pdd-template-engine生成基础代码框架,然后由software-engineer补充业务逻辑。即使只有规格文档没有明确说'实现',只要涉及代码生成、功能开发,都应触发此Skill。支持中文触发:实现功能点、编码实现、开始编码、功能开发、代码实现、PDD实现。
PRD驱动开发的主入口Skill,协调整个开发流程。当用户想要基于PRD文档进行功能开发、从需求文档生成代码、执行PDD方法论流程、开发业务模块、实现完整功能、'搞个功能'、'资产转让'、'国有产权转让'、'帮我搞个资产转让的功能'时必须调用此Skill。即使用户没有明确说'使用PDD',只要涉及PRD文档、需求文档、功能点开发、规格文档、模块开发、根据文档开发、业务功能实现、'开发ZCCZ'、'我想开发'、'搞个功能'等场景,都应触发此Skill。此Skill会自动协调pdd-ba、pdd-extract-features、pdd-generate-spec、pdd-implement-feature等子Skill完成从需求分析到代码交付的完整流程。注意:单一接口设计、调试问题、文档查询等场景不应触发此Skill。支持中文触发:PRD驱动开发、PDD开发、功能开发、启动PDD。
"交通事故责任评估与判定专业技能。当用户需要交通事故责任分析、事故现场照片评估、交通法规咨询、事故责任划分、法律依据查询时触发此技能。适用于车辆碰撞事故、行人事故、非机动车事故等各类道路交通事故的责任认定场景。无论用户使用'交通事故'、'车祸'、'责任判定'、'交通法规'、'事故定责'等何种表述,只要涉及交通事故评估或责任认定,均应调用此技能。支持中文触发:交通事故、车祸、责任判定、交通法规、事故定责、责任划分、事故评估、追尾、碰撞、违章、赔偿。"
自动化重构专家技能,将收集到的质量改进任务转化为具体的代码操作。当用户需要代码重构、消除重复、简化复杂度时自动触发。即使用户只说'重构代码'、'消除重复'或'简化代码',也应触发此Skill。支持中文触发:重构代码、消除重复、简化复杂度、自动重构、代码重构、PDD重构。
| name | pdd-generate-spec |
| description | 根据功能点矩阵生成开发规格和验收标准。当用户想要生成功能点的技术规格时调用此Skill。支持中文触发:生成规格、开发规格、技术规格、PDD规格。 |
根据功能点矩阵和业务分析报告,为每个功能点生成详细的开发规格文档(spec.md)和验收标准(checklist.md)。
输入: feature-matrix.md(功能点矩阵) | 业务分析报告 | 输出: spec.md(开发规格) | checklist.md(验收标准) | 不负责: 代码实现/测试执行
Based on the feature matrix and business analysis report, generate detailed development specification documents (spec.md) and acceptance criteria (checklist.md) for each feature point.
Input: feature-matrix.md (Feature Matrix) | Business Analysis Report | Output: spec.md (Development Specification) | checklist.md (Acceptance Criteria) | Not Responsible For: Code implementation / Test execution
# [模块名称] 开发规格
## 基本信息
| 项目 | 内容 |
|------|------|
| 功能点ID | FP-XXX-NNN |
| 版本 | v1.0 |
| 日期 | YYYY-MM-DD |
## 1. 接口定义
### 1.1 API列表
| 序号 | 方法 | 路径 | 描述 | 认证 |
### 1.2 接口详情
#### POST /api/{module}/create
**请求参数**: 字段名/类型/必填/说明
**响应结构**: code/msg/data
**错误码**: 错误码/描述/处理方式
## 2. 数据模型
### 2.1 实体关系图(文字描述)
实体间的关系和依赖
### 2.2 数据表设计
| 字段名 | 类型 | 必填 | 说明 |
|--------|------|------|------|
### 2.3 枚举值定义
| 字段 | 值 | 含义 |
## 3. 业务逻辑
### 3.1 处理流程
1.[步骤] → 2.[步骤] → 3.[步骤]
### 3.2 业务规则
| 规则ID | 规则描述 | 约束类型 | 优先级 |
### 3.3 状态转换
当前状态 → 条件/事件 → 目标状态
## 4. 前端页面设计
### 4.1 页面清单
| 页面 | 路径 | 类型 |
### 4.2 表单字段
| 字段名 | 组件类型 | 校验规则 |
## 5. 权限与安全
### 5.1 接口权限
| 路径 | 权限标识 | 角色 |
### 5.2 数据权限
| 操作 | 数据范围 |
## 6. 前端实现约定
### 6.1 页面组件
- 页面路径: /{module}
- 组件文件: {ModuleName}View.vue
- 布局: AppLayout + ContentArea
### 6.2 表单字段映射
| 字段 | 组件 | 数据源API | 默认值 | 校验规则 |
|------|------|----------|--------|---------|
| (根据PRD 4.4节填写) | | | | |
### 6.3 操作按钮矩阵
| 状态 | 创建者 | 评估师/审批人 | 其他人 |
|------|--------|-------------|--------|
| (根据PRD 7.1节填写) | | | |
### 6.4 列表表格列定义
| 列名 | 字段 | 宽度 | 排序 | 筛选 |
|------|------|------|------|------|
## 7. 关联数据源(Options接口)
### 7.1 需要的Options接口
| 接口 | 路径 | 返回格式 | 过滤参数 |
|------|------|---------|---------|
| (根据PRD 4.5节填写) | | | |
### 7.2 Options接口设计规则
- 路由必须在 /{id} 之前定义(避免路由冲突)
- 返回轻量数据(仅id+显示字段)
- 支持query参数过滤(如 ?role=evaluator)
## 8. 路由注册与命名约定
### 8.1 路由注册顺序(必须严格遵守)
1. /me (当前用户)
2. / (列表)
3. /options (下拉选项) — 必须在 /{id} 之前!
4. /{id} (详情)
5. POST / (创建)
6. PUT /{id} (更新)
7. DELETE /{id} (删除)
### 8.2 文件命名约定
- API路由: {module_name}.py
- Service: {module_name}_service.py
- Schema: {module_name}.py (在schemas目录)
- Model: {module_name}.py (在models目录)
- Vue组件: {ModuleName}View.vue (PascalCase)
## 9. 依赖检查清单
### 9.1 前置依赖(必须满足才能开始开发)
- [ ] **部门管理模块**已就绪
- 验证: curl GET /departments/options → 返回≥1条记录
- 如果未就绪: 先实现 FP-INFRA-001
- [ ] **种子数据**已初始化
- 验证: python seed_base_data.py 执行成功
- 如果未就绪: 先运行种子脚本
- [ ] **认证中间件**已配置
- 验证: POST /auth/login → 返回access_token
### 9.2 本功能产生的后续依赖
- [ ] 本功能的 /options 端点将被 FP-XXX 依赖
# [功能点名称] 验收标准
## 业务验收标准
| 序号 | 验收项 | 预期结果 | 验证方法 |
|------|-------|---------|---------|
## 技术验收标准
| 序号 | 验收项 | 标准 | 验证方法 |
|------|-------|------|---------|
## 集成验收标准
| 序号 | 验收项 | 标准 | 验证方法 |
# [Module Name] Development Specification
## Basic Information
| Item | Content |
|------|---------|
| Feature Point ID | FP-XXX-NNN |
| Version | v1.0 |
| Date | YYYY-MM-DD |
## 1. API Definition
### 1.1 API List
| No. | Method | Path | Description | Auth |
### 1.2 API Details
#### POST /api/{module}/create
**Request Parameters**: Field Name / Type / Required / Description
**Response Structure**: code / msg / data
**Error Codes**: Error Code / Description / Handling
## 2. Data Model
### 2.1 Entity Relationship Diagram (Text Description)
Relationships and dependencies between entities
### 2.2 Database Table Design
| Field Name | Type | Required | Description |
|------------|------|----------|-------------|
### 2.3 Enumeration Value Definitions
| Field | Value | Meaning |
## 3. Business Logic
### 3.1 Processing Flow
1.[Step] → 2.[Step] → 3.[Step]
### 3.2 Business Rules
| Rule ID | Rule Description | Constraint Type | Priority |
### 3.3 State Transitions
Current State → Condition/Event → Target State
## 4. Frontend Page Design
### 4.1 Page List
| Page | Path | Type |
### 4.2 Form Fields
| Field Name | Component Type | Validation Rules |
## 5. Permissions & Security
### 5.1 API Permissions
| Path | Permission Identifier | Role |
### 5.2 Data Permissions
| Operation | Data Scope |
## 6. Frontend Implementation Conventions
### 6.1 Page Components
- Page path: /{module}
- Component file: {ModuleName}View.vue
- Layout: AppLayout + ContentArea
### 6.2 Form Field Mapping
| Field | Component | Data Source API | Default | Validation |
|-------|-----------|---------------|---------|------------|
| (Fill from PRD Section 4.4) | | | | |
### 6.3 Action Button Matrix
| Status | Creator | Reviewer | Others |
|--------|---------|----------|--------|
| (Fill from PRD Section 7.1) | | | |
### 6.4 List Table Column Definition
| Column | Field | Width | Sortable | Filterable |
|--------|-------|-------|----------|------------|
## 7. Related Data Sources (Options APIs)
### 7.1 Required Options APIs
| API | Path | Response Format | Filter Params |
|-----|------|----------------|---------------|
| (Fill from PRD Section 4.5) | | | |
### 7.2 Options API Design Rules
- Route MUST be defined before /{id} (avoid route conflicts)
- Return lightweight data (id + display fields only)
- Support query parameter filtering (e.g., ?role=evaluator)
## 8. Route Registration & Naming Conventions
### 8.1 Route Registration Order (MUST strictly follow)
1. /me (current user)
2. / (list)
3. /options (dropdown options) — MUST be before /{id}!
4. /{id} (detail)
5. POST / (create)
6. PUT /{id} (update)
7. DELETE /{id} (delete)
### 8.2 File Naming Conventions
- API route: {module_name}.py
- Service: {module_name}_service.py
- Schema: {module_name}.py (in schemas directory)
- Model: {module_name}.py (in models directory)
- Vue component: {ModuleName}View.vue (PascalCase)
## 9. Dependency Checklist
### 9.1 Prerequisites (MUST be met before development)
- [ ] **Department module** is ready
- Verify: curl GET /departments/options → returns ≥1 record
- If not ready: implement FP-INFRA-001 first
- [ ] **Seed data** is initialized
- Verify: python seed_base_data.py executes successfully
- If not ready: run seed script first
- [ ] **Auth middleware** is configured
- Verify: POST /auth/login → returns access_token
### 9.2 Dependencies Created by This Feature
- [ ] This feature's /options endpoint will be needed by FP-XXX
# [Feature Point Name] Acceptance Criteria
## Business Acceptance Criteria
| No. | Acceptance Item | Expected Result | Verification Method |
|-----|----------------|-----------------|---------------------|
## Technical Acceptance Criteria
| No. | Acceptance Item | Standard | Verification Method |
|-----|----------------|----------|---------------------|
## Integration Acceptance Criteria
| No. | Acceptance Item | Standard | Verification Method |
从 dev-specs/feature-matrix.md 读取功能点定义
提取: 功能描述 | 输入字段 | 输出信息 | 业务规则 | 状态转换 | 测试策略
RESTful规范 | HTTP方法语义 | URL命名规范 | 请求/响应格式 | 错误码体系
实体识别 | 属性定义 | 关系映射 | 索引设计 | 审计字段(create_time/update_time/create_by/update_by/del_flag/status)
核心流程 | 边界条件 | 异常处理 | 状态机转换
页面结构 | 表单布局 | 列表展示 | 交互流程
接口权限 | 数据权限 | 输入校验 | SQL注入防护
业务场景覆盖 | 技术指标达标 | 集成测试通过
保存到 dev-specs/FP-{序号}/spec.md 和 checklist.md
Read feature point definitions from dev-specs/feature-matrix.md
Extract: Feature Description | Input Fields | Output Information | Business Rules | State Transitions | Test Strategy
RESTful Conventions | HTTP Method Semantics | URL Naming Conventions | Request/Response Format | Error Code System
Entity Identification | Attribute Definition | Relationship Mapping | Index Design | Audit Fields (create_time/update_time/create_by/update_by/del_flag/status)
Core Flow | Edge Cases | Exception Handling | State Machine Transitions
Page Structure | Form Layout | List Display | Interaction Flow
API Permissions | Data Permissions | Input Validation | SQL Injection Protection
Business Scenario Coverage | Technical Metrics Compliance | Integration Test Pass
Save to dev-specs/FP-{sequence}/spec.md and checklist.md
必须遵守: 接口定义必须符合RESTful规范 | 数据模型必须包含审计字段 | 业务规则必须标注优先级 | 验收标准必须可测试可验证 | 外键字段必须定义前端组件类型(禁止UUID手动输入) | Options接口必须在Spec中声明 | 路由注册顺序必须遵守约定 | 枚举值必须使用snake_case小写英文
避免事项: ❌ 接口路径不符合RESTful规范 | ❌ 数据模型缺少审计字段 | ❌ 业务规则模糊无法验证 | ❌ 验收标准不可测试 | ❌ 外键字段用Input而非Select | ❌ Options接口路由在/{id}之后 | ❌ 枚举值使用大写或中文 | ❌ datetime字段声明为str而非datetime
Must Follow: API definitions must comply with RESTful conventions | Data models must include audit fields | Business rules must be marked with priority levels | Acceptance criteria must be testable and verifiable | Foreign key fields MUST define frontend component type (no manual UUID input) | Options APIs MUST be declared in Spec | Route registration order MUST follow conventions | Enum values MUST use snake_case lowercase English
Avoid: ❌ API paths that do not follow RESTful conventions | ❌ Data models missing audit fields | ❌ Business rules that are vague and unverifiable | ❌ Acceptance criteria that are not testable | ❌ Foreign key fields using Input instead of Select | ❌ Options API route defined after /{id} | ❌ Enum values using UPPERCASE or Chinese | ❌ datetime fields declared as str instead of datetime
| 协作技能 | 协作方式 | 传入数据 | 期望输出 |
|---|---|---|---|
| pdd-extract-features | Sequential | 功能点矩阵 | 功能点详情 |
| pdd-ba | Sequential | 业务分析报告 | 用例/流程/状态 |
| system-architect | Consultation | 架构需求 | 架构建议 |
| software-architect | Consultation | 模块需求 | 模块设计 |
| pdd-implement-feature | Sequential | spec.md + checklist.md | 代码实现 |
| Collaborating Skill | Collaboration Mode | Input Data | Expected Output |
|---|---|---|---|
| pdd-extract-features | Sequential | Feature Matrix | Feature Point Details |
| pdd-ba | Sequential | Business Analysis Report | Use Cases / Flows / States |
| system-architect | Consultation | Architecture Requirements | Architecture Recommendations |
| software-architect | Consultation | Module Requirements | Module Design |
| pdd-implement-feature | Sequential | spec.md + checklist.md | Code Implementation |
审核节点: 开发规格生成完成后需要人工审核
审核内容: 接口设计合理性 | 数据模型完整性 | 业务逻辑正确性 | 验收标准完备性
审核粒度:
输出文件: review-spec.md | 结果类型: passed / rejected / conditional
Review Checkpoint: Human review is required after development specification generation is complete
Review Content: API design rationality | Data model completeness | Business logic correctness | Acceptance criteria completeness
Review Granularity:
Output File: review-spec.md | Result Types: passed / rejected / conditional
规格驱动实现: 生成的spec.md必须是后续代码实现的唯一依据,所有接口定义、数据模型、业务规则都必须在规格中明确声明,不得让实现者自行推断。
验收标准可测试性: checklist.md中的每条验收标准都必须是客观的、可验证的,不得出现"界面美观""响应迅速"等主观描述。
前后端一致性: 规格中的接口定义必须同时适用于后端实现和前端调用,前端API层应能直接基于规格生成。
完整性与简洁性平衡: 规格必须足够详细以指导实现(不遗漏关键细节),但也要避免过度详细导致维护成本过高。
变更追溯性: 规格中每个决策(如选择某种数据结构、设计某个接口)都应有简要的理由说明或引用来源,便于后续审查和理解。
违规示例: ❌ 接口只写了路径而未定义请求参数和响应结构 | ❌ 验收标准写"用户体验良好"而非具体指标 | ❌ 后端规格与前端实际调用的字段名不一致 | ❌ 为了省事将规格写得过于简略导致实现者频繁询问 | ❌ 数据库设计了联合索引但未说明查询场景
合规示例: ✅ 每个接口都包含完整的请求/响应定义和错误码列表 | ✅ 验收标准明确:"列表接口响应时间<500ms(1000条数据)" | ✅ 前后端使用同一份接口规格作为开发依据 | ✅ 规格详细但不冗余:关键决策有注释,常规内容用表格呈现 | ✅ 索引设计附带说明:"支持按status+create_time的组合查询"
Specification-Driven Implementation: The generated spec.md must be the sole basis for subsequent code implementation. All API definitions, data models, and business rules must be explicitly declared in the specification — implementers must not be left to make their own inferences.
Acceptance Criteria Testability: Each acceptance criterion in checklist.md must be objective and verifiable. Subjective descriptions such as "beautiful UI" or "fast response" are prohibited.
Frontend-Backend Consistency: API definitions in the specification must be applicable to both backend implementation and frontend invocation. The frontend API layer should be able to generate code directly based on the specification.
Balance of Completeness and Conciseness: The specification must be sufficiently detailed to guide implementation (without omitting key details), but should avoid excessive detail that leads to high maintenance costs.
Change Traceability: Every decision in the specification (such as choosing a data structure or designing an API) should include a brief rationale or reference source for subsequent review and understanding.
Violation Examples: ❌ An API only has a path defined without request parameters and response structure | ❌ Acceptance criterion says "good user experience" instead of specific metrics | ❌ Backend spec field names are inconsistent with what the frontend actually calls | ❌ Specification is overly brief to save effort, causing implementers to frequently ask questions | ❌ Database composite index is designed without explaining the query scenario
Compliance Examples: ✅ Every API includes complete request/response definitions and error code list | ✅ Acceptance criterion is explicit: "List API response time < 500ms (1000 records)" | ✅ Frontend and backend use the same API specification as development basis | ✅ Specification is detailed but not redundant: key decisions have comments, routine content uses tables | ✅ Index design includes explanation: "Supports combined queries by status + create_time"
| # | 陷阱 / Trap | 请问自己 / Ask Yourself | 应该怎么做 / Action |
|---|---|---|---|
| 1 | "这个接口很简单,写个路径就行了" / "This API is simple, just write the path" | 简单的接口也需要明确的参数定义,否则实现者会自行猜测 / Even simple APIs need clear parameter definitions, otherwise implementers will guess | 即使是最简单的CRUD接口也必须定义完整的请求/响应结构 / Even the simplest CRUD APIs must have complete request/response structure defined |
| 2 | "验收标准差不多就行,反正后面会测" / "Acceptance criteria is good enough, it will be tested later anyway" | 模糊的验收标准会导致验收阶段扯皮,且无法客观判断是否通过 / Vague acceptance criteria leads to disputes during acceptance and makes objective judgment impossible | 每条标准都必须量化或提供明确的判定方法 / Every criterion must be quantified or provide a clear determination method |
| 3 | "前端后面再对吧,先完成后端" / "Let's do frontend later, finish backend first" | 前后端不一致是集成阶段最常见的问题 / Frontend-backend inconsistency is the most common problem in integration phase | 规格生成时就必须同步考虑前后端,确保接口定义的双向适用性 / Frontend and backend must be considered together during spec generation to ensure bidirectional applicability |
| 4 | "这些细节实现者应该知道" / "Implementers should know these details" | 不同开发者有不同的理解和习惯,细节缺失会导致实现差异 / Different developers have different understandings and habits; missing details lead to implementation divergence | 将你认为"显而易见"的细节都显式写入规格,特别是边界条件 / Explicitly write all "obvious" details into the specification, especially edge cases |
| 5 | "规格写得太长没人看" / "The spec is too long, no one will read it" | 过于简略的规格会导致频繁沟通,反而浪费更多时间 / Overly brief specs cause frequent communication and waste more time | 采用分层详略策略:概览+详细表格,让读者可按需深入 / Adopt a layered detail strategy: overview + detailed tables, allowing readers to drill down as needed |
常见陷阱 / Common Traps:
| # | Trap / 陷阱 | Question | Action |
|---|---|---|---|
| 1 | "This API is simple, just write the path" / 这个接口很简单,写个路径就行了 | Even simple APIs need clear parameter definitions, otherwise implementers will guess / 简单的接口也需要明确的参数定义,否则实现者会自行猜测 | Even the simplest CRUD APIs must have complete request/response structure defined / 即使是最简单的CRUD接口也必须定义完整的请求/响应结构 |
| 2 | "Acceptance criteria is good enough, it will be tested later anyway" / 验收标准差不多就行,反正后面会测 | Vague acceptance criteria leads to disputes during acceptance and makes objective judgment impossible / 模糊的验收标准会导致验收阶段扯皮,且无法客观判断是否通过 | Every criterion must be quantified or provide a clear determination method / 每条标准都必须量化或提供明确的判定方法 |
| 3 | "Let's do frontend later, finish backend first" / 前端后面再对吧,先完成后端 | Frontend-backend inconsistency is the most common problem in integration phase / 前后端不一致是集成阶段最常见的问题 | Frontend and backend must be considered together during spec generation to ensure bidirectional applicability / 规格生成时就必须同步考虑前后端,确保接口定义的双向适用性 |
| 4 | "Implementers should know these details" / 这些细节实现者应该知道 | Different developers have different understandings and habits; missing details lead to implementation divergence / 不同开发者有不同的理解和习惯,细节缺失会导致实现差异 | Explicitly write all "obvious" details into the specification, especially edge cases / 将你认为"显而易见"的细节都显式写入规格,特别是边界条件 |
| 5 | "The spec is too long, no one will read it" / 规格写得太长没人看 | Overly brief specs cause frequent communication and waste more time / 过于简略的规格会导致频繁沟通,反而浪费更多时间 | Adopt a layered detail strategy: overview + detailed tables, allowing readers to drill down as needed / 采用分层详略策略:概览+详细表格,让读者可按需深入 |
Common Traps / 常见陷阱:
🔴 CRITICAL → 立即停止,报告问题详情,等待指示 | 🟡 WARN → 记录警告到规格日志,尝试自动修复,在最终报告中标注 | 🔵 INFO → 记录信息,正常继续
🔴 CRITICAL → Stop immediately, report problem details, wait for instructions / 立即停止,报告问题详情,等待指示 | 🟡 WARN → Log warning to spec log, attempt auto-fix, annotate in final report / 记录警告到规格日志,尝试自动修复,在最终报告中标注 | 🔵 INFO → Log information, continue normally / 记录信息,正常继续