Feature Specification (Meta-Skill)
Bridge persona documentation and development. This skill translates user needs, pain points, and journeys identified in persona docs into structured, implementable feature specifications with clear acceptance criteria.
Installation
OpenClaw / Moltbot / Clawbot
CODEBLOCK0
Purpose
Persona docs define who and why. Feature specs define what and how well. This skill closes the gap:
- - Extracts actionable features from persona pain points and journeys
- Structures requirements so developers know exactly what to build
- Defines acceptance criteria so QA knows exactly what to verify
- Prevents scope ambiguity before a single line of code is written
When to Use
- - After persona docs exist (
docs/PERSONA.md or docs/personas/) - Before development begins on a new feature or product
- When a feature request lacks clear acceptance criteria
- When stakeholders disagree on what "done" means
- When converting user feedback into development work
Feature Spec Template
Use this structure for every feature specification. Place specs in docs/specs/ or docs/features/.
CODEBLOCK1
Writing Effective User Stories
User stories connect persona needs to developer tasks. Apply the INVEST criteria:
| Criterion | Meaning | Test Question |
|---|
| Independent | No ordering dependency on others | Can this be built and released alone? |
| Negotiable |
Details can be discussed | Is this a conversation starter, not a contract? |
| Valuable | Delivers value to the persona | Would the persona care about this? |
| Estimable | Team can estimate effort | Is the scope clear enough to size? |
| Small | Fits in a single iteration | Can this ship in one sprint? |
| Testable | Clear pass/fail verification | Can QA write a test for this? |
Good vs Bad User Stories
| Bad | Why It's Bad | Good |
|---|
| "Users can log in" | No persona, no benefit | "As a returning customer, I want to log in with my email, so that I can access my order history" |
| "Make it fast" |
Vague, untestable | "As a mobile user on 3G, I want the product list to load in under 2s, so that I don't abandon the page" |
| "Add admin panel" | Solution-first, no problem | "As a store manager, I want to update product prices without developer help, so that I can respond to market changes daily" |
| "Handle errors" | No specificity | "As a checkout user, I want clear feedback when my payment fails, so that I know whether to retry or use a different card" |
| "Implement caching" | Implementation detail, not a story | "As a repeat visitor, I want previously viewed pages to load instantly, so that browsing feels responsive" |
Acceptance Criteria Patterns
Pattern 1: Happy Path
CODEBLOCK2
Pattern 2: Boundary Conditions
CODEBLOCK3
Pattern 3: Error Cases
CODEBLOCK4
Pattern 4: State Transitions
CODEBLOCK5
Pattern 5: Negative / Security
CODEBLOCK6
Priority Framework
Apply MoSCoW prioritization, anchored to persona impact:
| Priority | Label | Definition | Persona Alignment |
|---|
| P0 | Must | Product is unusable without this | Blocks the persona's primary goal |
| P1 |
Should | Significant value, painful to defer | Addresses a top-3 pain point |
| P2 | Could | Nice to have, enhances experience | Improves a secondary journey |
| P3 | Won't | Explicitly deferred (this release) | Low-frequency need or niche scenario |
Prioritization process:
- 1. List all candidate features
- Map each to a persona pain point or journey step
- Assign MoSCoW based on persona impact, not technical interest
- Validate: Do all P0s together form a usable product for the target persona?
- Cut scope until P0s are achievable in the timeline
Specification Anti-Patterns
| Anti-Pattern | Example | Fix |
|---|
| Vague requirement | "System should be user-friendly" | Define measurable criteria: "Task completion in < 3 clicks" |
| Missing edge cases |
Only specifying the happy path | Add boundary, error, and concurrent-use scenarios |
| No acceptance criteria | "Implement search" | Add Given/When/Then for each scenario |
| Solution masquerading as need | "Use Redis for caching" | State the need: "Repeat queries return in < 50ms" |
| Missing personas | "Users can export data" | Specify which persona and why they export |
| Unbounded scope | "Support all file formats" | List exact formats: "PDF, CSV, XLSX" |
| Implicit assumptions | Assuming auth exists without stating it | List all dependencies explicitly |
Integration with Workflow
Feature specs connect to the broader development process:
- 1. Persona docs (
docs/PERSONA.md) — Source of truth for user needs - Feature specs (
docs/specs/) — This skill's output; the development contract - Task creation — Each spec becomes one or more development tasks
- Implementation — Developers reference the spec for scope and criteria
- Testing — QA derives test cases directly from acceptance criteria
- Review — PR reviews check that acceptance criteria are met
When using with the /new-feature command or similar workflows:
- - Read the relevant persona doc first
- Generate the spec using this template
- Validate acceptance criteria cover happy path, errors, and edge cases
- Confirm priority with stakeholders before development begins
NEVER Do
- 1. NEVER write a spec without referencing a persona — every feature exists for a user
- NEVER skip acceptance criteria — "obvious" requirements cause the most bugs
- NEVER use vague qualifiers as requirements — "fast", "easy", "intuitive" are not testable
- NEVER combine multiple features in one spec — one spec, one feature, one clear scope
- NEVER specify implementation details in user stories — describe the what, not the how
- NEVER mark a spec as Approved without edge cases documented — happy paths are the easy part
- NEVER assume dependencies are obvious — list every system, API, feature, and data source the spec relies on
功能规格说明(元技能)
桥接角色文档与开发工作。此技能将角色文档中识别的用户需求、痛点和用户旅程转化为结构化、可实施的功能规格说明,并附带清晰的验收标准。
安装
OpenClaw / Moltbot / Clawbot
bash
npx clawhub@latest install feature-specification
目的
角色文档定义了谁和为什么。功能规格说明定义了什么和多好。此技能弥合了差距:
- - 从角色痛点和旅程中提取可操作的功能
- 结构化需求,使开发人员确切知道要构建什么
- 定义验收标准,使QA确切知道要验证什么
- 在编写一行代码之前防止范围模糊
使用时机
- - 在角色文档创建之后(docs/PERSONA.md 或 docs/personas/)
- 在开始新功能或产品开发之前
- 当功能请求缺乏明确的验收标准时
- 当利益相关者对完成的定义存在分歧时
- 当将用户反馈转化为开发任务时
功能规格模板
每个功能规格说明使用此结构。将规格说明放置在 docs/specs/ 或 docs/features/ 中。
markdown
功能:[功能名称]
元数据
- - 优先级: [必须 / 应该 / 可以 / 不做]
- 目标角色: [来自角色文档的角色名称]
- 状态: 草稿 | 评审中 | 已批准 | 进行中 | 已完成
- 预估工作量: [T恤尺码:XS / S / M / L / XL]
问题陈述
[直接引用此功能解决的角色痛点。
引用或链接到角色文档的相关部分。]
解决方案描述
[功能做什么以及如何解决问题的
高层描述。2-4句话。不涉及实现细节。]
用户故事
- - 作为[角色],我想要[行动],以便[收益]。
- 作为[角色],我想要[行动],以便[收益]。
验收标准
场景:[快乐路径描述]
- - 给定 [前置条件]
- 当 [行动]
- 那么 [预期结果]
场景:[替代路径描述]
- - 给定 [前置条件]
- 当 [行动]
- 那么 [预期结果]
场景:[错误情况描述]
- - 给定 [前置条件]
- 当 [无效操作]
- 那么 [错误处理结果]
边界情况
- - [ ] [边界情况1 — 描述和预期行为]
- [ ] [边界情况2 — 描述和预期行为]
非功能需求
- - 性能: [响应时间、吞吐量、负载目标]
- 可访问性: [WCAG级别、键盘导航、屏幕阅读器支持]
- 安全性: [认证要求、数据敏感性、输入验证]
- 浏览器/设备: [支持矩阵]
依赖项
- - [此功能依赖的功能或系统]
- [所需的外部API或服务]
范围外
- - [明确列出此功能不包含的内容]
- [防止开发过程中的范围蔓延]
设计参考
- - [链接到原型、线框图或设计系统组件]
- [截图或图表(如有)]
编写有效的用户故事
用户故事将角色需求与开发任务连接起来。应用INVEST标准:
| 标准 | 含义 | 测试问题 |
|---|
| 独立性 | 无排序依赖关系 | 是否可以单独构建和发布? |
| 可协商性 |
细节可以讨论 | 这是对话的起点,而不是合同吗? |
| 有价值性 | 为角色提供价值 | 角色会关心这个吗? |
| 可估算性 | 团队可以估算工作量 | 范围是否足够清晰以进行规模估算? |
| 小型化 | 适合单个迭代 | 能否在一个冲刺中交付? |
| 可测试性 | 明确的通过/失败验证 | QA能否为此编写测试? |
好与坏的用户故事对比
| 坏的 | 为什么坏 | 好的 |
|---|
| 用户可以登录 | 没有角色,没有收益 | 作为回头客,我想用我的邮箱登录,以便访问我的订单历史 |
| 让它快一点 |
模糊,不可测试 | 作为3G网络下的移动用户,我希望产品列表在2秒内加载完成,以便我不会放弃页面 |
| 添加管理面板 | 解决方案优先,没有问题 | 作为商店经理,我想在不需要开发人员帮助的情况下更新产品价格,以便我能每天应对市场变化 |
| 处理错误 | 没有具体性 | 作为结账用户,当我的支付失败时,我希望得到清晰的反馈,以便我知道是重试还是使用不同的卡 |
| 实现缓存 | 实现细节,不是故事 | 作为重复访问者,我希望之前查看过的页面能立即加载,以便浏览体验感觉流畅 |
验收标准模式
模式1:快乐路径
gherkin
给定一个已登录的顾客,其购物车中有商品
当他们点击结账
那么他们被带到支付页面,并显示购物车摘要
模式2:边界条件
gherkin
给定一个购物车中有100件商品(最大允许数量)
当用户尝试添加另一件商品
那么他们看到购物车已达上限 — 请移除一件商品以添加新商品
并且该商品不会被添加到购物车
模式3:错误情况
gherkin
给定一个用户正在提交注册表单
当邮箱字段包含not-an-email
那么表单显示内联验证:请输入有效的邮箱地址
并且表单不会被提交
并且焦点移动到邮箱字段
模式4:状态转换
gherkin
给定一个状态为处理中的订单
当仓库将其标记为已发货
那么订单状态变为已发货
并且客户在5分钟内收到发货确认邮件
并且运单号在订单详情页上可见
模式5:负面/安全
gherkin
给定一个不是账户所有者的用户
当他们尝试通过直接URL访问/account/settings
那么他们收到403禁止访问响应
并且访问尝试被记录
优先级框架
应用MoSCoW优先级排序,锚定角色影响:
| 优先级 | 标签 | 定义 | 角色对齐 |
|---|
| P0 | 必须 | 没有此功能产品无法使用 | 阻碍角色的主要目标 |
| P1 |
应该 | 具有显著价值,推迟会带来痛苦 | 解决前三大痛点之一 |
| P2 | 可以 | 锦上添花,增强体验 | 改善次要旅程 |
| P3 | 不做 | 明确推迟(此版本) | 低频率需求或小众场景 |
优先级排序流程:
- 1. 列出所有候选功能
- 将每个功能映射到角色痛点或旅程步骤
- 基于角色影响(而非技术兴趣)分配MoSCoW
- 验证:所有P0功能组合起来是否能为目标角色形成一个可用的产品?
- 裁剪范围,直到P0功能在时间线内可实现
规格说明反模式
| 反模式 | 示例 | 修复 |
|---|
| 模糊需求 | 系统应易于使用 | 定义可衡量标准:任务在< 3次点击内完成 |
| 缺少边界情况 |
仅指定快乐路径 | 添加边界、错误和并发使用场景 |
| 没有验收标准 | 实现搜索 | 为每个场景添加给定/当/那么 |
| 将解决方案伪装成需求 | 使用Redis进行缓存 | 陈述需求:重复查询在< 50ms内返回 |
| 缺少角色 | 用户可以导出数据 | 指定哪个角色以及为什么导出 |
| 无界范围 | 支持所有文件格式 | 列出确切格式:PDF、CSV、XLSX |
| 隐含假设 | 假设认证存在而不说明 | 明确列出所有依赖项 |
与工作流的集成
功能规格说明连接到更广泛的开发流程:
- 1. 角色文档(docs/PERSONA.md)— 用户需求的真实来源
- 功能规格说明(docs/specs/)— 此技能的输出;开发合同
- 任务创建 — 每个规格说明成为一个或多个开发任务
- 实现 — 开发人员参考规格说明了解范围和标准
- 测试 — QA直接从验收标准推导测试用例
- 评审 — PR评审检查验收标准是否满足
当与/new-feature命令或类似工作流一起使用时:
- - 首先阅读相关角色文档
- 使用此模板生成规格说明
- 验证验收标准涵盖快乐路径、错误和边界情况
- 在开发开始前与利益相关者确认优先级
绝对不要做
- 1. 绝对不要在不引用角色的情况下编写规格