write-spec

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Write Spec

撰写规格文档

If you see unfamiliar placeholders or need to check which tools are connected, see CONNECTORS.md.
Write a feature specification or product requirements document (PRD).
若遇到不熟悉的占位符或需要查看已连接的工具,请参阅CONNECTORS.md
撰写功能规格文档或产品需求文档(PRD)。

Usage

使用方法

/write-spec $ARGUMENTS
/write-spec $ARGUMENTS

Workflow

工作流程

1. Understand the Feature

1. 理解功能需求

Ask the user what they want to spec. Accept any of:
  • A feature name ("SSO support")
  • A problem statement ("Enterprise customers keep asking for centralized auth")
  • A user request ("Users want to export their data as CSV")
  • A vague idea ("We should do something about onboarding drop-off")
询问用户需要撰写规格的内容。接受以下任意输入:
  • 功能名称(如“SSO支持”)
  • 问题陈述(如“企业客户持续要求集中式身份验证”)
  • 用户需求(如“用户希望将数据导出为CSV格式”)
  • 模糊想法(如“我们应该解决新用户留存率低的问题”)

2. Gather Context

2. 收集上下文信息

Ask the user for the following. Be conversational — do not dump all questions at once. Ask the most important ones first and fill in gaps as you go:
  • User problem: What problem does this solve? Who experiences it?
  • Target users: Which user segment(s) does this serve?
  • Success metrics: How will we know this worked?
  • Constraints: Technical constraints, timeline, regulatory requirements, dependencies
  • Prior art: Has this been attempted before? Are there existing solutions?
以对话形式向用户询问以下内容,不要一次性抛出所有问题。优先询问最重要的问题,逐步填补信息空白:
  • 用户问题:该功能解决什么问题?受影响的用户群体是谁?
  • 目标用户:该功能服务于哪些用户细分群体?
  • 成功指标:我们如何判断该功能是否有效?
  • 约束条件:技术限制、时间进度、合规要求、依赖项
  • 已有参考:是否有人尝试过类似功能?是否存在现有解决方案?

3. Pull Context from Connected Tools

3. 从已连接工具中提取上下文信息

If ~~project tracker is connected:
  • Search for related tickets, epics, or features
  • Pull in any existing requirements or acceptance criteria
  • Identify dependencies on other work items
If ~~knowledge base is connected:
  • Search for related research documents, prior specs, or design docs
  • Pull in relevant user research findings
  • Find related meeting notes or decision records
If ~~design is connected:
  • Pull related mockups, wireframes, or design explorations
  • Search for design system components relevant to the feature
If these tools are not connected, work entirely from what the user provides. Do not ask the user to connect tools — just proceed with available information.
若已连接项目跟踪工具
  • 搜索相关工单、史诗或功能
  • 提取已有的需求或验收标准
  • 识别与其他工作项的依赖关系
若已连接知识库工具
  • 搜索相关研究文档、过往规格文档或设计文档
  • 提取相关用户研究结果
  • 查找相关会议记录或决策文档
若已连接设计工具
  • 提取相关原型、线框图或设计方案
  • 搜索与该功能相关的设计系统组件
若未连接上述工具,则完全基于用户提供的信息开展工作。不要要求用户连接工具,直接使用现有信息推进。

4. Generate the PRD

4. 生成PRD

Produce a structured PRD with these sections. See PRD Structure below for detailed guidance on what each section should contain.
  • Problem Statement: The user problem, who is affected, and impact of not solving it (2-3 sentences)
  • Goals: 3-5 specific, measurable outcomes tied to user or business metrics
  • Non-Goals: 3-5 things explicitly out of scope, with brief rationale for each
  • User Stories: Standard format ("As a [user type], I want [capability] so that [benefit]"), grouped by persona
  • Requirements: Categorized as Must-Have (P0), Nice-to-Have (P1), and Future Considerations (P2), each with acceptance criteria
  • Success Metrics: Leading indicators (change quickly) and lagging indicators (change over time), with specific targets
  • Open Questions: Unresolved questions tagged with who needs to answer (engineering, design, legal, data)
  • Timeline Considerations: Hard deadlines, dependencies, and phasing
生成包含以下章节的结构化PRD。具体内容请参阅下文的PRD结构指南:
  • 问题陈述:描述用户问题、受影响群体以及不解决该问题的影响(2-3句话)
  • 目标:3-5个与用户或业务指标相关的具体、可衡量的成果
  • 非目标:3-5个明确排除在范围外的内容,并简要说明理由
  • 用户故事:采用标准格式(“作为[用户类型],我希望[功能],以便[收益]”),按用户角色分组
  • 需求:分为必须具备(P0)、值得具备(P1)和未来考虑(P2)三类,每类均包含验收标准
  • 成功指标:领先指标(快速变化)和滞后指标(随时间变化),并设定具体目标
  • 待解决问题:未解决的问题,并标注负责解答的角色(工程、设计、法务、数据)
  • 时间进度考量:硬性截止日期、依赖项和分阶段规划

5. Review and Iterate

5. 审核与迭代

After generating the PRD:
  • Ask the user if any sections need adjustment
  • Offer to expand on specific sections
  • Offer to create follow-up artifacts (design brief, engineering ticket breakdown, stakeholder pitch)
生成PRD后:
  • 询问用户是否需要调整任何章节
  • 主动提出可针对特定章节进行扩展
  • 主动提出可创建后续产物(设计 brief、工程工单拆解、利益相关方汇报材料)

PRD Structure

PRD结构

Problem Statement

问题陈述

  • Describe the user problem in 2-3 sentences
  • Who experiences this problem and how often
  • What is the cost of not solving it (user pain, business impact, competitive risk)
  • Ground this in evidence: user research, support data, metrics, or customer feedback
  • 用2-3句话描述用户问题
  • 说明受影响的用户群体及问题发生频率
  • 说明不解决该问题的代价(用户痛点、业务影响、竞争风险)
  • 基于证据支撑:用户研究、支持数据、指标或客户反馈

Goals

目标

  • 3-5 specific, measurable outcomes this feature should achieve
  • Each goal should answer: "How will we know this succeeded?"
  • Distinguish between user goals (what users get) and business goals (what the company gets)
  • Goals should be outcomes, not outputs ("reduce time to first value by 50%" not "build onboarding wizard")
  • 3-5个该功能应实现的具体、可衡量的成果
  • 每个目标需回答:“我们如何判断这是否成功?”
  • 区分用户目标(用户获得的价值)和业务目标(公司获得的价值)
  • 目标应聚焦成果而非产出(如“将首次价值获取时间缩短50%”而非“构建新用户引导流程”)

Non-Goals

非目标

  • 3-5 things this feature explicitly will NOT do
  • Adjacent capabilities that are out of scope for this version
  • For each non-goal, briefly explain why it is out of scope (not enough impact, too complex, separate initiative, premature)
  • Non-goals prevent scope creep during implementation and set expectations with stakeholders
  • 3-5个明确排除在该功能范围外的内容
  • 与该功能相关但不属于当前版本范围的能力
  • 每个非目标需简要说明排除理由(影响不足、过于复杂、属于独立项目、时机不成熟)
  • 非目标可防止开发过程中出现范围蔓延,并为利益相关方设定预期

User Stories

用户故事

Write user stories in standard format: "As a [user type], I want [capability] so that [benefit]"
Guidelines:
  • The user type should be specific enough to be meaningful ("enterprise admin" not just "user")
  • The capability should describe what they want to accomplish, not how
  • The benefit should explain the "why" — what value does this deliver
  • Include edge cases: error states, empty states, boundary conditions
  • Include different user types if the feature serves multiple personas
  • Order by priority — most important stories first
Example:
  • "As a team admin, I want to configure SSO for my organization so that my team members can log in with their corporate credentials"
  • "As a team member, I want to be automatically redirected to my company's SSO login so that I do not need to remember a separate password"
  • "As a team admin, I want to see which members have logged in via SSO so that I can verify the rollout is working"
采用标准格式撰写用户故事:“作为[用户类型],我希望[功能],以便[收益]”
撰写指南:
  • 用户类型需足够具体(如“企业管理员”而非仅“用户”)
  • 功能描述应聚焦用户想要达成的目标,而非实现方式
  • 收益需解释“为什么”——该功能能带来什么价值
  • 包含边缘场景:错误状态、空状态、边界条件
  • 若功能服务多个用户角色,需涵盖不同类型的用户
  • 按优先级排序——最重要的故事放在最前面
示例:
  • “作为团队管理员,我希望为我的组织配置SSO,以便团队成员可以使用企业凭据登录”
  • “作为团队成员,我希望自动跳转到公司的SSO登录页面,以便无需记住单独的密码”
  • “作为团队管理员,我希望查看哪些成员已通过SSO登录,以便验证部署是否正常”

Requirements

需求

Must-Have (P0): The feature cannot ship without these. These represent the minimum viable version of the feature. Ask: "If we cut this, does the feature still solve the core problem?" If no, it is P0.
Nice-to-Have (P1): Significantly improves the experience but the core use case works without them. These often become fast follow-ups after launch.
Future Considerations (P2): Explicitly out of scope for v1 but we want to design in a way that supports them later. Documenting these prevents accidental architectural decisions that make them hard later.
For each requirement:
  • Write a clear, unambiguous description of the expected behavior
  • Include acceptance criteria (see below)
  • Note any technical considerations or constraints
  • Flag dependencies on other teams or systems
必须具备(P0):缺少这些内容,功能无法发布。代表功能的最小可行版本。思考:“如果砍掉这部分,功能还能解决核心问题吗?”如果不能,即为P0。
值得具备(P1):能显著提升体验,但核心用例在缺少这些内容时仍可正常运行。这些通常会在发布后快速跟进实现。
未来考虑(P2):明确排除在v1版本范围外,但我们需要在设计时预留支持空间。记录这些内容可避免做出阻碍未来扩展的架构决策。
每个需求需包含:
  • 清晰、明确的预期行为描述
  • 验收标准(见下文)
  • 技术考量或约束条件说明
  • 标记对其他团队或系统的依赖项

Open Questions

待解决问题

  • Questions that need answers before or during implementation
  • Tag each with who should answer (engineering, design, legal, data, stakeholder)
  • Distinguish between blocking questions (must answer before starting) and non-blocking (can resolve during implementation)
  • 实施前或实施过程中需要解答的问题
  • 每个问题需标注负责解答的角色(工程、设计、法务、数据、利益相关方)
  • 区分阻塞性问题(开始前必须解答)和非阻塞性问题(可在实施过程中解决)

Timeline Considerations

时间进度考量

  • Hard deadlines (contractual commitments, events, compliance dates)
  • Dependencies on other teams' work or releases
  • Suggested phasing if the feature is too large for one release
  • 硬性截止日期(合同承诺、活动、合规日期)
  • 对其他团队工作或发布版本的依赖
  • 若功能过大无法在一个版本中完成,建议分阶段规划

User Story Writing

用户故事撰写

Good user stories are:
  • Independent: Can be developed and delivered on their own
  • Negotiable: Details can be discussed, the story is not a contract
  • Valuable: Delivers value to the user (not just the team)
  • Estimable: The team can roughly estimate the effort
  • Small: Can be completed in one sprint/iteration
  • Testable: There is a clear way to verify it works
优质的用户故事具备以下特点:
  • 独立性:可独立开发和交付
  • 可协商性:细节可讨论,故事并非合同
  • 价值性:为用户(而非仅团队)交付价值
  • 可估算性:团队可大致估算工作量
  • 小型化:可在一个迭代/冲刺内完成
  • 可测试性:有明确的验证方式

Common Mistakes in User Stories

用户故事常见错误

  • Too vague: "As a user, I want the product to be faster" — what specifically should be faster?
  • Solution-prescriptive: "As a user, I want a dropdown menu" — describe the need, not the UI widget
  • No benefit: "As a user, I want to click a button" — why? What does it accomplish?
  • Too large: "As a user, I want to manage my team" — break this into specific capabilities
  • Internal focus: "As the engineering team, we want to refactor the database" — this is a task, not a user story
  • 过于模糊:“作为用户,我希望产品更快”——具体哪部分需要更快?
  • 预设解决方案:“作为用户,我希望有一个下拉菜单”——描述需求而非UI组件
  • 无收益说明:“作为用户,我希望点击一个按钮”——为什么?能达成什么目标?
  • 规模过大:“作为用户,我希望管理我的团队”——拆解为具体功能
  • 内部聚焦:“作为工程团队,我希望重构数据库”——这是任务,而非用户故事

Requirements Categorization

需求分类

MoSCoW Framework

MoSCoW框架

  • Must have: Without these, the feature is not viable. Non-negotiable.
  • Should have: Important but not critical for launch. High-priority fast follows.
  • Could have: Desirable if time permits. Will not delay delivery if cut.
  • Won't have (this time): Explicitly out of scope. May revisit in future versions.
  • Must have(必须具备):缺少这些,功能无法落地。无协商空间。
  • Should have(应该具备):重要但非发布必需。高优先级的快速跟进项。
  • Could have(可以具备):若时间允许则实现。即使砍掉也不会延迟交付。
  • Won't have(本次不做):明确排除在范围外。未来版本可能重新考虑。

Tips for Categorization

分类技巧

  • Be ruthless about P0s. The tighter the must-have list, the faster you ship and learn.
  • If everything is P0, nothing is P0. Challenge every must-have: "Would we really not ship without this?"
  • P1s should be things you are confident you will build soon, not a wish list.
  • P2s are architectural insurance — they guide design decisions even though you are not building them now.
  • 对P0需求要严格把控。必须具备的列表越精简,发布和学习的速度越快。
  • 如果所有内容都是P0,那就等于没有P0。对每个必须具备的需求提出质疑:“没有它我们真的不能发布吗?”
  • P1需求应是你确信很快会开发的内容,而非愿望清单。
  • P2需求是架构保险——即使当前不开发,也能指导设计决策。

Success Metrics Definition

成功指标定义

Leading Indicators

领先指标

Metrics that change quickly after launch (days to weeks):
  • Adoption rate: % of eligible users who try the feature
  • Activation rate: % of users who complete the core action
  • Task completion rate: % of users who successfully accomplish their goal
  • Time to complete: How long the core workflow takes
  • Error rate: How often users encounter errors or dead ends
  • Feature usage frequency: How often users return to use the feature
发布后快速变化的指标(数天至数周):
  • 采用率:尝试使用该功能的合格用户占比
  • 激活率:完成核心操作的用户占比
  • 任务完成率:成功达成目标的用户占比
  • 完成时间:核心工作流所需的时间
  • 错误率:用户遇到错误或死胡同的频率
  • 功能使用频率:用户返回使用功能的频率

Lagging Indicators

滞后指标

Metrics that take time to develop (weeks to months):
  • Retention impact: Does this feature improve user retention?
  • Revenue impact: Does this drive upgrades, expansion, or new revenue?
  • NPS / satisfaction change: Does this improve how users feel about the product?
  • Support ticket reduction: Does this reduce support load?
  • Competitive win rate: Does this help win more deals?
需要时间才能显现变化的指标(数周至数月):
  • 留存影响:该功能是否提升用户留存?
  • 收入影响:是否推动升级、扩展或新收入?
  • NPS/满意度变化:是否提升用户对产品的好感?
  • 支持工单减少量:是否降低支持工作量?
  • 竞争胜率:是否有助于赢得更多客户?

Setting Targets

设定目标

  • Targets should be specific: "50% adoption within 30 days" not "high adoption"
  • Base targets on comparable features, industry benchmarks, or explicit hypotheses
  • Set a "success" threshold and a "stretch" target
  • Define the measurement method: what tool, what query, what time window
  • Specify when you will evaluate: 1 week, 1 month, 1 quarter post-launch
  • 目标需具体:“30天内采用率达到50%”而非“高采用率”
  • 基于类似功能、行业基准或明确假设设定目标
  • 设定“成功”阈值和“挑战”目标
  • 定义测量方法:使用什么工具、什么查询、什么时间窗口
  • 指定评估时间:发布后1周、1个月、1季度

Acceptance Criteria

验收标准

Write acceptance criteria in Given/When/Then format or as a checklist:
Given/When/Then:
  • Given [precondition or context]
  • When [action the user takes]
  • Then [expected outcome]
Example:
  • Given the admin has configured SSO for their organization
  • When a team member visits the login page
  • Then they are automatically redirected to the organization's SSO provider
Checklist format:
  • Admin can enter SSO provider URL in organization settings
  • Team members see "Log in with SSO" button on login page
  • SSO login creates a new account if one does not exist
  • SSO login links to existing account if email matches
  • Failed SSO attempts show a clear error message
采用Given/When/Then格式或清单格式撰写验收标准:
Given/When/Then格式
  • Given [前置条件或上下文]
  • When [用户执行的操作]
  • Then [预期结果]
示例:
  • Given 管理员已为其组织配置SSO
  • When 团队成员访问登录页面
  • Then 他们会自动跳转到组织的SSO提供商页面
清单格式
  • 管理员可在组织设置中输入SSO提供商URL
  • 团队成员在登录页面看到“使用SSO登录”按钮
  • 若账号不存在,SSO登录会创建新账号
  • 若邮箱匹配,SSO登录会关联已有账号
  • SSO登录失败时显示清晰的错误信息

Tips for Acceptance Criteria

验收标准撰写技巧

  • Cover the happy path, error cases, and edge cases
  • Be specific about the expected behavior, not the implementation
  • Include what should NOT happen (negative test cases)
  • Each criterion should be independently testable
  • Avoid ambiguous words: "fast", "user-friendly", "intuitive" — define what these mean concretely
  • 覆盖正常路径、错误场景和边缘场景
  • 明确预期行为,而非实现方式
  • 包含不应发生的情况(负面测试用例)
  • 每个标准应可独立测试
  • 避免模糊词汇:“快速”、“用户友好”、“直观”——明确定义这些词汇的具体含义

Scope Management

范围管理

Recognizing Scope Creep

识别范围蔓延

Scope creep happens when:
  • Requirements keep getting added after the spec is approved
  • "Small" additions accumulate into a significantly larger project
  • The team is building features no user asked for ("while we're at it...")
  • The launch date keeps moving without explicit re-scoping
  • Stakeholders add requirements without removing anything
当出现以下情况时,即发生范围蔓延:
  • 规格文档获批后持续添加需求
  • “小”改动累积成规模显著扩大的项目
  • 团队开发用户未要求的功能(“既然我们在做这个...顺便做那个”)
  • 发布日期不断推迟却未明确重新划定范围
  • 利益相关方添加需求却未移除任何现有内容

Preventing Scope Creep

预防范围蔓延

  • Write explicit non-goals in every spec
  • Require that any scope addition comes with a scope removal or timeline extension
  • Separate "v1" from "v2" clearly in the spec
  • Review the spec against the original problem statement — does everything serve it?
  • Time-box investigations: "If we cannot figure out X in 2 days, we cut it"
  • Create a "parking lot" for good ideas that are not in scope
  • 在每个规格文档中明确写出非目标
  • 要求任何范围增加都需伴随范围移除或时间延长
  • 在规格文档中清晰区分“v1”和“v2”
  • 对照原始问题陈述审核规格文档——所有内容是否都服务于该问题?
  • 为调查工作设定时间限制:“若2天内无法解决X问题,就砍掉它”
  • 创建“停车场”记录不在当前范围内的好想法

Output Format

输出格式

Use markdown with clear headers. Keep the document scannable — busy stakeholders should be able to read just the headers and bold text to get the gist.
使用Markdown格式,设置清晰的标题。保持文档易于扫描——忙碌的利益相关方应仅通过标题和粗体文本即可了解核心内容。

Tips

技巧

  • Be opinionated about scope. It is better to have a tight, well-defined spec than an expansive vague one.
  • If the user's idea is too big for one spec, suggest breaking it into phases and spec the first phase.
  • Success metrics should be specific and measurable, not vague ("improve user experience").
  • Non-goals are as important as goals. They prevent scope creep during implementation.
  • Open questions should be genuinely open — do not include questions you can answer from context.
  • 对范围要有明确的立场。一个紧凑、定义清晰的规格文档远胜于一个宽泛模糊的文档。
  • 若用户的想法过大,无法在一个规格文档中涵盖,建议拆分为多个阶段,先撰写第一阶段的规格文档。
  • 成功指标应具体、可衡量,而非模糊表述(如“提升用户体验”)。
  • 非目标与目标同等重要。它们可防止开发过程中出现范围蔓延。
  • 待解决问题应是真正未解决的问题——不要包含可从现有上下文找到答案的问题。