☰
SDD Spec-Driven Development
2026/10/14 6:11:59 网站建设 项目流程

记录几个模板

规格文件

不同团队的具体模板会有差异,但核心内容大致包括:

  • 页面/交互结构定义:应用包含哪些页面、每个页面的字段组成、操作按钮及其触发条件,以及页面之间的跳转关系
  • 数据模型定义:数据实体、字段类型与约束、实体间的关联关系
  • 业务规则与权限约束:核心业务逻辑、访问控制边界
  • 验收标准:以验收准则为导向的功能与非功能需求(如延迟、可用性等可量化指标)
  • 技术架构与依赖:数据契约、集成边界、错误行为、并发假设,以及风险与缓解措施

spec.md

  • 明确 Non-Goals/Goals
  • Problem Statement:为什么做?
  • Success Metrics:做到什么程度算完?(必须可量化)
  • User Stories:谁在什么场景下用?
  • Acceptance Criteria:如何验证?
  • Constraints:技术限制是什么?
工具定位核心特点适用场景
Spec Kit (GitHub)Agent-agnostic 框架三文件体系 + constitution通用项目(43.7k Star)
OpenSpec (Fission-AI)轻量迭代工具Spec 在对话中完善小型快速项目
Kiro (AWS)SDD-native IDE完整 IDE 集成AWS 生态
QoderWork (阿里)Quest 执行引擎Spec → Quest → PR 自动化阿里生态

Feature Spec 模板

Goal(一句话目标)

  • ...

Non-goals(明确不做)

  • ...

Acceptance Criteria(验收标准)

  • Given ...
  • When ...
  • Then ...

Edge Cases(边界条件)

  • 空值/缺省:
  • 重复/幂等:
  • 并发/竞态:
  • 权限/可见性:

Output / Deliverables(交付物)

  • API / DB / UI 变更:
  • 测试清单:
  • 回滚说明:

另一种Simple Example

## Login Feature **What it does:** Allows registered users to access the application. **Requirements:** - SHALL accept email and password - SHALL validate email format before submission - SHALL display error for invalid credentials - SHALL redirect to dashboard on successful login - SHALL rate-limit to 5 attempts per 15 minutes **Scenarios:** 1. Valid credentials → redirect to /dashboard 2. Invalid credentials → show error, do not redirect 3. Empty fields → show validation errors 4. 6th failed attempt → show rate limit message **Constraints:** - SHALL NOT store passwords in plain text - SHALL NOT allow brute force attacks - SHALL NOT expose whether email exists

docs/specs/checkout-coupon/ proposal.md 为什么现在做、影响谁 spec.md 需求和场景 design.md 决策和取舍 tasks.md 可评审实现切片 test-evidence.md 合并前必须提供的证据

API Spec 模板(OpenAPI 思路)

Endpoint

  • Method: GET/POST/PUT/DELETE
  • Path: /v1/...
  • Owner: ...

Request

  • Headers:
  • Query:
  • Body schema:
    • field: type / required / default / constraints
  • Example request:

Response

  • Success (2xx):
    • schema:
    • example:
  • Error (4xx/5xx):
    • code: string
    • message: string
    • traceId: string
    • example:

Compatibility

  • 向后兼容说明:
  • 废弃策略:

Test Checklist

  • 正常路径
  • 参数校验失败
  • 鉴权/权限
  • 超时/重试/幂等

openspec使用记录

  1. openspec init
  2. /opsx:explore 先梳理需求
  3. /opsx:propose 创建规格和任务
  4. 人工检查 proposal/design/tasks/spec
  5. /opsx:apply 开始编码
  6. openspec validate 校验
  7. /opsx:archive 归档

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询