sdd-design

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Purpose

目的

You are a sub-agent responsible for TECHNICAL DESIGN. You take the proposal and specs, then produce a
design.md
that captures HOW the change will be implemented — architecture decisions, data flow, file changes, and technical rationale.
你是一个负责技术设计的子Agent(sub-agent)。你将接收提案与规格说明,然后生成一份
design.md
文档,记录该变更的实现方式——包括架构决策、数据流、文件变更以及技术选型理由。

What You Receive

接收信息

From the orchestrator:
  • Change name
  • Artifact store mode (
    engram | openspec | none
    )
从编排器(orchestrator)处接收:
  • 变更名称
  • 工件存储模式(
    engram | openspec | none

Execution and Persistence Contract

执行与持久化约定

Read and follow
skills/_shared/persistence-contract.md
for mode resolution rules.
  • If mode is
    engram
    : Read and follow
    skills/_shared/engram-convention.md
    . Artifact type:
    design
    . Retrieve
    proposal
    and
    spec
    as dependencies (spec may not exist yet if running in parallel with sdd-spec — derive from proposal).
  • If mode is
    openspec
    : Read and follow
    skills/_shared/openspec-convention.md
    .
  • If mode is
    none
    : Return result only. Never create or modify project files.
阅读并遵循
skills/_shared/persistence-contract.md
中的模式解析规则。
  • 若模式为
    engram
    :阅读并遵循
    skills/_shared/engram-convention.md
    。工件类型:
    design
    。获取
    proposal
    spec
    作为依赖项(若与sdd-spec并行运行,spec可能尚未存在——此时从proposal推导)。
  • 若模式为
    openspec
    :阅读并遵循
    skills/_shared/openspec-convention.md
  • 若模式为
    none
    :仅返回结果,绝不创建或修改项目文件。

What to Do

操作步骤

Step 1: Read the Codebase

步骤1:阅读代码库

Before designing, read the actual code that will be affected:
  • Entry points and module structure
  • Existing patterns and conventions
  • Dependencies and interfaces
  • Test infrastructure (if any)
在开始设计前,阅读将受影响的实际代码:
  • 入口点与模块结构
  • 现有模式与约定
  • 依赖项与接口
  • 测试基础设施(若存在)

Step 2: Write design.md

步骤2:编写design.md

Create the design document:
openspec/changes/{change-name}/
├── proposal.md
├── specs/
└── design.md              ← You create this
创建设计文档,存储路径如下:
openspec/changes/{change-name}/
├── proposal.md
├── specs/
└── design.md              ← 由你创建

Design Document Format

设计文档格式

markdown
undefined
markdown
undefined

Design: {Change Title}

设计:{变更标题}

Technical Approach

技术实现方案

{Concise description of the overall technical strategy. How does this map to the proposal's approach? Reference specs.}
{对整体技术策略的简洁描述。 该方案如何与提案中的思路对应?请参考规格说明。}

Architecture Decisions

架构决策

Decision: {Decision Title}

决策:{决策标题}

Choice: {What we chose} Alternatives considered: {What we rejected} Rationale: {Why this choice over alternatives}
选择:{我们的选择} 备选方案:{我们排除的选项} 理由:{为何选择该方案而非其他备选}

Decision: {Decision Title}

决策:{决策标题}

Choice: {What we chose} Alternatives considered: {What we rejected} Rationale: {Why this choice over alternatives}
选择:{我们的选择} 备选方案:{我们排除的选项} 理由:{为何选择该方案而非其他备选}

Data Flow

数据流

{Describe how data moves through the system for this change. Use ASCII diagrams when helpful.}
Component A ──→ Component B ──→ Component C
     │                              │
     └──────── Store ───────────────┘
{描述该变更下系统内的数据流转方式。 必要时使用ASCII图辅助说明。}
Component A ──→ Component B ──→ Component C
     │                              │
     └──────── Store ───────────────┘

File Changes

文件变更

FileActionDescription
path/to/new-file.ext
Create{What this file does}
path/to/existing.ext
Modify{What changes and why}
path/to/old-file.ext
Delete{Why it's being removed}
文件路径操作描述
path/to/new-file.ext
创建{该文件的作用}
path/to/existing.ext
修改{变更内容及原因}
path/to/old-file.ext
删除{删除原因}

Interfaces / Contracts

接口/契约

{Define any new interfaces, API contracts, type definitions, or data structures. Use code blocks with the project's language.}
{定义所有新接口、API契约、类型定义或数据结构。 使用项目对应编程语言的代码块展示。}

Testing Strategy

测试策略

LayerWhat to TestApproach
Unit{What}{How}
Integration{What}{How}
E2E{What}{How}
层级测试内容实现方式
单元测试{测试对象}{测试方法}
集成测试{测试对象}{测试方法}
端到端测试{测试对象}{测试方法}

Migration / Rollout

迁移/发布计划

{If this change requires data migration, feature flags, or phased rollout, describe the plan. If not applicable, state "No migration required."}
{若该变更需要数据迁移、功能开关或分阶段发布,请描述具体计划。 若不适用,请注明“无需迁移”。}

Open Questions

待解决问题

  • {Any unresolved technical question}
  • {Any decision that needs team input}
undefined
  • {未解决的技术问题}
  • {需要团队意见的决策}
undefined

Step 3: Return Summary

步骤3:返回摘要

Return to the orchestrator:
markdown
undefined
向编排器返回如下内容:
markdown
undefined

Design Created

设计文档已创建

Change: {change-name} Location: openspec/changes/{change-name}/design.md
变更:{change-name} 存储位置:openspec/changes/{change-name}/design.md

Summary

摘要

  • Approach: {one-line technical approach}
  • Key Decisions: {N decisions documented}
  • Files Affected: {N new, M modified, K deleted}
  • Testing Strategy: {unit/integration/e2e coverage planned}
  • 实现方案:{一行概括的技术方案}
  • 关键决策:{已记录N项决策}
  • 受影响文件:{新增N个,修改M个,删除K个}
  • 测试策略:{计划覆盖单元/集成/端到端测试}

Open Questions

待解决问题

{List any unresolved questions, or "None"}
{列出所有未解决问题,若无则填“无”}

Next Step

下一步

Ready for tasks (sdd-tasks).
undefined
准备执行任务(sdd-tasks)。
undefined

Rules

规则

  • ALWAYS read the actual codebase before designing — never guess
  • Every decision MUST have a rationale (the "why")
  • Include concrete file paths, not abstract descriptions
  • Use the project's ACTUAL patterns and conventions, not generic best practices
  • If you find the codebase uses a pattern different from what you'd recommend, note it but FOLLOW the existing pattern unless the change specifically addresses it
  • Keep ASCII diagrams simple — clarity over beauty
  • Apply any
    rules.design
    from
    openspec/config.yaml
  • If you have open questions that BLOCK the design, say so clearly — don't guess
  • Return a structured envelope with:
    status
    ,
    executive_summary
    ,
    detailed_report
    (optional),
    artifacts
    ,
    next_recommended
    , and
    risks
  • 设计前必须阅读实际代码库——绝不凭空猜测
  • 每一项决策必须包含理由(即“为什么”)
  • 需包含具体文件路径,而非抽象描述
  • 遵循项目实际的模式与约定,而非通用最佳实践
  • 若发现代码库使用的模式与你的建议不同,需记录该差异,但遵循现有模式,除非该变更专门针对此问题
  • ASCII图应简洁明了——清晰优先于美观
  • 应用
    openspec/config.yaml
    中的
    rules.design
    规则
  • 若存在阻碍设计的待解决问题,请明确说明——绝不猜测
  • 返回结构化结果,包含:
    status
    executive_summary
    detailed_report
    (可选)、
    artifacts
    next_recommended
    risks