Loading...
Loading...
Compare original and translation side by side
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ prd-writing- │────►│ prd-to- │ │ reverse- │
│ guide │ │ engineering- │ │ engineering- │
│ Write PRD │ │ spec │ │ spec │
│ │ │ [THIS SKILL] │ │ Code→Spec │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼ For AI Agent products:
┌─────────────────┐
│ ai-agent-prd │────► This skill handles Agent PRD conversion too
└─────────────────┘prd-writing-guideai-agent-prd┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ prd-writing- │────►│ prd-to- │ │ reverse- │
│ guide │ │ engineering- │ │ engineering- │
│ Write PRD │ │ spec │ │ spec │
│ │ │ [THIS SKILL] │ │ Code→Spec │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼ 针对AI Agent产品:
┌─────────────────┐
│ ai-agent-prd │────► 本技能同样支持Agent PRD转换
└─────────────────┘prd-writing-guideai-agent-prdbash scripts/generate_spec_skeleton.shbash scripts/validate_spec.shbash scripts/generate_spec_skeleton.shbash scripts/validate_spec.shprd-writing-guide┌──────────────────────────────────────────────────────────────────┐
│ The Engineering Lenses │
├──────────────────────────────────────────────────────────────────┤
│ │
│ 1. ARCHITECTURE How does it fit? Layers, modules, comms. │
│ 2. DATA How modeled, validated, stored, migrated? │
│ 3. CONTRACT Interfaces? Versioning? What breaks? │
│ 4. FAILURE How does it fail? Detect, recover, cascade? │
│ 5. SECURITY Auth, authz, encryption, audit, secrets? │
│ 6. OPERATIONS Deploy, configure, monitor, scale, rollback? │
│ 7. REPLICABILITY All configs, deps, assumptions documented? │
│ │
└──────────────────────────────────────────────────────────────────┘| Lens | Key Question | Spec Output |
|---|---|---|
| Architecture | Where does it sit? What depends on it? | Module diagram, dependency graph |
| Data | What data does it own? Shape? Consistency? | Entity definitions, schemas |
| Contract | What's the interface? What can't change? | API specs, event schemas |
| Failure | What can go wrong? What then? | Error catalog, retry policies |
| Security | Who accesses? How protected? | Auth rules, encryption spec |
| Operations | How deployed and observed? | Config, metrics, alerts |
| Replicability | Any implicit knowledge not captured? | Env setup, all dependencies |
prd-writing-guide┌──────────────────────────────────────────────────────────────────┐
│ 工程视角 │
├──────────────────────────────────────────────────────────────────┤
│ │
│ 1. 架构 定位如何?分层、模块、通信方式。 │
│ 2. 数据 如何建模、验证、存储、迁移? │
│ 3. 契约 接口定义?版本控制?哪些内容不可变更? │
│ 4. 故障 可能出现哪些故障?如何检测、恢复、避免级联故障? │
│ 5. 安全 认证、授权、加密、审计、密钥管理? │
│ 6. 运维 部署、配置、监控、扩容、回滚? │
│ 7. 可复制性 所有配置、依赖、假设是否都已文档化? │
│ │
└──────────────────────────────────────────────────────────────────┘| 视角 | 核心问题 | 规格输出 |
|---|---|---|
| 架构 | 它的定位?依赖它的组件有哪些? | 模块图、依赖关系图 |
| 数据 | 它管理哪些数据?数据结构?一致性要求? | 实体定义、数据Schema |
| 契约 | 接口是什么?哪些内容不能变更? | API规格、事件Schema |
| 故障 | 可能出现哪些问题?如何处理? | 错误目录、重试策略 |
| 安全 | 谁可以访问?如何保护? | 认证规则、加密规格 |
| 运维 | 如何部署和监控? | 配置说明、指标、告警规则 |
| 可复制性 | 是否有未记录的隐含信息? | 环境搭建说明、所有依赖清单 |
Phase 0: PRD Validation ──────► Defect Report ──────► PRD Complete
↓
Phase 1: Decomposition ──► User Stories, Requirements Matrix
↓
Phase 2: Technical Design (Interactive) ──► Decision Log
↓
Phase 3: Detailed Specs ──► Engineering Lenses on every component
↓
Phase 4: Test Specs ──► Unit, Integration, E2E, Acceptance
↓
Phase 5: Task Breakdown ──► Tasks, Milestones, Risks
↓
Phase 6: Assembly & Replicability ReviewPhase 0: PRD验证 ──────► 缺陷报告 ──────► PRD完整
↓
Phase 1: 需求分解 ──► 用户故事、需求矩阵
↓
Phase 2: 技术设计(交互式) ──► 决策日志
↓
Phase 3: 详细规格 ──► 对每个组件应用工程视角
↓
Phase 4: 测试规格 ──► 单元测试、集成测试、E2E测试、验收测试
↓
Phase 5: 任务分解 ──► 任务、里程碑、风险
↓
Phase 6: 组装与可复制性评审undefinedundefined| # | Category | Issue | Impact | Resolution |
|---|
| 序号 | 分类 | 问题 | 影响 | 解决方案 |
|---|
---
---undefinedundefinedundefinedundefined| ID | Requirement | Source | Type | Priority |
|---|---|---|---|---|
| FR-001 | [description] | US-001 | CRUD/Logic | P0 |
| NFR-001 | API response <200ms P95 | PRD §7 | Performance | P0 |
| ID | 需求描述 | 来源 | 类型 | 优先级 |
|---|---|---|---|---|
| FR-001 | [描述] | US-001 | CRUD/逻辑 | P0 |
| NFR-001 | API响应时间P95 <200ms | PRD第7节 | 性能 | P0 |
| ID | Decision | Options | Chosen | Rationale | Trade-offs | Date |
|---|---|---|---|---|---|---|
| D-001 | Database | PG, Mongo | PostgreSQL | ACID, JSON support | Higher ops complexity | [date] |
| ID | 决策内容 | 可选方案 | 最终选择 | 理由 | 权衡 | 日期 |
|---|---|---|---|---|---|---|
| D-001 | 数据库选择 | PG, Mongo | PostgreSQL | 支持ACID和JSON | 运维复杂度更高 | [日期] |
| Component | Choice | Version | Rationale | Alternatives |
|---|---|---|---|---|
| Language | ||||
| Framework | ||||
| Database | ||||
| Cache | ||||
| Queue | ||||
| Infra |
| 组件 | 选择 | 版本 | 理由 | 备选方案 |
|---|---|---|---|---|
| 编程语言 | ||||
| 框架 | ||||
| 数据库 | ||||
| 缓存 | ||||
| 消息队列 | ||||
| 基础设施 |
| Area | Must Document |
|---|---|
| Authentication | Protocol (OAuth2/JWT/session), token lifecycle, refresh flow, MFA |
| Authorization | Permission model (RBAC/ABAC), role-permission matrix, enforcement points |
| Data Security | Classification levels, encryption (at-rest, in-transit), PII handling |
| Input Security | Validation strategy, injection prevention, file upload rules |
| Audit | Events to log, format, retention period, tamper protection |
| Secrets | Storage method, rotation policy, access control |
| 领域 | 必须文档化的内容 |
|---|---|
| 认证 | 协议(OAuth2/JWT/会话)、令牌生命周期、刷新流程、MFA |
| 授权 | 权限模型(RBAC/ABAC)、角色-权限矩阵、执行点 |
| 数据安全 | 数据分类级别、加密(静态/传输中)、PII处理规则 |
| 输入安全 | 验证策略、注入防护、文件上传规则 |
| 审计 | 需记录的事件、格式、保留周期、防篡改措施 |
| 密钥管理 | 存储方式、轮换策略、访问控制 |
| Area | Must Document |
|---|---|
| Environments | Dev, staging, prod differences; how to provision |
| Deployment | CI/CD pipeline, container spec, rollout strategy |
| Configuration | Every env var / config param with type, default, description, allowed values |
| Monitoring | Key metrics, alert thresholds, dashboard definitions |
| Logging | Format, levels, correlation IDs, PII redaction |
| Scaling | Triggers, resource limits, auto-scale rules |
| Recovery | Backup schedule, RTO/RPO, failover procedure, data restore process |
| 领域 | 必须文档化的内容 |
|---|---|
| 环境 | 开发、 staging、生产环境的差异;如何部署 |
| 部署 | CI/CD流水线、容器规格、发布策略 |
| 配置 | 所有环境变量/配置参数的类型、默认值、描述、允许值 |
| 监控 | 核心指标、告警阈值、仪表盘定义 |
| 日志 | 格式、级别、关联ID、PII脱敏规则 |
| 扩容 | 触发条件、资源限制、自动扩容规则 |
| 恢复 | 备份计划、RTO/RPO、故障转移流程、数据恢复步骤 |
| Requirement | Unit | Integration | E2E | Acceptance | Performance | Security |
|---|---|---|---|---|---|---|
| FR-001 | UT-001 | IT-001 | E2E-001 | AT-001 | - | - |
| NFR-001 | - | - | - | - | PERF-001 | - |
| 需求 | 单元测试 | 集成测试 | E2E测试 | 验收测试 | 性能测试 | 安全测试 |
|---|---|---|---|---|---|---|
| FR-001 | UT-001 | IT-001 | E2E-001 | AT-001 | - | - |
| NFR-001 | - | - | - | - | PERF-001 | - |
undefinedundefinedundefinedundefined| Milestone | Tasks | Target | Deliverable | Verification |
|---|---|---|---|---|
| M1: Data | 001-003 | [date] | Schema + migrations | Runs clean |
| M2: API | 004-008 | [date] | Endpoints + tests | Integration tests pass |
| M3: Security | 009-011 | [date] | Auth + audit | Security review pass |
| M4: Deploy | 012-014 | [date] | CI/CD + monitoring | Health checks green |
| 里程碑 | 包含任务 | 目标日期 | 交付物 | 验证方式 |
|---|---|---|---|---|
| M1: 数据层 | 001-003 | [日期] | Schema + 迁移脚本 | 可正常运行 |
| M2: API层 | 004-008 | [日期] | 接口 + 测试 | 集成测试通过 |
| M3: 安全层 | 009-011 | [日期] | 认证 + 审计 | 安全评审通过 |
| M4: 部署 | 012-014 | [日期] | CI/CD + 监控 | 健康检查正常 |
| Risk | Prob | Impact | Mitigation | Contingency |
|---|---|---|---|---|
| [risk] | H/M/L | H/M/L | [prevent] | [if happens] |
| 风险 | 概率 | 影响 | 缓解措施 | 应急预案 |
|---|---|---|---|---|
| [风险描述] | 高/中/低 | 高/中/低 | [预防措施] | [风险发生后的处理] |
bash scripts/validate_spec.sh <spec_root>bash scripts/validate_spec.sh <spec_root>engineering-spec/
├── 00_Overview/
│ ├── SUMMARY.md, REQUIREMENTS_MATRIX.md, DECISION_LOG.md, TECH_STACK.md
├── 01_Requirements/
│ ├── USER_STORIES.md, FUNCTIONAL_REQS.md, NON_FUNCTIONAL_REQS.md
├── 02_Technical_Design/
│ ├── ARCHITECTURE.md, DATA_MODEL.md, API_SPEC.md
│ ├── BUSINESS_LOGIC.md, AI_COMPONENTS.md (if applicable)
├── 03_Security/
│ ├── AUTH_DESIGN.md, DATA_SECURITY.md, AUDIT_SPEC.md
├── 04_Operations/
│ ├── DEPLOYMENT.md, CONFIGURATION.md, MONITORING.md, RUNBOOK.md
├── 05_Testing/
│ ├── TEST_PLAN.md, ACCEPTANCE_TESTS.md
├── 06_Implementation/
│ ├── TASK_BREAKDOWN.md, MILESTONES.md, RISKS.md, MIGRATION.md
└── SPEC_INDEX.mdengineering-spec/
├── 00_概述/
│ ├── SUMMARY.md, REQUIREMENTS_MATRIX.md, DECISION_LOG.md, TECH_STACK.md
├── 01_需求/
│ ├── USER_STORIES.md, FUNCTIONAL_REQS.md, NON_FUNCTIONAL_REQS.md
├── 02_技术设计/
│ ├── ARCHITECTURE.md, DATA_MODEL.md, API_SPEC.md
│ ├── BUSINESS_LOGIC.md, AI_COMPONENTS.md(如适用)
├── 03_安全/
│ ├── AUTH_DESIGN.md, DATA_SECURITY.md, AUDIT_SPEC.md
├── 04_运维/
│ ├── DEPLOYMENT.md, CONFIGURATION.md, MONITORING.md, RUNBOOK.md
├── 05_测试/
│ ├── TEST_PLAN.md, ACCEPTANCE_TESTS.md
├── 06_实施/
│ ├── TASK_BREAKDOWN.md, MILESTONES.md, RISKS.md, MIGRATION.md
└── SPEC_INDEX.mdscripts/generate_spec_skeleton.shscripts/validate_spec.shreferences/prd-validation-checklist.mdreferences/spec-templates.mdreferences/feature-spec-template.mdreferences/ai-feature-spec.mdreferences/agent-system-spec.mdreferences/security-spec-guide.mdreferences/operations-spec.mdreferences/worked-example.mdscripts/generate_spec_skeleton.shscripts/validate_spec.shreferences/prd-validation-checklist.mdreferences/spec-templates.mdreferences/feature-spec-template.mdreferences/ai-feature-spec.mdreferences/agent-system-spec.mdreferences/security-spec-guide.mdreferences/operations-spec.mdreferences/worked-example.md