prd
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/prd Skill
/prd 技能
Required Context
必要上下文
Before beginning work, read these files for project-specific guidelines:
.claude/memory-bank/org-context.md
开始工作前,请阅读以下文件获取项目特定指南:
.claude/memory-bank/org-context.md
Purpose
目标
Full lifecycle management for Product Requirements Documents (PRDs) through the gather-criticize loop:
- Create new PRDs via conversational discovery + iterative criticism
- Resume interrupted PRD sessions
- Sync existing PRDs to spec groups
- Amend PRDs with implementation discoveries
- Status check on PRD state
This is the unified skill for all PRD lifecycle management: creation, refinement, syncing, and amendment.
通过收集-评审循环实现产品需求文档(PRD)的全生命周期管理:
- 通过对话式探索+迭代评审创建新PRD
- 恢复中断的PRD会话
- 同步现有PRD到规格组
- 根据实现发现修订PRD
- 检查PRD状态
这是用于PRD全生命周期管理(创建、优化、同步和修订)的统一技能。
PRD Storage
PRD存储
PRDs are stored in-repo under for version control alongside the codebase.
.claude/prds/.claude/prds/
├── <prd-id>/
│ └── prd.md # The PRD document (D-034 format)
└── <another-prd-id>/
└── ...PRD存储在代码库内的目录下,与代码一起进行版本控制。
.claude/prds/.claude/prds/
├── <prd-id>/
│ └── prd.md # PRD文档(D-034格式)
└── <another-prd-id>/
└── ...Usage
使用方法
/prd # Start new PRD with gather-criticize loop
/prd <prd-id> # Resume or refine existing PRD
/prd sync <prd-id> # Import existing PRD, extract requirements to spec group
/prd amend <prd-id> # Push implementation discoveries back to PRD
/prd status <prd-id> # Check PRD state, pass count, pending findings/prd # 通过收集-评审循环启动新PRD
/prd <prd-id> # 恢复或优化现有PRD
/prd sync <prd-id> # 导入现有PRD,提取需求到规格组
/prd amend <prd-id> # 将实现发现推送到PRD
/prd status <prd-id> # 检查PRD状态、通过次数、待处理问题Commands
命令
/prd (New PRD -- Gather-Criticize Loop)
/prd(新建PRD——收集-评审循环)
Creates a new PRD through the full gather-criticize loop.
Process:
通过完整的收集-评审循环创建新PRD。
流程:
Phase 1: Cold Start & Discovery
阶段1:冷启动与探索
-
Generate PRD ID: Prompt user for a slug (e.g.,,
auth-revamp)notifications -
Create directory:
mkdir -p .claude/prds/<prd-id>/ -
Dispatch PRD Writer (discovery mode):
Task: prd-writer Prompt: | <context> Mode: discovery PRD ID: <prd-id> User request: <original user request> Cold start context: - tech.context.md: <contents> - org-context.md: <contents> - Existing PRDs: <list of .claude/prds/*/prd.md> Template: .claude/templates/prd-phase1.template.md </context> Conduct a conversational discovery interview with the human. Follow D-004 (13 context dimensions), D-005 (cold start), D-006 (conversational), D-007 (front-loaded input, natural breakpoints). After discovery completes, produce a PRD in D-034 format. Save to .claude/prds/<prd-id>/prd.md -
PRD Writer produces draft: Saved to
.claude/prds/<prd-id>/prd.md
-
生成PRD ID:提示用户提供一个短标识(例如:、
auth-revamp)notifications -
创建目录:
mkdir -p .claude/prds/<prd-id>/ -
调度PRD Writer(探索模式):
Task: prd-writer Prompt: | <context> Mode: discovery PRD ID: <prd-id> User request: <original user request> Cold start context: - tech.context.md: <contents> - org-context.md: <contents> - Existing PRDs: <list of .claude/prds/*/prd.md> Template: .claude/templates/prd-phase1.template.md </context> 与用户进行对话式探索访谈。 遵循D-004(13个上下文维度)、D-005(冷启动)、D-006(对话式)、 D-007(前置输入、自然断点)规范。 探索完成后,生成D-034格式的PRD。 保存到 .claude/prds/<prd-id>/prd.md -
PRD Writer生成草稿:保存到
.claude/prds/<prd-id>/prd.md
Phase 1.5: Integration Surface Exploration
阶段1.5:集成面探索
Applicability: MANDATORY for oneoff-spec workflows. SKIP for oneoff-vibe.
After the PRD Writer saves the draft (end of Phase 1), explore the codebase to pre-populate the PRD's Integration Surface section before critics see the document.
4a. Parse the draft PRD for mentioned systems, APIs, services, databases, and configuration:
- Scan all sections for references to existing services, endpoints, data stores, and external systems
- Extract module/package names, route paths, config keys, and event names mentioned or implied
4b. Dispatch Explore subagent to scan the codebase for integration surfaces:
Task: explore
Prompt: |
Investigate the codebase for integration surfaces relevant to the PRD at .claude/prds/<prd-id>/prd.md.
Search for:
1. Existing API endpoints, routes, or service interfaces that the proposal touches or extends
2. Shared database tables, schemas, or data models referenced
3. Configuration and environment variables involved (e.g., in .env files, config modules)
4. Event systems at boundaries (SSE, WebSocket, pub/sub, message queues)
5. Import/export relationships with modules the feature touches
Return a structured Integration Surface Report with:
- Touched Systems: list of existing systems/services with how they are touched
- Existing Contracts: API specs, type definitions, schemas already in place
- Potential Conflicts: areas where the proposed feature may conflict with existing behavior
- Configuration Dependencies: env vars, feature flags, config files involved
- Cross-Cutting Concerns: shared state, caching, event systems, logging pipelines
Return structured findings, not raw code.4c. Dispatch PRD Writer (amendment mode) to add exploration findings:
Task: prd-writer
Prompt: |
<context>
Mode: amendment
PRD path: .claude/prds/<prd-id>/prd.md
Pass number: 0 (pre-critique integration surface population)
Integration Surface Report:
<structured findings from Explore subagent>
</context>
Add the exploration findings to the "Integration Surface" section of the PRD.
Populate: Touched Systems table, New Boundaries Created, Configuration Dependencies,
and Cross-Cutting Concerns subsections.
Do NOT modify any other section of the PRD.
Save the complete amended PRD to disk.4d. Proceed to Phase 2 (Critique Loop) -- critics now evaluate the PRD with integration context already populated.
适用范围:oneoff-spec工作流强制要求。oneoff-vibe工作流可跳过。
PRD Writer保存草稿后(阶段1结束),在评审人员查看文档前,探索代码库以预先填充PRD的集成面部分。
4a. 解析PRD草稿,查找提及的系统、API、服务、数据库和配置:
- 扫描所有章节,查找对现有服务、端点、数据存储和外部系统的引用
- 提取提及或隐含的模块/包名称、路由路径、配置键和事件名称
4b. 调度Explore子Agent扫描代码库以查找集成面:
Task: explore
Prompt: |
调查代码库中与 .claude/prds/<prd-id>/prd.md 中PRD相关的集成面。
搜索内容:
1. 提案涉及或扩展的现有API端点、路由或服务接口
2. 引用的共享数据库表、模式或数据模型
3. 涉及的配置和环境变量(例如.env文件、配置模块中的变量)
4. 边界处的事件系统(SSE、WebSocket、发布/订阅、消息队列)
5. 功能涉及模块的导入/导出关系
返回结构化的集成面报告,包含:
- 涉及系统:现有系统/服务列表及涉及方式
- 现有契约:已存在的API规范、类型定义、模式
- 潜在冲突:提案功能可能与现有行为冲突的区域
- 配置依赖:涉及的环境变量、功能标志、配置文件
- 跨领域关注点:共享状态、缓存、事件系统、日志管道
返回结构化结果,而非原始代码。4c. 调度PRD Writer(修订模式)添加探索结果:
Task: prd-writer
Prompt: |
<context>
Mode: amendment
PRD path: .claude/prds/<prd-id>/prd.md
Pass number: 0 (评审前集成面填充)
Integration Surface Report:
<structured findings from Explore subagent>
</context>
将探索结果添加到PRD的"集成面"部分。
填充:涉及系统表、创建的新边界、配置依赖
和跨领域关注点子章节。
请勿修改PRD的任何其他部分。
将完整的修订后PRD保存到磁盘。4d. 进入阶段2(评审循环)——评审人员现在将评估已填充集成上下文的PRD。
Phase 1.55: Optional Technical Architecture Design (TAD)
阶段1.55:可选技术架构设计(TAD)
Applicability: Optional for all workflows. Human chooses whether to provide TAD input. Purpose: Allow humans to front-load architectural decisions before spec authoring, reducing investigation findings downstream.
After the Integration Surface exploration (Phase 1.5) and before the Critique Loop (Phase 2):
4a-tad. Present TAD option to human:
Would you like to provide technical architecture input before critique begins?
This optional TAD (Technical Architecture Design) phase lets you specify:
- Key architectural decisions (e.g., database choice, API style, auth strategy)
- System design constraints (e.g., latency requirements, scaling targets)
- Technology choices (e.g., framework, language, infrastructure)
- Integration patterns (e.g., sync vs async, event-driven vs request-response)
This input will be available to the spec-author agent as context, potentially
reducing downstream investigation findings.
[Provide TAD input / Skip TAD]4b-tad. If human provides TAD input:
- Record the TAD input in the PRD under a section
## Technical Architecture Design - Dispatch PRD Writer (amendment mode) to integrate the TAD into the PRD:
Task: prd-writer
Prompt: |
<context>
Mode: amendment
PRD path: .claude/prds/<prd-id>/prd.md
Pass number: 0 (TAD integration)
TAD Input:
<human's technical architecture input>
</context>
Add the TAD input to the "Technical Architecture Design" section of the PRD.
Integrate architectural decisions with existing Integration Surface findings.
Do NOT modify any other section of the PRD.
Save the complete amended PRD to disk.- The TAD input will be passed through to spec-author context when is invoked
/spec
4c-tad. If human skips TAD: Continue to Phase 1.6 without error. No TAD section added.
Note: The TAD phase does NOT count as a separate human intervention in metrics. The PRD gather-criticize loop remains fully human-in-the-loop -- no auto-decision logic applies to PRD findings.
适用范围:所有工作流可选。用户选择是否提供TAD输入。 目标:允许用户在规格编写前预先加载架构决策,减少后续调查发现。
集成面探索(阶段1.5)之后、评审循环(阶段2)之前:
4a-tad. 向用户展示TAD选项:
是否要在评审开始前提供技术架构输入?
这个可选的TAD(技术架构设计)阶段允许您指定:
- 关键架构决策(例如数据库选择、API风格、认证策略)
- 系统设计约束(例如延迟要求、扩展目标)
- 技术选择(例如框架、语言、基础设施)
- 集成模式(例如同步vs异步、事件驱动vs请求-响应)
此输入将作为上下文提供给规格编写Agent,可能
减少后续调查发现。
[提供TAD输入 / 跳过TAD]4b-tad. 如果用户提供TAD输入:
- 在PRD的章节中记录TAD输入
## Technical Architecture Design - 调度PRD Writer(修订模式)将TAD集成到PRD中:
Task: prd-writer
Prompt: |
<context>
Mode: amendment
PRD path: .claude/prds/<prd-id>/prd.md
Pass number: 0 (TAD集成)
TAD Input:
<human's technical architecture input>
</context>
将TAD输入添加到PRD的"Technical Architecture Design"章节。
将架构决策与现有集成面探索结果整合。
请勿修改PRD的任何其他部分。
将完整的修订后PRD保存到磁盘。- 调用时,TAD输入将作为上下文传递给规格编写Agent
/spec
4c-tad. 如果用户跳过TAD:无错误地进入阶段1.6。不添加TAD章节。
注意:TAD阶段不计入指标中的单独人工干预次数。PRD收集-评审循环仍然是完全人工参与的——没有自动决策逻辑应用于PRD发现。
Phase 1.6: Diagram Generation (AC-4.4, AC-4.5)
阶段1.6:图表生成(AC-4.4, AC-4.5)
Trigger: Runs after the gather-criticize loop exits (after Phase 1.5, before Phase 2). Purpose: Generate preliminary visual artifacts from PRD content.
4e. Generate preliminary diagrams from available YAML sources:
bash
undefined触发条件:收集-评审循环退出后运行(阶段1.5之后,阶段2之前)。 目标:从PRD内容生成初步视觉工件。
4e. 从可用YAML源生成初步图表:
bash
undefinedGenerate all diagrams from structured YAML docs
从结构化YAML文档生成所有图表
node .claude/scripts/docs-generate.mjs
This produces three types of preliminary diagrams:
1. **Architecture overview** (C4 component diagram): Generated from `architecture.yaml` via `generateComponentMmd()`. Shows system components and dependencies.
2. **User flow sequences**: Generated from `flows/*.yaml` via `generateFlowMmd()`. Shows step-by-step interaction flows.
3. **Security boundary diagram**: Generated from `security.yaml` via `generateSecurityMmd()`. Shows trust zones and data flow between them.
**Behavior**:
- If a YAML source does not exist, that diagram type is skipped silently
- Generated `.mmd` files are placed in `.claude/docs/structured/generated/`
- Each `.mmd` file includes a `%% source-hash:` header for freshness tracking
- Results are referenced in the PRD's Visual Report section
4f. **Update PRD Visual Report section** with references to generated diagrams:
```markdownnode .claude/scripts/docs-generate.mjs
这会生成三种类型的初步图表:
1. **架构概览**(C4组件图):通过`generateComponentMmd()`从`architecture.yaml`生成。展示系统组件和依赖关系。
2. **用户流序列**:通过`generateFlowMmd()`从`flows/*.yaml`生成。展示分步交互流程。
3. **安全边界图**:通过`generateSecurityMmd()`从`security.yaml`生成。展示信任区域和它们之间的数据流。
**行为**:
- 如果YAML源不存在,则跳过该类型图表,不提示
- 生成的`.mmd`文件放置在`.claude/docs/structured/generated/`目录下
- 每个`.mmd`文件包含`%% source-hash:`头用于新鲜度跟踪
- 结果在PRD的视觉报告部分引用
4f. **更新PRD视觉报告部分**,添加生成图表的引用:
```markdownVisual Report
视觉报告
Phase 1 Diagrams (Preliminary)
阶段1图表(初步)
- Architecture Overview: .claude/docs/structured/generated/component-c4.mmd
- User Flow Sequences: .claude/docs/structured/generated/flow-*.mmd
- Security Boundaries: .claude/docs/structured/generated/security.mmd
4g. **Proceed to Phase 2** (Critique Loop).- 架构概览:.claude/docs/structured/generated/component-c4.mmd
- 用户流序列:.claude/docs/structured/generated/flow-*.mmd
- 安全边界:.claude/docs/structured/generated/security.mmd
4g. **进入阶段2**(评审循环)。Phase 2: Critique Loop
阶段2:评审循环
-
Initialize pass counter:
pass = 1 -
Dispatch 4 critics in parallel (D-001: independence):
# Dispatch all four in parallel -- DO NOT serialize Task: prd-critic (perspective: business) Task: prd-critic (perspective: technical) Task: prd-critic (perspective: security) Task: prd-critic (perspective: edge-case) Each critic receives ONLY: (1) Current PRD document (read from .claude/prds/<prd-id>/prd.md) (2) The Decisions Log section from the PRD (3) Calibration set from .claude/templates/critic-calibration.md (4) Its perspective parameter DO NOT include findings from any other critic. -
Collect findings from all four critics
-
Aggregate findings by severity
-
初始化通过计数器:
pass = 1 -
并行调度4个评审Agent(D-001:独立性):
# 并行调度所有四个——不要串行执行 Task: prd-critic (perspective: business) Task: prd-critic (perspective: technical) Task: prd-critic (perspective: security) Task: prd-critic (perspective: edge-case) 每个评审Agent仅接收: (1) 当前PRD文档(从 .claude/prds/<prd-id>/prd.md 读取) (2) PRD中的决策日志部分 (3) 来自 .claude/templates/critic-calibration.md 的校准集 (4) 其视角参数 请勿包含任何其他评审Agent的发现结果。 -
收集所有四个评审Agent的发现结果
-
按严重性聚合发现结果
Phase 3: Resolution
阶段3:解决
-
If any Critical or High findings exist:
- Present as a single batch to the human, sorted by severity (Critical first, then High), then by critic type
- Human resolves each finding: accept (amend PRD), reject (not a real gap), or defer (out of scope)
-
If any Medium findings exist:
- Present Medium findings to the human (after Critical/High are resolved)
- Offer batch shortcut: "Accept all Medium findings" (excludes security-tagged findings)
- Security-tagged findings at any severity are surfaced separately and require explicit individual confirmation
- If batch-accepted, log each decision individually in the Decisions Log with specific finding IDs
- Human resolves each (or uses batch shortcut)
-
Low findings: Summarize in a single block. Do NOT present individually.
-
Dispatch PRD Writer (amendment mode):
Task: prd-writer Prompt: | <context> Mode: amendment PRD path: .claude/prds/<prd-id>/prd.md Pass number: <pass> Resolutions: <list of finding_id, resolution, rationale for each resolved finding> </context> Amend the PRD with all resolutions. Update the Decisions Log with structured entries for each finding. Save the complete amended PRD to disk.
-
如果存在任何严重或高严重性发现结果:
- 按严重性排序(严重优先,然后是高),再按评审类型排序,作为一个批次呈现给用户
- 用户解决每个发现结果:接受(修订PRD)、拒绝(不是真正的漏洞)或推迟(超出范围)
-
如果存在任何中严重性发现结果:
- 在严重/高严重性结果解决后,向用户呈现中严重性发现结果
- 提供批量快捷选项:"接受所有中严重性发现结果"(不包含标记为安全的结果)
- 任何严重性的安全标记结果都单独展示,需要明确的单独确认
- 如果批量接受,在决策日志中为每个发现结果单独记录决策,并包含特定的发现ID
- 用户解决每个结果(或使用批量快捷选项)
-
低严重性发现结果:汇总为一个块,不单独呈现。
-
调度PRD Writer(修订模式):
Task: prd-writer Prompt: | <context> Mode: amendment PRD path: .claude/prds/<prd-id>/prd.md Pass number: <pass> Resolutions: <list of finding_id, resolution, rationale for each resolved finding> </context> 根据所有解决方案修订PRD。 为每个发现结果在决策日志中添加结构化条目。 将完整的修订后PRD保存到磁盘。
Phase 4: Loop Check
阶段4:循环检查
-
Check exit condition (D-002):
- If all findings from this pass are Low severity:
- Present remaining Low findings to the human
- Ask: "All remaining findings are Low severity. Exit the loop and finalize the PRD? [Y/n]"
- If human confirms: Exit loop (go to Phase 5)
- If human rejects: Continue loop (back to step 6 with )
pass += 1
- If any non-Low findings remain: Continue loop (back to step 6 with )
pass += 1
- If all findings from this pass are Low severity:
-
Max pass check (EC-4):
- If :
pass >= 5- Present summary: "After 5 passes, N Medium+ findings remain."
- Offer options: (1) Resolve remaining findings, (2) Accept current state and proceed, (3) Defer remaining findings
- Human decides
- If
-
检查退出条件(D-002):
- 如果此次通过的所有发现结果都是低严重性:
- 向用户呈现剩余的低严重性发现结果
- 询问:"所有剩余发现结果都是低严重性。是否退出循环并最终确定PRD?[Y/n]"
- 如果用户确认:退出循环(进入阶段5)
- 如果用户拒绝:继续循环(回到步骤6,)
pass += 1
- 如果存在任何非低严重性发现结果:继续循环(回到步骤6,)
pass += 1
- 如果此次通过的所有发现结果都是低严重性:
-
最大通过次数检查(EC-4):
- 如果:
pass >= 5- 呈现摘要:"经过5次通过后,仍有N个中+严重性发现结果。"
- 提供选项:(1) 解决剩余结果,(2) 接受当前状态并继续,(3) 推迟剩余结果
- 用户决定
- 如果
Phase 5: Finalization
阶段5:最终确定
-
Update org-context: Dispatch PRD Writer to updatewith new stable facts discovered during the session
.claude/memory-bank/org-context.md -
Create spec group (optional):
- Prompt: "Create a spec group from this PRD? [Y/n]"
- If yes: Create with
.claude/specs/groups/sg-<prd-id>/andmanifest.jsonextracted from the PRDrequirements.md
-
Report completion:
PRD complete: .claude/prds/<prd-id>/prd.md Passes: <N> Findings resolved: <count> Decisions Log entries: <count> Next steps: 1. Review PRD: .claude/prds/<prd-id>/prd.md 2. Create spec group: /prd sync <prd-id> (if not already created) 3. Author spec: /spec sg-<prd-id>
-
更新org-context:调度PRD Writer,将会话期间发现的新稳定事实更新到
.claude/memory-bank/org-context.md -
创建规格组(可选):
- 提示:"从此PRD创建规格组?[Y/n]"
- 如果是:创建目录,包含从PRD提取的
.claude/specs/groups/sg-<prd-id>/和manifest.jsonrequirements.md
-
报告完成:
PRD完成:.claude/prds/<prd-id>/prd.md 通过次数:<N> 解决的发现结果:<count> 决策日志条目:<count> 下一步: 1. 查看PRD:.claude/prds/<prd-id>/prd.md 2. 创建规格组:/prd sync <prd-id>(如果尚未创建) 3. 编写规格:/spec sg-<prd-id>
/prd <prd-id> (Resume or Refine)
/prd <prd-id>(恢复或优化)
Resumes an interrupted PRD session or refines an existing PRD.
Process:
- Read PRD from
.claude/prds/<prd-id>/prd.md - Determine re-entry point:
- If PRD has comment: resume interview from that point
<!-- RESUME POINT: ... --> - If PRD is complete but has no Decisions Log entries: start critique loop (Phase 2)
- If PRD has Decisions Log entries: start a new critique pass
- If PRD has
- Continue from the appropriate phase
恢复中断的PRD会话或优化现有PRD。
流程:
- 从读取PRD
.claude/prds/<prd-id>/prd.md - 确定重新进入点:
- 如果PRD包含注释:从该点恢复访谈
<!-- RESUME POINT: ... --> - 如果PRD已完成但无决策日志条目:启动评审循环(阶段2)
- 如果PRD有决策日志条目:启动新的评审通过
- 如果PRD包含
- 从适当的阶段继续
/prd sync <prd-id> (Import Existing PRD)
/prd sync <prd-id>(导入现有PRD)
Creates a spec group from an existing PRD, or updates an existing spec group's requirements.md from the current PRD state. Kept from the old skill.
/prdProcess (new spec group):
- Read PRD from
.claude/prds/<prd-id>/prd.md - Dispatch agent to extract requirements:
prd-readerTask: prd-reader Prompt: | Read PRD from .claude/prds/<prd-id>/prd.md Extract requirements, constraints, assumptions, success criteria Convert to EARS format Create spec group with requirements.md - Create spec group directory:
.claude/specs/groups/sg-<prd-id>/ - Generate with PRD link
manifest.json - Generate from extracted requirements
requirements.md - Set and
prd_versionin requirements.md YAML frontmatter:prd_content_hash- : The PRD's version field value
prd_version - : First 8 characters of SHA-256 hex digest computed over the PRD body content (everything after the closing
prd_content_hashof the YAML frontmatter block; frontmatter itself is excluded)---
- Set
review_state: DRAFT
Process (update mode -- existing requirements.md):
When is run on a spec group that already has a :
/prd syncrequirements.md- Read PRD from
.claude/prds/<prd-id>/prd.md - Re-extract requirements from the current PRD
- Compare newly extracted requirements against existing :
requirements.md- Preserved: Manual additions (requirements not present in the PRD but added by the spec author) are kept
- Flagged: Changed or removed PRD requirements are flagged for human review (not silently deleted)
- Conflicts: When a manual addition conflicts with a newly extracted PRD requirement (both cover the same concern with different constraints), flag for human review with both versions presented side by side
- Update and
prd_versionin frontmatter to reflect the current PRD stateprd_content_hash
Output:
PRD synced: .claude/prds/<prd-id>/prd.md
Created spec group: sg-<prd-id>
- N requirements extracted
- requirements.md generated
- prd_version: <version>
- prd_content_hash: <8-char hash>
Next steps:
1. Review requirements: .claude/specs/groups/sg-<prd-id>/requirements.md
2. Run /spec sg-<prd-id> to create spec从现有PRD创建规格组,或从当前PRD状态更新现有规格组的requirements.md。保留自旧版技能。
/prd流程(新建规格组):
- 从读取PRD
.claude/prds/<prd-id>/prd.md - 调度Agent提取需求:
prd-readerTask: prd-reader Prompt: | 读取 .claude/prds/<prd-id>/prd.md 中的PRD 提取需求、约束、假设、成功标准 转换为EARS格式 创建包含requirements.md的规格组 - 创建规格组目录:
.claude/specs/groups/sg-<prd-id>/ - 生成包含PRD链接的
manifest.json - 从提取的需求生成
requirements.md - 在requirements.md的YAML前置元数据中设置和
prd_version:prd_content_hash- :PRD的版本字段值
prd_version - :PRD主体内容(YAML前置元数据块结束
prd_content_hash之后的所有内容;不包含前置元数据本身)计算的SHA-256十六进制摘要的前8个字符---
- 设置
review_state: DRAFT
流程(更新模式——现有requirements.md):
当对已有的规格组运行时:
requirements.md/prd sync- 从读取PRD
.claude/prds/<prd-id>/prd.md - 从当前PRD重新提取需求
- 将新提取的需求与现有进行比较:
requirements.md- 保留:手动添加的内容(PRD中不存在但由规格编写者添加的需求)将被保留
- 标记:已更改或删除的PRD需求将被标记供用户查看(不会被静默删除)
- 冲突:当手动添加内容与新提取的PRD需求冲突(两者涉及同一关注点但约束不同)时,标记供用户查看,并并排呈现两个版本
- 更新前置元数据中的和
prd_version以反映当前PRD状态prd_content_hash
输出:
PRD已同步:.claude/prds/<prd-id>/prd.md
已创建规格组:sg-<prd-id>
- 提取了N条需求
- 生成了requirements.md
- prd_version: <version>
- prd_content_hash: <8-char hash>
下一步:
1. 查看需求:.claude/specs/groups/sg-<prd-id>/requirements.md
2. 运行 /spec sg-<prd-id> 创建规格/prd amend <prd-id> (Push Implementation Discoveries)
/prd amend <prd-id>(推送实现发现)
Pushes implementation discoveries back to the PRD. Renamed from old .
/prd pushProcess:
- Read current PRD from
.claude/prds/<prd-id>/prd.md - Read spec group requirements (if linked)
- Dispatch agent:
prd-amenderTask: prd-amender Prompt: | PRD path: .claude/prds/<prd-id>/prd.md Spec group: <linked spec group if any> Identify implementation discoveries: - New requirements discovered - Assumptions invalidated - Constraints discovered Update PRD with amendments Update Amendment Log with D-028 format entries - Report changes
- Staleness warning: After the PRD version is incremented, check for linked spec groups:
- Find spec groups where has
requirements.mdpointing to this PRDprd_path - Compare in the spec group's
prd_versionto the new PRD versionrequirements.md - If versions do not match, emit a warning:
"Spec group sg-XXX requirements.md is based on PRD vX but PRD is now vY. Runto re-extract requirements."
/prd sync - Include a diff summary of what changed in the PRD (sections added, modified, or removed)
- Cosmetic amendments: Even cosmetic changes (wording, formatting) trigger the staleness warning because the version/hash mechanism does not distinguish cosmetic from substantive changes. The diff summary enables the human to quickly judge whether re-sync is needed or the warning can be dismissed.
- Find spec groups where
将实现发现推送到PRD。从旧版重命名而来。
/prd push流程:
- 从读取当前PRD
.claude/prds/<prd-id>/prd.md - 读取关联的规格组需求(如果有)
- 调度Agent:
prd-amenderTask: prd-amender Prompt: | PRD path: .claude/prds/<prd-id>/prd.md Spec group: <linked spec group if any> 识别实现发现: - 发现的新需求 - 失效的假设 - 发现的约束 更新PRD并添加修订内容 以D-028格式更新修订日志 - 报告更改
- 过时警告:PRD版本递增后,检查关联的规格组:
- 查找中
requirements.md指向此PRD的规格组prd_path - 比较规格组中的
requirements.md与新PRD版本prd_version - 如果版本不匹配,发出警告:
"规格组sg-XXX的requirements.md基于PRD vX,但PRD现在是vY。运行重新提取需求。"
/prd sync - 包含PRD更改的差异摘要(添加、修改或删除的章节)
- ** cosmetic修订**:即使是 cosmetic更改(措辞、格式)也会触发过时警告,因为版本/哈希机制无法区分 cosmetic更改和实质性更改。差异摘要使用户能够快速判断是否需要重新同步或可以忽略警告。
- 查找
/prd status <prd-id> (Check PRD State)
/prd status <prd-id>(检查PRD状态)
Displays the current state of a PRD.
Process:
- Read PRD from
.claude/prds/<prd-id>/prd.md - Parse frontmatter for version and state
- Count Decisions Log entries
- Check for linked spec groups
Output:
PRD Status: <prd-id>
Title: <title from frontmatter>
Version: <version>
State: <state>
Decisions Log: <N> entries
Last Updated: <date>
Linked Spec Groups:
- sg-<id> (review_state: <state>)显示PRD的当前状态。
流程:
- 从读取PRD
.claude/prds/<prd-id>/prd.md - 解析前置元数据中的版本和状态
- 统计决策日志条目数量
- 检查关联的规格组
输出:
PRD状态:<prd-id>
标题:<title from frontmatter>
版本:<version>
状态:<state>
决策日志:<N>条条目
最后更新:<date>
关联规格组:
- sg-<id> (review_state: <state>)Edge Case Handling
边缘情况处理
EC-1: Zero Findings on First Pass
EC-1:首次通过无发现结果
If the first critique pass returns zero findings from all four critics:
- Present to human: "All four critics found no issues. The PRD may be complete."
- Request exit confirmation
- Exit loop if confirmed
如果首次评审通过后所有四个评审Agent都未发现问题:
- 向用户呈现:"所有四个评审Agent均未发现问题。PRD可能已完成。"
- 请求退出确认
- 如果确认则退出循环
EC-2: Critic Agent Failure
EC-2:评审Agent失败
If a critic agent fails or times out:
- Continue with findings from the remaining critics
- Note the failed critic in the pass summary: "Note: [perspective] critic failed. Will retry on next pass."
- On the next pass, retry the failed critic alongside all others
如果评审Agent失败或超时:
- 使用剩余评审Agent的发现结果继续
- 在通过摘要中注明失败的评审Agent:"注意:[视角]评审Agent失败。将在下一次通过时重试。"
- 在下一次通过时,与其他所有评审Agent一起重试失败的评审Agent
EC-3: Human Disagrees with Severity
EC-3:用户不同意严重性评级
If the human disagrees with a severity rating:
- Human's judgment takes precedence
- Record the override in the Decisions Log with rationale
如果用户不同意严重性评级:
- 用户的判断优先
- 在决策日志中记录覆盖决定及理由
EC-4: Loop Exceeds 5 Passes
EC-4:循环超过5次通过
After 5 passes without converging to Low-only:
- Present summary: "After 5 passes, N Medium+ findings remain: [list]"
- Options: (1) Resolve remaining, (2) Accept current state, (3) Defer to implementation
- Human decides
经过5次通过仍未收敛到仅低严重性结果:
- 呈现摘要:"经过5次通过后,仍有N个中+严重性发现结果:[列表]"
- 选项:(1) 解决剩余结果,(2) 接受当前状态,(3) 推迟到实现阶段
- 用户决定
EC-5: Resume Partially Completed PRD
EC-5:恢复部分完成的PRD
/prd <prd-id>- Missing sections: Resume interview
- Complete draft, no critiques: Start critique loop
- Has critique history: Start new critique pass with amended PRD
/prd <prd-id>- 缺少章节:恢复访谈
- 草稿完成,无评审:启动评审循环
- 有评审历史:使用修订后的PRD启动新的评审通过
EC-6: Wrong Org Context
EC-6:错误的组织上下文
The PRD Writer's assumption confirmation pattern handles corrections:
- Human corrects the assumption
- Org-context.md is updated with the correction at session end
PRD Writer的假设确认模式处理更正:
- 用户更正假设
- 会话结束时,org-context.md将更新为更正后的内容
Finding Presentation Format
发现结果呈现格式
When presenting findings to the human, use the action-first format. Findings are grouped by severity with the recommended action front-loaded:
markdown
undefined向用户呈现发现结果时,使用行动优先格式。发现结果按严重性分组,推荐行动前置:
markdown
undefinedCritique Pass <N> Results
评审通过<N>结果
Critical Findings (individual confirmation required)
严重发现结果(需单独确认)
TECH-001 (Critical): Accept -- add error response schema
Impact: Without this, Dev and QA will assume different formats, causing integration failures.
Finding: No error response format specified for API endpoints.
Detail: The PRD describes 5 API endpoints but does not specify the error response shape.
SEC-001 (Critical): Accept -- define auth token rotation policy
Impact: Stale tokens could be reused indefinitely, creating a session hijacking vector.
Finding: Token expiration policy not specified.
TECH-001(严重):接受——添加错误响应模式
影响:如果缺少此项,开发和QA将假设不同的格式,导致集成失败。
发现:未为API端点指定错误响应格式。
详情:PRD描述了5个API端点,但未指定错误响应的结构。
SEC-001(严重):接受——定义认证令牌轮换策略
影响:过期令牌可能被无限期重用,创建会话劫持风险。
发现:未指定令牌过期策略。
High Findings (individual confirmation required)
高严重性发现结果(需单独确认)
BIZ-001 (High): Accept -- add rollback success criteria
Impact: Feature launch without rollback criteria risks unrecoverable state.
Finding: No rollback plan defined for the migration.
BIZ-001(高):接受——添加回滚成功标准
影响:无回滚标准的功能发布可能导致不可恢复的状态。
发现:未定义迁移的回滚计划。
Medium Findings (batch shortcut available)
中严重性发现结果(提供批量快捷选项)
EDGE-001 (Medium): Accept -- document retry behavior
Impact: Users may see inconsistent behavior on transient failures.
Finding: Retry policy not specified for external API calls.
Batch shortcut: "Accept all Medium findings" (excludes security-tagged findings)
EDGE-001(中):接受——记录重试行为
影响:用户在临时故障时可能看到不一致的行为。
发现:未为外部API调用指定重试策略。
批量快捷选项:"接受所有中严重性发现结果"(不包含安全标记结果)
Low Findings (grouped)
低严重性发现结果(分组)
4 Low findings across all critics:
- TECH-003: <one-line summary>
- BIZ-002: <one-line summary>
- SEC-002: <one-line summary>
- EDGE-003: <one-line summary>
For each Critical/High finding, please provide:
- accept: Amend the PRD to address this
- reject: Not a real gap (provide rationale)
- defer: Acknowledged but out of scope for this PRD
For Medium findings: use batch shortcut or provide individual decisions.
Security-tagged findings at any severity are surfaced separately and require individual confirmation.
undefined所有评审Agent共发现4个低严重性结果:
- TECH-003:<一行摘要>
- BIZ-002:<一行摘要>
- SEC-002:<一行摘要>
- EDGE-003:<一行摘要>
对于每个严重/高严重性发现结果,请提供:
- accept:修订PRD以解决此问题
- reject:不是真正的漏洞(提供理由)
- defer:已确认但超出此PRD范围
对于中严重性发现结果:使用批量快捷选项或提供单独决策。
任何严重性的安全标记结果都单独展示,需要单独确认。
undefinedAction-First Field Order (Mandatory)
行动优先字段顺序(强制)
Each finding MUST follow this field order:
- Recommended action (accept/reject/defer verb)
- Impact indicator (one-sentence consequence if unaddressed)
- Finding summary (what was identified)
- Detail/evidence (collapsed/optional for Medium and Low)
每个发现结果必须遵循以下字段顺序:
- 推荐行动(accept/reject/defer动词)
- 影响指标(如果不解决的一句话后果)
- 发现摘要(识别的内容)
- 详情/证据(中低严重性结果可折叠/可选)
Agents
Agent
The skill uses four specialized agents:
/prd| Agent | Purpose | Used By |
|---|---|---|
| Conducts discovery interviews and drafts/amends PRDs in D-034 format | |
| Evaluates PRDs from one of four perspectives with severity ratings | |
| Extracts requirements from existing PRDs into EARS format | |
| Pushes implementation discoveries back to PRDs | |
/prd| Agent | 用途 | 使用场景 |
|---|---|---|
| 进行探索访谈并以D-034格式起草/修订PRD | |
| 从四个视角之一评估PRD并给出严重性评级 | |
| 从现有PRD提取需求并转换为EARS格式 | |
| 将实现发现推送到PRD | |
Integration with Workflow
与工作流集成
Flow 1: New PRD (Gather-Criticize Loop)
流程1:新建PRD(收集-评审循环)
User invokes /prd
↓
Cold start: load tech.context, org-context, existing PRDs
↓
PRD Writer: conversational discovery interview
↓
PRD draft saved to .claude/prds/<prd-id>/prd.md
↓
[Phase 1.5] Explore codebase for integration surfaces (oneoff-spec only)
↓
PRD Writer amends Integration Surface section with exploration findings
↓
Loop: 4 critics evaluate in parallel
↓
Findings presented by severity (Critical > High > Medium > Low summary)
↓
Human resolves findings
↓
PRD Writer amends PRD + updates Decisions Log
↓
Loop continues until all findings are Low + human confirms
↓
Org-context updated with new stable facts
↓
Optional: create spec group
↓
/spec → implementation用户调用 /prd
↓
冷启动:加载tech.context、org-context、现有PRD
↓
PRD Writer:对话式探索访谈
↓
PRD草稿保存到 .claude/prds/<prd-id>/prd.md
↓
[阶段1.5] 探索代码库查找集成面(仅oneoff-spec)
↓
PRD Writer使用探索结果修订集成面章节
↓
循环:4个评审Agent并行评估
↓
按严重性呈现发现结果(严重 > 高 > 中 > 低摘要)
↓
用户解决发现结果
↓
PRD Writer修订PRD + 更新决策日志
↓
循环继续,直到所有发现结果为低严重性且用户确认
↓
用新稳定事实更新org-context
↓
可选:创建规格组
↓
/spec → 实现Flow 2: Sync Existing PRD
流程2:同步现有PRD
PRD exists at .claude/prds/<prd-id>/prd.md
↓
/prd sync <prd-id>
↓
prd-reader extracts requirements
↓
Spec group created with requirements.md
↓
/spec → implementationPRD存在于 .claude/prds/<prd-id>/prd.md
↓
/prd sync <prd-id>
↓
prd-reader提取需求
↓
创建包含requirements.md的规格组
↓
/spec → 实现Flow 3: Push Implementation Discoveries
流程3:推送实现发现
During implementation, new requirements discovered
↓
/prd amend <prd-id>
↓
prd-amender updates PRD + Amendment Log
↓
PRD version incremented实现过程中发现新需求
↓
/prd amend <prd-id>
↓
prd-amender更新PRD + 修订日志
↓
PRD版本递增State Transitions
状态转换
On /prd (new PRD)
调用/prd(新建PRD)时
- PRD created at
.claude/prds/<prd-id>/prd.md - Frontmatter: ,
version: 1.0state: draft - After loop exits:
state: reviewed
- PRD创建于
.claude/prds/<prd-id>/prd.md - 前置元数据:,
version: 1.0state: draft - 循环退出后:
state: reviewed
On /prd sync
调用/prd sync时
- Spec group created with
review_state: DRAFT - Manifest linked to PRD
- 创建规格组,
review_state: DRAFT - 清单链接到PRD
On /prd amend
调用/prd amend时
- PRD version incremented
- Amendment Log updated
- PRD state set to (agent change, needs human review)
draft
- PRD版本递增
- 修订日志更新
- PRD状态设置为(Agent修改,需用户查看)
draft
Error Handling
错误处理
PRD Not Found
PRD未找到
Error: PRD '<prd-id>' not found
Expected path: .claude/prds/<prd-id>/prd.md
Available PRDs:
- <list from .claude/prds/*/prd.md>
To create a new PRD, run: /prd错误:未找到PRD '<prd-id>'
预期路径:.claude/prds/<prd-id>/prd.md
可用PRD:
- <list from .claude/prds/*/prd.md>
要创建新PRD,请运行:/prdNo PRDs Exist
无PRD存在
No PRDs found in .claude/prds/
To create a new PRD, run: /prd
To sync an existing document, place it at .claude/prds/<prd-id>/prd.md and run: /prd sync <prd-id>在 .claude/prds/ 中未找到PRD
要创建新PRD,请运行:/prd
要同步现有文档,请将其放置在 .claude/prds/<prd-id>/prd.md 并运行:/prd sync <prd-id>