mcpField
B
blueprint-derive-prd

blueprint-derive-prd

github.com/laurigates开发5960 次安装1 天前更新
代码仓库

关于 blueprint-derive-prd

blueprint-derive-prd 是为已有项目生成产品需求文档(PRD)的技能,适用于将项目接入 Blueprint Development 流程的团队。它分析 README、文档和项目结构,并引导澄清需求、更新 manifest 及后续任务。

主要功能

  1. 01分析 README 与项目文档
  2. 02提取问题、用户与功能
  3. 03生成 PRD 并分配文档 ID
  4. 04更新 Blueprint manifest
  5. 05引导澄清缺失信息
  6. 06提供后续工作建议

适用场景

  1. 01为已有项目补写 PRD
  2. 02从现有资料提炼用户目标
  3. 03将 PRD 纳入 Blueprint 记录
  4. 04为 PRD 关联 GitHub issue

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/laurigates/claude-plugins --skill blueprint-derive-prd

安装后在 Claude Code 中输入/blueprint-derive-prd确认已加载。

详细介绍

通过分析 README、文档和项目结构,为现有项目生成产品需求文档(PRD)。

适用场景

在以下情况下使用此技能……在以下情况下改用 blueprint-derive-adr……
你正在熟悉现有项目,需要根据 README/文档生成 PRD你想将架构决策记录为 ADR,而不是需求
你需要从现有文本中提取问题陈述、利益相关者和用户画像改用 blueprint-derive-plans,同时推导 PRD、ADR 和 PRP
你想追溯记录功能和用户目标如果需要先初始化 Blueprint,请改用 blueprint-init

使用场景:将现有项目接入 Blueprint Development 系统。

前置条件:

  • 已初始化 Blueprint Development(存在 docs/blueprint/)
  • 项目已有一些文档(README.md、docs/ 等)

步骤:

阶段 1:发现

1.1 检查前置条件
ls docs/blueprint/manifest.json

如果未找到 → 建议先运行 /blueprint:init。

1.2 收集项目文档

搜索现有文档:

fd -e md -d 3 . | head -20

重点查找以下文件:

  • README.md - 项目主要说明
  • docs/ - 文档目录
  • CONTRIBUTING.md - 贡献指南
  • ARCHITECTURE.md - 架构概述
  • package.json / pyproject.toml / Cargo.toml - 项目元数据
1.3 阅读主要文档

阅读并分析:

  • README.md,了解项目用途、功能和用法
  • 包清单,了解依赖项和脚本
  • 任何现有的架构或设计文档

阶段 2:分析与提取

2.1 提取项目背景

从文档中识别:

方面来源缺失时要问的问题
项目名称包清单、README询问用户
用途/问题README 简介“此项目解决什么问题?”
目标用户README、文档“主要用户是谁?”
核心功能README 功能章节“主要能力有哪些?”
技术栈依赖项、文件扩展名根据文件推断
2.2 提出澄清问题

对不明确的事项使用 AskUserQuestion:

question: "What is the primary problem this project solves?"
options:
  - "[Inferred from docs]: {description}" → confirm inference
  - "Let me describe it" → free text input
question: "Who are the target users?"
options:
  - "Developers" → technical documentation focus
  - "End users" → user experience focus
  - "Both developers and end users" → balanced approach
  - "Other" → custom description
question: "What is the current project phase?"
options:
  - "Early development / MVP" → focus on core features
  - "Active development" → feature expansion
  - "Maintenance mode" → stability and bug fixes
  - "Planning major changes" → architectural considerations
2.3 识别利益相关者

询问利益相关者:

question: "Who are the key stakeholders for this project?"
options:
  - "Solo project (just me)" → simplified RACI
  - "Small team (2-5 people)" → team collaboration
  - "Larger organization" → formal stakeholder matrix
  - "Open source community" → contributor-focused

阶段 3:生成 PRD

3.1 生成文档 ID

创建 PRD 之前,生成一个唯一 ID:

# Get next PRD ID from manifest
next_prd_id() {
  local manifest="docs/blueprint/manifest.json"
  local last=$(jq -r '.id_registry.last_prd // 0' "$manifest" 2>/dev/null || echo "0")
  local next=$((last + 1))
  printf "PRD-%03d" "$next"
}

保存生成的 ID,以便在文档和清单更新中使用。

3.2 创建 PRD 文件

在 docs/prds/ 中创建 PRD:

docs/prds/project-overview.md
3.3 PRD 模板

按以下结构生成 PRD:

---
id: {PRD-NNN}
created: {YYYY-MM-DD}
modified: {YYYY-MM-DD}
status: Draft
version: "1.0"
relates-to: []
github-issues: []
name: blueprint-derive-prd
---

# {Project Name} - Product Requirements Document

## Executive Summary

### Problem Statement
{Extracted or confirmed problem description}

### Proposed Solution
{Project description and approach}

### Business Impact
{Value proposition and expected outcomes}

## Stakeholders & Personas

### Stakeholder Matrix
| Role | Name/Team | Responsibility | Contact |
|------|-----------|----------------|---------|
| {role} | {name} | {responsibility} | {contact} |

### User Personas

#### Primary: {Persona Name}
- **Description**: {who they are}
- **Needs**: {what they need}
- **Pain Points**: {current frustrations}
- **Goals**: {what success looks like}

## Functional Requirements

### Core Features
{List of main capabilities extracted from docs}

| ID | Feature | Description | Priority |
|----|---------|-------------|----------|
| FR-001 | {feature} | {description} | {P0/P1/P2} |

### User Stories
{User stories derived from features}

- As a {user type}, I want to {action} so that {benefit}

## Non-Functional Requirements

### Performance
- {Response time expectations}
- {Throughput requirements}

### Security
- {Authentication requirements}
- {Data protection needs}

### Accessibility
- {Accessibility standards to follow}

### Compatibility
- {Browser/platform/version support}

## Technical Considerations

### Architecture
{High-level architecture from docs or inferred}

### Dependencies
{Key dependencies from package manifest}

### Integration Points
{External services, APIs, databases}

## Success Metrics

| Metric | Current | Target | Measurement |
|--------|---------|--------|-------------|
| {metric} | {baseline} | {goal} | {how to measure} |

## Scope

### In Scope
- {Included features and capabilities}

### Out of Scope
- {Explicitly excluded items}
- {Future considerations}

## Timeline & Phases

### Current Phase: {phase name}
{Description of current work focus}

### Roadmap
| Phase | Focus | Status |
|-------|-------|--------|
| {phase} | {focus areas} | {status} |

---
*Generated from existing documentation via /blueprint:derive-prd*
*Review and update as project evolves*

阶段 4:验证与后续步骤

4.1 展示摘要

向用户展示:

✅ PRD Generated: {Project Name}

**ID**: {PRD-NNN}
**Location**: `docs/prds/project-overview.md`

**Extracted from**:
- {list of source documents}

**Key sections**:
- Executive Summary: {status}
- Stakeholders: {count} identified
- Functional Requirements: {count} features
- Non-Functional Requirements: {status}

**Confidence**: {High/Medium/Low}
- {High confidence areas}
- {Areas needing review}

**Recommended next steps**:
1. Review and refine the generated PRD
2. Run `/blueprint:derive-adr` to document architecture decisions
3. Run `/blueprint:prp-create` for specific features
4. Run `/blueprint:generate-skills` to create project skills
4.2 建议后续步骤

根据生成的内容:

  • 如果架构不明确 → 建议使用 /blueprint:derive-adr
  • 如果已识别功能 → 建议对关键功能使用 /blueprint:prp-create
  • 如果 PRD 已完成 → 建议使用 /blueprint:generate-skills

阶段 5:更新清单

更新 docs/blueprint/manifest.json:

  • 将 PRD 添加到 generated_artifacts
  • 将 has_prds 更新为 true
  • 更新 updated_at 时间戳
  • 更新 ID 注册表:
    {
      "id_registry": {
        "last_prd": {new_number},
        "documents": {
          "{PRD-NNN}": {
            "path": "docs/prds/{filename}.md",
            "title": "{Project Name}",
            "github_issues": [],
            "created": "{date}"
          }
        }
      }
    }
    

提示:

  • 认真阅读现有文档,其中往往包含有价值的背景信息
  • 对含糊或缺失的信息提出澄清问题
  • 文档较少时,根据代码结构进行推断
  • 标记不确定的部分,供用户审阅
  • 让 PRD 聚焦于“是什么”和“为什么”,而非“如何实现”
4.3 更新任务注册表

更新 docs/blueprint/manifest.json 中的任务注册表条目:

jq --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
  --argjson created "${PRDS_GENERATED:-1}" \
  '.task_registry["derive-prd"].last_completed_at = $now |
   .task_registry["derive-prd"].last_result = "success" |
   .task_registry["derive-prd"].stats.runs_total = ((.task_registry["derive-prd"].stats.runs_total // 0) + 1) |
   .task_registry["derive-prd"].stats.items_created = $created' \
  docs/blueprint/manifest.json > tmp.json && mv tmp.json docs/blueprint/manifest.json
4.4 提示创建 GitHub Issue(使用 AskUserQuestion):
question: "Create a GitHub issue to track this PRD?"
options:
  - label: "Yes, create issue (Recommended)"
    description: "Creates issue with title '[PRD-NNN] {Project Name}'"
  - label: "No, skip for now"
    description: "Can link later by editing github-issues in frontmatter"

如果回答是,则创建 GitHub issue:

gh issue create \
  --title "[{PRD-NNN}] {Project Name}" \
  --body "## Product Requirements Document

**Document**: \`docs/prds/{filename}.md\`
**ID**: {PRD-NNN}

### Summary
{Executive summary from PRD}

### Key Features
{List of FR-* features}

name: blueprint-derive-prd
---
*Auto-generated from PRD. See linked document for full requirements.*" \
  --label "prd,requirements"

记录 issue 编号并更新:

  1. PRD frontmatter:将 issue 编号添加到 github-issues
  2. 清单:将 issue 添加到 id_registry.documents[PRD-NNN].github_issues
  3. 清单:将映射添加到 id_registry.github_issues
4.5 下一步提示词(使用 AskUserQuestion):
question: "PRD generated. What would you like to do next?"
options:
  - label: "Document architecture decisions (Recommended)"
    description: "Run /blueprint:derive-adr to capture technical decisions"
  - label: "Generate project skills"
    description: "Extract skills from PRD for Claude context"
  - label: "Create a PRP for a feature"
    description: "Start implementing a specific feature"
  - label: "Review and refine PRD"
    description: "I want to edit the generated PRD first"
  - label: "I'm done for now"
    description: "Exit - PRD is saved"

根据选择:

  • “记录架构决策” → 运行 /blueprint:derive-adr
  • “生成项目技能” → 运行 /blueprint:generate-skills
  • “创建 PRP” → 运行 /blueprint:prp-create(询问功能名称)
  • “审查并完善” → 显示 PRD 文件位置和需要关注的关键章节
  • “我已完成” → 退出

错误处理:

  • 如果没有 README.md → 询问用户项目描述
  • 如果 blueprint 尚未初始化 → 建议运行 /blueprint:init
  • 如果文档中存在冲突信息 → 请用户澄清

评论

支持 Markdown