codeforge-dev 1.5.7 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/.env +2 -1
- package/.devcontainer/CHANGELOG.md +55 -9
- package/.devcontainer/CLAUDE.md +65 -15
- package/.devcontainer/README.md +67 -6
- package/.devcontainer/config/keybindings.json +5 -0
- package/.devcontainer/config/main-system-prompt.md +63 -2
- package/.devcontainer/config/settings.json +25 -6
- package/.devcontainer/devcontainer.json +23 -7
- package/.devcontainer/features/README.md +21 -7
- package/.devcontainer/features/ccburn/README.md +60 -0
- package/.devcontainer/features/ccburn/devcontainer-feature.json +38 -0
- package/.devcontainer/features/ccburn/install.sh +174 -0
- package/.devcontainer/features/ccstatusline/README.md +22 -21
- package/.devcontainer/features/ccstatusline/devcontainer-feature.json +1 -1
- package/.devcontainer/features/ccstatusline/install.sh +48 -16
- package/.devcontainer/features/claude-code/config/settings.json +60 -24
- package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +1 -1
- package/.devcontainer/features/mcp-reasoner/devcontainer-feature.json +1 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/__pycache__/format-on-stop.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-on-stop.py +21 -6
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/__pycache__/lint-file.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/lint-file.py +7 -10
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/REVIEW-RUBRIC.md +440 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/architect.md +190 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/bash-exec.md +173 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/claude-guide.md +155 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/dependency-analyst.md +248 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/doc-writer.md +233 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/explorer.md +235 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/generalist.md +125 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/git-archaeologist.md +242 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/migrator.md +195 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/perf-profiler.md +265 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/refactorer.md +209 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/researcher.md +195 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/security-auditor.md +289 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/spec-writer.md +284 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/statusline-config.md +188 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/test-writer.md +245 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/hooks/hooks.json +12 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/guard-readonly-bash.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/redirect-builtin-agents.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/skill-suggester.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/syntax-validator.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/verify-no-regression.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/verify-tests-pass.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/guard-readonly-bash.py +611 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/redirect-builtin-agents.py +83 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/skill-suggester.py +85 -2
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/syntax-validator.py +9 -4
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/verify-no-regression.py +221 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/verify-tests-pass.py +176 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/claude-agent-sdk/SKILL.md +599 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/claude-agent-sdk/references/sdk-typescript-reference.md +954 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/SKILL.md +276 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/references/advanced-commands.md +332 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/references/investigation-playbooks.md +319 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/SKILL.md +341 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/references/interpreting-results.md +235 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/references/tool-commands.md +395 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/SKILL.md +344 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/references/safe-transformations.md +247 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/references/smell-catalog.md +332 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/SKILL.md +277 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/references/owasp-patterns.md +269 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/references/secrets-patterns.md +253 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/SKILL.md +288 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/references/criteria-patterns.md +245 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/references/ears-templates.md +239 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/__pycache__/guard-protected.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/guard-protected.py +40 -39
- package/.devcontainer/scripts/setup-aliases.sh +10 -20
- package/.devcontainer/scripts/setup-config.sh +2 -0
- package/.devcontainer/scripts/setup-plugins.sh +38 -46
- package/.devcontainer/scripts/setup-projects.sh +175 -0
- package/.devcontainer/scripts/setup-symlink-claude.sh +36 -0
- package/.devcontainer/scripts/setup-update-claude.sh +11 -8
- package/.devcontainer/scripts/setup.sh +4 -2
- package/package.json +1 -1
- package/.devcontainer/scripts/setup-irie-claude.sh +0 -32
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specification-writing
|
|
3
|
+
description: >-
|
|
4
|
+
This skill should be used when the user asks to "write a specification",
|
|
5
|
+
"create requirements", "define acceptance criteria", "write user stories",
|
|
6
|
+
"create a feature spec", "document requirements", "use EARS format",
|
|
7
|
+
"write Given/When/Then scenarios", "define edge cases for a feature",
|
|
8
|
+
"structure a product requirement document",
|
|
9
|
+
or discusses requirement formats, EARS templates, Gherkin syntax,
|
|
10
|
+
acceptance criteria patterns, specification structure,
|
|
11
|
+
or completeness checklists for feature definitions.
|
|
12
|
+
version: 0.1.0
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Specification Writing
|
|
16
|
+
|
|
17
|
+
## Mental Model
|
|
18
|
+
|
|
19
|
+
Specifications are **contracts between humans** -- between the person requesting a feature and the person building it. The goal is to eliminate ambiguity so that both parties agree on what "done" means before work begins.
|
|
20
|
+
|
|
21
|
+
A specification is not prose. It's a structured document with testable claims. Every requirement should be verifiable: can you write a test (automated or manual) that proves the requirement is met? If you can't test it, it's not a requirement -- it's a wish.
|
|
22
|
+
|
|
23
|
+
The most common source of project failure is not bad code but bad specifications. Specifically:
|
|
24
|
+
- **Missing edge cases** -- "What happens when the list is empty?"
|
|
25
|
+
- **Ambiguous language** -- "The system should respond quickly" (how quickly?)
|
|
26
|
+
- **Implicit assumptions** -- "Users will authenticate" (how? OAuth? Password? SSO?)
|
|
27
|
+
- **Missing error cases** -- "The system saves the file" (what if the disk is full?)
|
|
28
|
+
|
|
29
|
+
Write specifications with a hostile reader in mind -- someone who will interpret every ambiguity in the worst possible way. If a requirement can be misunderstood, it will be.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## EARS Requirement Formats
|
|
34
|
+
|
|
35
|
+
EARS (Easy Approach to Requirements Syntax) provides five templates that eliminate the most common ambiguities in natural-language requirements. Each template has a specific trigger pattern.
|
|
36
|
+
|
|
37
|
+
### Ubiquitous
|
|
38
|
+
|
|
39
|
+
Requirements that are always active, with no trigger condition:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
The <system> shall <action>.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Example:** The API shall return responses in JSON format.
|
|
46
|
+
|
|
47
|
+
### Event-Driven
|
|
48
|
+
|
|
49
|
+
Requirements triggered by a specific event:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
When <event>, the <system> shall <action>.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Example:** When a user submits a login form with invalid credentials, the system shall display an error message and increment the failed login counter.
|
|
56
|
+
|
|
57
|
+
### State-Driven
|
|
58
|
+
|
|
59
|
+
Requirements that apply while the system is in a specific state:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
While <state>, the <system> shall <action>.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Example:** While the system is in maintenance mode, the API shall return HTTP 503 for all non-health-check endpoints.
|
|
66
|
+
|
|
67
|
+
### Unwanted Behavior
|
|
68
|
+
|
|
69
|
+
Requirements for handling error conditions and edge cases:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
If <condition>, then the <system> shall <action>.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Example:** If the database connection pool is exhausted, then the system shall queue incoming requests for up to 30 seconds before returning HTTP 503.
|
|
76
|
+
|
|
77
|
+
### Optional Feature
|
|
78
|
+
|
|
79
|
+
Requirements that depend on a configurable feature:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Where <feature is enabled>, the <system> shall <action>.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Example:** Where two-factor authentication is enabled, the system shall require a TOTP code after successful password verification.
|
|
86
|
+
|
|
87
|
+
> **Deep dive:** See `references/ears-templates.md` for EARS format templates with filled examples for each pattern type.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Acceptance Criteria Patterns
|
|
92
|
+
|
|
93
|
+
Acceptance criteria define when a requirement is satisfied. Use these patterns to write criteria that are directly testable.
|
|
94
|
+
|
|
95
|
+
### Given/When/Then (Gherkin)
|
|
96
|
+
|
|
97
|
+
The most structured pattern. Each scenario is a test case:
|
|
98
|
+
|
|
99
|
+
```gherkin
|
|
100
|
+
Feature: User Login
|
|
101
|
+
|
|
102
|
+
Scenario: Successful login with valid credentials
|
|
103
|
+
Given a registered user with email "alice@example.com"
|
|
104
|
+
And the user has a verified account
|
|
105
|
+
When the user submits the login form with correct credentials
|
|
106
|
+
Then the system returns a 200 response with an auth token
|
|
107
|
+
And the auth token expires in 24 hours
|
|
108
|
+
|
|
109
|
+
Scenario: Failed login with invalid password
|
|
110
|
+
Given a registered user with email "alice@example.com"
|
|
111
|
+
When the user submits the login form with an incorrect password
|
|
112
|
+
Then the system returns a 401 response
|
|
113
|
+
And the failed login attempt is logged
|
|
114
|
+
And the response does not reveal whether the email exists
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**When to use:** Complex workflows with multiple actors, preconditions, or state transitions. Best for user-facing features.
|
|
118
|
+
|
|
119
|
+
### Checklist
|
|
120
|
+
|
|
121
|
+
A flat list of verifiable statements. Simpler than Gherkin but less precise:
|
|
122
|
+
|
|
123
|
+
```markdown
|
|
124
|
+
## Acceptance Criteria: Password Reset
|
|
125
|
+
|
|
126
|
+
- [ ] User receives reset email within 60 seconds of request
|
|
127
|
+
- [ ] Reset link expires after 1 hour
|
|
128
|
+
- [ ] Reset link is single-use (invalidated after first use)
|
|
129
|
+
- [ ] Password must meet strength requirements (min 12 chars, 1 uppercase, 1 number)
|
|
130
|
+
- [ ] All existing sessions are invalidated after password change
|
|
131
|
+
- [ ] User receives confirmation email after successful reset
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**When to use:** Simpler features where the preconditions are obvious and each criterion is independent.
|
|
135
|
+
|
|
136
|
+
### Table-Driven
|
|
137
|
+
|
|
138
|
+
For requirements with multiple input/output combinations:
|
|
139
|
+
|
|
140
|
+
```markdown
|
|
141
|
+
## Discount Rules
|
|
142
|
+
|
|
143
|
+
| Customer Type | Order Total | Discount | Notes |
|
|
144
|
+
|---------------|-------------|----------|-------|
|
|
145
|
+
| Standard | < $50 | 0% | |
|
|
146
|
+
| Standard | >= $50 | 5% | |
|
|
147
|
+
| Premium | < $50 | 5% | Minimum premium discount |
|
|
148
|
+
| Premium | >= $50 | 10% | |
|
|
149
|
+
| Premium | >= $200 | 15% | Max discount cap |
|
|
150
|
+
| Employee | any | 25% | Requires valid employee ID |
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**When to use:** Business rules with multiple conditions and outcomes. The table format makes gaps and overlaps visible.
|
|
154
|
+
|
|
155
|
+
> **Deep dive:** See `references/criteria-patterns.md` for acceptance criteria examples across different domains.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Specification Structure
|
|
160
|
+
|
|
161
|
+
A complete specification follows this structure. Not every section is needed for every feature -- scale the document to the complexity.
|
|
162
|
+
|
|
163
|
+
### 1. Problem Statement
|
|
164
|
+
What problem does this feature solve? Who has this problem? What's the cost of not solving it? (2-3 sentences)
|
|
165
|
+
|
|
166
|
+
### 2. Scope
|
|
167
|
+
What's in scope and what's explicitly out of scope? Out-of-scope items prevent scope creep.
|
|
168
|
+
|
|
169
|
+
```markdown
|
|
170
|
+
## Scope
|
|
171
|
+
|
|
172
|
+
**In scope:**
|
|
173
|
+
- User-initiated password reset via email
|
|
174
|
+
- Password strength validation
|
|
175
|
+
- Session invalidation on reset
|
|
176
|
+
|
|
177
|
+
**Out of scope:**
|
|
178
|
+
- Admin-initiated password reset (separate spec)
|
|
179
|
+
- Password expiration policies
|
|
180
|
+
- Account recovery without email access
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 3. User Stories
|
|
184
|
+
Who are the actors and what do they want to achieve?
|
|
185
|
+
|
|
186
|
+
```markdown
|
|
187
|
+
As a [registered user], I want to [reset my password via email]
|
|
188
|
+
so that [I can regain access to my account when I forget my password].
|
|
189
|
+
|
|
190
|
+
As a [security admin], I want to [see password reset audit logs]
|
|
191
|
+
so that [I can detect suspicious reset patterns].
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 4. Functional Requirements
|
|
195
|
+
Use EARS format. Number each requirement for traceability:
|
|
196
|
+
|
|
197
|
+
```markdown
|
|
198
|
+
- FR-1: When a user requests a password reset, the system shall send a reset email
|
|
199
|
+
to the registered email address within 60 seconds.
|
|
200
|
+
- FR-2: The reset link shall contain a cryptographically random token (min 32 bytes).
|
|
201
|
+
- FR-3: If the reset token is expired or already used, then the system shall display
|
|
202
|
+
an error message and offer to send a new reset email.
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### 5. Non-Functional Requirements
|
|
206
|
+
Performance, security, scalability, accessibility:
|
|
207
|
+
|
|
208
|
+
```markdown
|
|
209
|
+
- NFR-1: The password reset endpoint shall respond within 200ms (p95).
|
|
210
|
+
- NFR-2: Reset tokens shall be stored as bcrypt hashes, not plaintext.
|
|
211
|
+
- NFR-3: The reset flow shall be accessible with screen readers (WCAG 2.1 AA).
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 6. Edge Cases
|
|
215
|
+
The cases nobody thinks about until they happen:
|
|
216
|
+
|
|
217
|
+
```markdown
|
|
218
|
+
- What if the user requests multiple resets before using any link?
|
|
219
|
+
→ Only the most recent token is valid; previous tokens are invalidated.
|
|
220
|
+
- What if the email is associated with multiple accounts?
|
|
221
|
+
→ Send separate reset links for each account.
|
|
222
|
+
- What if the user's email provider is down?
|
|
223
|
+
→ The system logs the failure and retries up to 3 times over 5 minutes.
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### 7. Out of Scope
|
|
227
|
+
Explicit non-goals to prevent scope creep (can reference the Scope section or expand here).
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Completeness Checklist
|
|
232
|
+
|
|
233
|
+
Before marking a specification as ready for implementation, verify:
|
|
234
|
+
|
|
235
|
+
**Happy path:**
|
|
236
|
+
- [ ] Primary use case described with acceptance criteria
|
|
237
|
+
- [ ] All actors identified (user, admin, system, external service)
|
|
238
|
+
- [ ] Success response/outcome defined
|
|
239
|
+
|
|
240
|
+
**Error cases:**
|
|
241
|
+
- [ ] Invalid input handled (empty, too long, wrong type, malicious)
|
|
242
|
+
- [ ] External service failures handled (timeout, 500, unavailable)
|
|
243
|
+
- [ ] Concurrent access conflicts addressed
|
|
244
|
+
- [ ] Rate limiting defined for public-facing endpoints
|
|
245
|
+
|
|
246
|
+
**Boundary conditions:**
|
|
247
|
+
- [ ] Empty collections (zero items)
|
|
248
|
+
- [ ] Maximum limits defined (max file size, max items, max length)
|
|
249
|
+
- [ ] Pagination for unbounded lists
|
|
250
|
+
- [ ] Time zones and date boundaries
|
|
251
|
+
|
|
252
|
+
**Performance:**
|
|
253
|
+
- [ ] Response time targets (p50, p95, p99)
|
|
254
|
+
- [ ] Throughput requirements (requests per second)
|
|
255
|
+
- [ ] Data volume expectations (rows, storage size)
|
|
256
|
+
|
|
257
|
+
**Security:**
|
|
258
|
+
- [ ] Authentication required? Which methods?
|
|
259
|
+
- [ ] Authorization rules per role
|
|
260
|
+
- [ ] Data sensitivity classification
|
|
261
|
+
- [ ] Audit logging requirements
|
|
262
|
+
|
|
263
|
+
**Accessibility:**
|
|
264
|
+
- [ ] WCAG compliance level specified
|
|
265
|
+
- [ ] Keyboard navigation requirements
|
|
266
|
+
- [ ] Screen reader compatibility
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Ambiguity Policy
|
|
271
|
+
|
|
272
|
+
These defaults apply when the user does not specify a preference. State the assumption when making a choice:
|
|
273
|
+
|
|
274
|
+
- **Format:** Default to EARS format for requirements and Given/When/Then for acceptance criteria. Use checklists for simple features with obvious preconditions.
|
|
275
|
+
- **Detail level:** Default to enough detail that a developer unfamiliar with the codebase could implement the feature without asking clarifying questions.
|
|
276
|
+
- **Non-functional requirements:** Always include response time targets (default: 200ms p95 for API endpoints, 3s for page loads) and note when these are assumptions.
|
|
277
|
+
- **Edge cases:** Always include at least: empty input, maximum input, concurrent access, and external service failure.
|
|
278
|
+
- **Out of scope:** Always include an out-of-scope section, even if brief, to establish boundaries.
|
|
279
|
+
- **Numbering:** Number all requirements (FR-1, NFR-1) for traceability in code reviews and tests.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Reference Files
|
|
284
|
+
|
|
285
|
+
| File | Contents |
|
|
286
|
+
|------|----------|
|
|
287
|
+
| `references/ears-templates.md` | EARS format templates with filled examples for each pattern type, including compound requirements and requirement hierarchies |
|
|
288
|
+
| `references/criteria-patterns.md` | Acceptance criteria examples organized by domain: authentication, payments, file upload, search, notifications, and data import |
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# Acceptance Criteria Patterns by Domain
|
|
2
|
+
|
|
3
|
+
Examples of acceptance criteria organized by common feature domains.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- [Authentication](#authentication)
|
|
8
|
+
- [Payments](#payments)
|
|
9
|
+
- [File Upload](#file-upload)
|
|
10
|
+
- [Search](#search)
|
|
11
|
+
- [Notifications](#notifications)
|
|
12
|
+
- [Data Import](#data-import)
|
|
13
|
+
- [Cross-Domain Edge Cases](#cross-domain-edge-cases)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Authentication
|
|
18
|
+
|
|
19
|
+
### Login Flow
|
|
20
|
+
|
|
21
|
+
```gherkin
|
|
22
|
+
Feature: User Login
|
|
23
|
+
|
|
24
|
+
Scenario: Successful login with email and password
|
|
25
|
+
Given a verified user with email "alice@example.com"
|
|
26
|
+
When the user submits the login form with correct credentials
|
|
27
|
+
Then the system returns a 200 response with an auth token
|
|
28
|
+
And the token expires in 24 hours
|
|
29
|
+
And a "login_success" event is logged with the user ID
|
|
30
|
+
|
|
31
|
+
Scenario: Login with unverified email
|
|
32
|
+
Given a user with email "bob@example.com" who has not verified their email
|
|
33
|
+
When the user submits the login form with correct credentials
|
|
34
|
+
Then the system returns a 403 response
|
|
35
|
+
And the response body contains "Please verify your email address"
|
|
36
|
+
And a new verification email is sent
|
|
37
|
+
|
|
38
|
+
Scenario: Login with invalid credentials
|
|
39
|
+
Given no user exists with email "unknown@example.com"
|
|
40
|
+
When the user submits the login form with email "unknown@example.com"
|
|
41
|
+
Then the system returns a 401 response
|
|
42
|
+
And the response body contains "Invalid email or password"
|
|
43
|
+
And the response time is similar to a valid-email failure (timing-safe)
|
|
44
|
+
|
|
45
|
+
Scenario: Account lockout after repeated failures
|
|
46
|
+
Given a user with email "alice@example.com"
|
|
47
|
+
When the user submits 5 incorrect passwords within 10 minutes
|
|
48
|
+
Then the account is locked for 15 minutes
|
|
49
|
+
And subsequent login attempts return "Account temporarily locked"
|
|
50
|
+
And a security alert email is sent to the user
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Password Reset
|
|
54
|
+
|
|
55
|
+
**Checklist format:**
|
|
56
|
+
|
|
57
|
+
- [ ] Reset email sent within 60 seconds of request
|
|
58
|
+
- [ ] Reset token is a cryptographically random 32-byte value
|
|
59
|
+
- [ ] Token expires after 1 hour
|
|
60
|
+
- [ ] Token is single-use (invalidated after first use)
|
|
61
|
+
- [ ] Using an expired or used token shows "This link has expired" with option to request a new one
|
|
62
|
+
- [ ] New password must meet strength requirements
|
|
63
|
+
- [ ] All existing sessions invalidated after successful reset
|
|
64
|
+
- [ ] Reset request for non-existent email returns success (no enumeration)
|
|
65
|
+
- [ ] Rate limited to 3 reset requests per email per hour
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Payments
|
|
70
|
+
|
|
71
|
+
### Checkout Flow
|
|
72
|
+
|
|
73
|
+
```gherkin
|
|
74
|
+
Feature: Order Checkout
|
|
75
|
+
|
|
76
|
+
Scenario: Successful payment
|
|
77
|
+
Given a cart with items totaling $49.99
|
|
78
|
+
And the user has a valid payment method on file
|
|
79
|
+
When the user confirms the checkout
|
|
80
|
+
Then the payment is authorized for $49.99
|
|
81
|
+
And the order status changes to "confirmed"
|
|
82
|
+
And a confirmation email is sent with the order details
|
|
83
|
+
And inventory is decremented for each item
|
|
84
|
+
|
|
85
|
+
Scenario: Payment declined
|
|
86
|
+
Given a cart with items totaling $49.99
|
|
87
|
+
When the payment gateway returns "card_declined"
|
|
88
|
+
Then the order status remains "pending"
|
|
89
|
+
And the user sees "Your card was declined. Please try another payment method."
|
|
90
|
+
And inventory is NOT decremented
|
|
91
|
+
And no confirmation email is sent
|
|
92
|
+
|
|
93
|
+
Scenario: Payment gateway timeout
|
|
94
|
+
Given a cart with items totaling $49.99
|
|
95
|
+
When the payment gateway does not respond within 10 seconds
|
|
96
|
+
Then the system retries once after 3 seconds
|
|
97
|
+
And if the retry also fails, shows "Payment processing is delayed"
|
|
98
|
+
And the order enters "payment_pending" status
|
|
99
|
+
And a background job checks payment status every 60 seconds for 30 minutes
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Discount Rules
|
|
103
|
+
|
|
104
|
+
**Table-driven format:**
|
|
105
|
+
|
|
106
|
+
| Customer Type | Order Total | Coupon | Expected Discount | Final Price |
|
|
107
|
+
|---------------|-------------|--------|-------------------|-------------|
|
|
108
|
+
| Standard | $30.00 | None | 0% | $30.00 |
|
|
109
|
+
| Standard | $30.00 | SAVE10 | 10% | $27.00 |
|
|
110
|
+
| Premium | $30.00 | None | 5% | $28.50 |
|
|
111
|
+
| Premium | $30.00 | SAVE10 | 10% (higher wins) | $27.00 |
|
|
112
|
+
| Premium | $100.00 | SAVE10 | 15% (premium tier) | $85.00 |
|
|
113
|
+
| Any | $0.00 | SAVE10 | 0% | $0.00 |
|
|
114
|
+
| Standard | $30.00 | EXPIRED| 0% + error shown | $30.00 |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## File Upload
|
|
119
|
+
|
|
120
|
+
### Image Upload
|
|
121
|
+
|
|
122
|
+
```gherkin
|
|
123
|
+
Feature: Profile Image Upload
|
|
124
|
+
|
|
125
|
+
Scenario: Successful image upload
|
|
126
|
+
Given the user is on the profile settings page
|
|
127
|
+
When the user uploads a valid JPEG image under 5MB
|
|
128
|
+
Then the image is resized to 256x256 pixels
|
|
129
|
+
And the image is stored in the CDN
|
|
130
|
+
And the user's profile displays the new image within 5 seconds
|
|
131
|
+
|
|
132
|
+
Scenario: File too large
|
|
133
|
+
When the user uploads an image larger than 5MB
|
|
134
|
+
Then the upload is rejected before the file is fully transferred
|
|
135
|
+
And the error message reads "Image must be under 5MB. Your file is [X]MB."
|
|
136
|
+
|
|
137
|
+
Scenario: Invalid file type
|
|
138
|
+
When the user uploads a .exe file renamed to .jpg
|
|
139
|
+
Then the system validates the file's MIME type (not just extension)
|
|
140
|
+
And rejects the upload with "Supported formats: JPEG, PNG, WebP"
|
|
141
|
+
|
|
142
|
+
Scenario: Concurrent uploads
|
|
143
|
+
When the user uploads two images simultaneously
|
|
144
|
+
Then only the last uploaded image is saved as the profile picture
|
|
145
|
+
And both uploads complete without errors
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Search
|
|
151
|
+
|
|
152
|
+
### Full-Text Search
|
|
153
|
+
|
|
154
|
+
**Checklist format:**
|
|
155
|
+
|
|
156
|
+
- [ ] Empty search query returns validation error, not all results
|
|
157
|
+
- [ ] Search results appear within 500ms for queries across 1M documents
|
|
158
|
+
- [ ] Results are ranked by relevance (BM25 or equivalent)
|
|
159
|
+
- [ ] Search highlights matching terms in results with `<mark>` tags
|
|
160
|
+
- [ ] Queries with no results show "No results found" with spelling suggestions
|
|
161
|
+
- [ ] Special characters in queries are escaped (no injection)
|
|
162
|
+
- [ ] Results are paginated with 20 items per page
|
|
163
|
+
- [ ] Search query is preserved in the URL for shareability
|
|
164
|
+
- [ ] Minimum query length: 2 characters
|
|
165
|
+
- [ ] Maximum query length: 200 characters
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Notifications
|
|
170
|
+
|
|
171
|
+
### Email Notifications
|
|
172
|
+
|
|
173
|
+
```gherkin
|
|
174
|
+
Feature: Notification Preferences
|
|
175
|
+
|
|
176
|
+
Scenario: User opts out of marketing emails
|
|
177
|
+
Given a user subscribed to all notification types
|
|
178
|
+
When the user unchecks "Marketing updates" in notification preferences
|
|
179
|
+
Then marketing emails stop within 24 hours
|
|
180
|
+
And transactional emails (receipts, password resets) continue normally
|
|
181
|
+
And the preference change is logged for compliance
|
|
182
|
+
|
|
183
|
+
Scenario: Notification delivery failure
|
|
184
|
+
Given a notification is queued for delivery
|
|
185
|
+
When the email provider returns a 5xx error
|
|
186
|
+
Then the system retries after 1 minute, 5 minutes, and 30 minutes
|
|
187
|
+
And after 3 failures, marks the notification as "failed"
|
|
188
|
+
And does NOT send further retries for this notification
|
|
189
|
+
And the failure is recorded in the admin dashboard
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Data Import
|
|
195
|
+
|
|
196
|
+
### CSV Import
|
|
197
|
+
|
|
198
|
+
```gherkin
|
|
199
|
+
Feature: User Data Import
|
|
200
|
+
|
|
201
|
+
Scenario: Valid CSV import
|
|
202
|
+
Given an admin uploads a CSV with 500 valid user records
|
|
203
|
+
When the import is processed
|
|
204
|
+
Then all 500 users are created with correct field mapping
|
|
205
|
+
And the admin sees a summary: "500 created, 0 skipped, 0 errors"
|
|
206
|
+
And each user receives a welcome email
|
|
207
|
+
|
|
208
|
+
Scenario: CSV with validation errors
|
|
209
|
+
Given a CSV where row 3 has an invalid email and row 7 has a duplicate email
|
|
210
|
+
When the import is processed
|
|
211
|
+
Then valid rows (498) are imported successfully
|
|
212
|
+
And invalid rows are skipped with error details:
|
|
213
|
+
| Row | Field | Error |
|
|
214
|
+
| 3 | email | "not.valid" is not a valid email format |
|
|
215
|
+
| 7 | email | "alice@example.com" already exists |
|
|
216
|
+
And the admin can download an error report CSV
|
|
217
|
+
|
|
218
|
+
Scenario: Large file import
|
|
219
|
+
Given a CSV with 100,000 records
|
|
220
|
+
When the import is initiated
|
|
221
|
+
Then the import runs asynchronously (not blocking the UI)
|
|
222
|
+
And the admin sees a progress indicator
|
|
223
|
+
And the import completes within 5 minutes
|
|
224
|
+
And the system sends an email when import finishes
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Cross-Domain Edge Cases
|
|
230
|
+
|
|
231
|
+
These edge cases apply to most features and should be checked:
|
|
232
|
+
|
|
233
|
+
```markdown
|
|
234
|
+
## Universal Edge Cases
|
|
235
|
+
|
|
236
|
+
- [ ] Empty input: What happens when required fields are blank?
|
|
237
|
+
- [ ] Maximum length: What happens at the field's max length? At max + 1?
|
|
238
|
+
- [ ] Unicode: Does the feature handle emoji, CJK characters, RTL text?
|
|
239
|
+
- [ ] Concurrent access: What if two users edit the same resource simultaneously?
|
|
240
|
+
- [ ] Network interruption: What if connectivity drops mid-operation?
|
|
241
|
+
- [ ] Timezone: Do date-dependent features work correctly across timezones?
|
|
242
|
+
- [ ] Pagination boundary: What happens when viewing the last page as items are deleted?
|
|
243
|
+
- [ ] Authorization: Can the feature be accessed without authentication? With wrong role?
|
|
244
|
+
- [ ] Idempotency: What happens if the same request is sent twice?
|
|
245
|
+
```
|