requirements-engineering by jasonkneen/kiro
npx skills add https://github.com/jasonkneen/kiro --skill requirements-engineering在深入探讨如何构建之前,掌握捕获需要构建内容的艺术。本技能教授使用 EARS(简易需求语法方法)格式来创建清晰、可测试的需求。
在以下情况下使用需求工程:
EARS 为编写具体、可测试且明确的需求提供了一致的模式。
事件-响应(最常见):
WHEN [触发事件] THEN [系统] SHALL [所需响应]
条件行为:
IF [满足前提条件] THEN [系统] SHALL [所需响应]
复杂条件:
WHEN [事件] AND [附加条件] THEN [系统] SHALL [响应]
可选条件:
WHEN [事件] OR [替代事件] THEN [系统] SHALL [响应]
基于状态:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
WHEN [系统处于特定状态] THEN [系统] SHALL [行为]
性能:
WHEN [用户操作] THEN [系统] SHALL [在 X 秒/毫秒内响应]
安全:
IF [身份验证条件] THEN [系统] SHALL [安全响应]
格式:作为 [角色],我想要 [功能],以便 [收益]
关注点:
示例:
As a returning customer, I want to save my payment methods, so that I can checkout faster in the future.
为每个用户故事,使用 EARS 定义具体的验收标准:
支付方式示例:
**User Story:** As a returning customer, I want to save my payment methods, so that I can checkout faster.
**Acceptance Criteria:**
1. WHEN user adds a valid credit card THEN system SHALL securely store card details
2. WHEN user adds a card with invalid number THEN system SHALL display validation error
3. WHEN user has saved cards THEN system SHALL display list during checkout
4. WHEN user selects saved card THEN system SHALL pre-fill payment form
5. WHEN user deletes saved card THEN system SHALL remove card from list
6. IF user is not authenticated THEN system SHALL redirect to login before saving card
7. WHEN user adds card THEN system SHALL mask all but last 4 digits in display
针对每个需求,询问:
边界情况模式:
**Error Handling:**
- WHEN [operation fails] THEN system SHALL [display error / retry / log]
**Boundary Conditions:**
- WHEN [value equals minimum/maximum] THEN system SHALL [specific behavior]
**Concurrent Access:**
- WHEN [multiple users access same resource] THEN system SHALL [conflict resolution]
**Empty States:**
- WHEN [collection is empty] THEN system SHALL [display empty state message]
使用此检查清单:
完整性:
清晰性:
一致性:
可测试性:
差: "系统应该快速" 好: "WHEN user submits search THEN system SHALL return results within 2 seconds"
差: "系统应使用 Redis 进行缓存" 好: "WHEN user requests frequently accessed data THEN system SHALL return cached results"
差: 仅记录正常路径 好: 为所有错误条件包含 WHEN/IF 语句
差: "系统应该用户友好" 好: "WHEN new user completes onboarding THEN system SHALL require no more than 3 clicks to reach main dashboard"
差: 相互矛盾的需求 好: 一起审查所有需求,明确解决冲突
**User Story:** As a user, I want to upload files, so that I can share documents with my team.
**Acceptance Criteria:**
1. WHEN user selects file under 10MB THEN system SHALL accept file for upload
2. WHEN user selects file over 10MB THEN system SHALL display "file too large (max 10MB)" error
3. WHEN user selects unsupported file type THEN system SHALL display "unsupported format" error with list of allowed types
4. WHEN upload is in progress THEN system SHALL display progress indicator with percentage
5. WHEN upload completes successfully THEN system SHALL display success message with file link
6. WHEN upload fails due to network error THEN system SHALL display retry option
7. IF user is not authenticated THEN system SHALL redirect to login before upload
8. WHEN user uploads file with same name as existing file THEN system SHALL prompt for rename or replace
**Supported File Types:** PDF, DOC, DOCX, XLS, XLSX, PNG, JPG, GIF
**Maximum File Size:** 10MB
**Maximum Files Per Upload:** 5
**User Story:** As a customer, I want to search products, so that I can find items quickly.
**Acceptance Criteria:**
1. WHEN user enters search term THEN system SHALL display matching products
2. WHEN search returns results THEN system SHALL show result count
3. WHEN search returns no results THEN system SHALL display "no products found" with suggestions
4. WHEN user searches with special characters THEN system SHALL sanitize input and search
5. WHEN user submits empty search THEN system SHALL display validation message
6. WHEN results exceed 20 items THEN system SHALL paginate with 20 items per page
7. WHEN user searches THEN system SHALL return results within 2 seconds
8. WHEN user types in search box THEN system SHALL show autocomplete suggestions after 3 characters
**Search Fields:** Product name, description, category, SKU
**Minimum Search Length:** 2 characters
# Requirements Document: [Feature Name]
## Overview
[Brief description of the feature and its purpose]
## User Roles
- [Role 1]: [Description of this user type]
- [Role 2]: [Description of this user type]
## Requirements
### Requirement 1: [Name]
**User Story:** As a [role], I want [feature], so that [benefit]
**Acceptance Criteria:**
1. WHEN [event] THEN system SHALL [response]
2. IF [condition] THEN system SHALL [response]
3. WHEN [event] AND [condition] THEN system SHALL [response]
**Edge Cases:**
- [Edge case 1 and how it's handled]
- [Edge case 2 and how it's handled]
### Requirement 2: [Name]
[Continue pattern...]
## Non-Functional Requirements
- **Performance:** [Specific metrics]
- **Security:** [Security requirements]
- **Accessibility:** [Accessibility standards]
## Out of Scope
- [Items explicitly not included in this feature]
## Open Questions
- [Questions that need stakeholder input]
完成需求后:
每周安装次数
111
代码仓库
GitHub 星标数
591
首次出现
Jan 23, 2026
安全审计
安装于
gemini-cli97
opencode97
codex92
github-copilot86
cursor84
claude-code72
Master the art of capturing what needs to be built before diving into how to build it. This skill teaches the EARS (Easy Approach to Requirements Syntax) format for creating clear, testable requirements.
Use requirements engineering when:
EARS provides consistent patterns for writing requirements that are specific, testable, and unambiguous.
Event-Response (Most Common):
WHEN [triggering event] THEN [system] SHALL [required response]
Conditional Behavior:
IF [precondition is met] THEN [system] SHALL [required response]
Complex Conditions:
WHEN [event] AND [additional condition] THEN [system] SHALL [response]
Optional Conditions:
WHEN [event] OR [alternative event] THEN [system] SHALL [response]
State-Based:
WHEN [system is in specific state] THEN [system] SHALL [behavior]
Performance:
WHEN [user action] THEN [system] SHALL [respond within X seconds/milliseconds]
Security:
IF [authentication condition] THEN [system] SHALL [security response]
Format: As a [role], I want [feature], so that [benefit]
Focus on:
Example:
As a returning customer, I want to save my payment methods, so that I can checkout faster in the future.
For each user story, define specific acceptance criteria using EARS:
Example for payment methods:
**User Story:** As a returning customer, I want to save my payment methods, so that I can checkout faster.
**Acceptance Criteria:**
1. WHEN user adds a valid credit card THEN system SHALL securely store card details
2. WHEN user adds a card with invalid number THEN system SHALL display validation error
3. WHEN user has saved cards THEN system SHALL display list during checkout
4. WHEN user selects saved card THEN system SHALL pre-fill payment form
5. WHEN user deletes saved card THEN system SHALL remove card from list
6. IF user is not authenticated THEN system SHALL redirect to login before saving card
7. WHEN user adds card THEN system SHALL mask all but last 4 digits in display
For each requirement, ask:
Edge case patterns:
**Error Handling:**
- WHEN [operation fails] THEN system SHALL [display error / retry / log]
**Boundary Conditions:**
- WHEN [value equals minimum/maximum] THEN system SHALL [specific behavior]
**Concurrent Access:**
- WHEN [multiple users access same resource] THEN system SHALL [conflict resolution]
**Empty States:**
- WHEN [collection is empty] THEN system SHALL [display empty state message]
Use this checklist:
Completeness:
Clarity:
Consistency:
Testability:
Bad: "System should be fast" Good: "WHEN user submits search THEN system SHALL return results within 2 seconds"
Bad: "System shall use Redis for caching" Good: "WHEN user requests frequently accessed data THEN system SHALL return cached results"
Bad: Only documenting happy path Good: Include WHEN/IF statements for all error conditions
Bad: "System should be user-friendly" Good: "WHEN new user completes onboarding THEN system SHALL require no more than 3 clicks to reach main dashboard"
Bad: Requirements that contradict each other Good: Review all requirements together, resolve conflicts explicitly
**User Story:** As a user, I want to upload files, so that I can share documents with my team.
**Acceptance Criteria:**
1. WHEN user selects file under 10MB THEN system SHALL accept file for upload
2. WHEN user selects file over 10MB THEN system SHALL display "file too large (max 10MB)" error
3. WHEN user selects unsupported file type THEN system SHALL display "unsupported format" error with list of allowed types
4. WHEN upload is in progress THEN system SHALL display progress indicator with percentage
5. WHEN upload completes successfully THEN system SHALL display success message with file link
6. WHEN upload fails due to network error THEN system SHALL display retry option
7. IF user is not authenticated THEN system SHALL redirect to login before upload
8. WHEN user uploads file with same name as existing file THEN system SHALL prompt for rename or replace
**Supported File Types:** PDF, DOC, DOCX, XLS, XLSX, PNG, JPG, GIF
**Maximum File Size:** 10MB
**Maximum Files Per Upload:** 5
**User Story:** As a customer, I want to search products, so that I can find items quickly.
**Acceptance Criteria:**
1. WHEN user enters search term THEN system SHALL display matching products
2. WHEN search returns results THEN system SHALL show result count
3. WHEN search returns no results THEN system SHALL display "no products found" with suggestions
4. WHEN user searches with special characters THEN system SHALL sanitize input and search
5. WHEN user submits empty search THEN system SHALL display validation message
6. WHEN results exceed 20 items THEN system SHALL paginate with 20 items per page
7. WHEN user searches THEN system SHALL return results within 2 seconds
8. WHEN user types in search box THEN system SHALL show autocomplete suggestions after 3 characters
**Search Fields:** Product name, description, category, SKU
**Minimum Search Length:** 2 characters
# Requirements Document: [Feature Name]
## Overview
[Brief description of the feature and its purpose]
## User Roles
- [Role 1]: [Description of this user type]
- [Role 2]: [Description of this user type]
## Requirements
### Requirement 1: [Name]
**User Story:** As a [role], I want [feature], so that [benefit]
**Acceptance Criteria:**
1. WHEN [event] THEN system SHALL [response]
2. IF [condition] THEN system SHALL [response]
3. WHEN [event] AND [condition] THEN system SHALL [response]
**Edge Cases:**
- [Edge case 1 and how it's handled]
- [Edge case 2 and how it's handled]
### Requirement 2: [Name]
[Continue pattern...]
## Non-Functional Requirements
- **Performance:** [Specific metrics]
- **Security:** [Security requirements]
- **Accessibility:** [Accessibility standards]
## Out of Scope
- [Items explicitly not included in this feature]
## Open Questions
- [Questions that need stakeholder input]
After completing requirements:
Weekly Installs
111
Repository
GitHub Stars
591
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli97
opencode97
codex92
github-copilot86
cursor84
claude-code72
站立会议模板:敏捷开发每日站会指南与工具(含远程团队异步模板)
10,500 周安装