kiro-spec-engine 1.3.0 → 1.4.1

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +228 -367
  3. package/README.zh.md +0 -330
  4. package/docs/README.md +223 -0
  5. package/docs/command-reference.md +252 -0
  6. package/docs/examples/add-export-command/design.md +194 -0
  7. package/docs/examples/add-export-command/requirements.md +110 -0
  8. package/docs/examples/add-export-command/tasks.md +88 -0
  9. package/docs/examples/add-rest-api/design.md +855 -0
  10. package/docs/examples/add-rest-api/requirements.md +323 -0
  11. package/docs/examples/add-rest-api/tasks.md +355 -0
  12. package/docs/examples/add-user-dashboard/design.md +192 -0
  13. package/docs/examples/add-user-dashboard/requirements.md +143 -0
  14. package/docs/examples/add-user-dashboard/tasks.md +91 -0
  15. package/docs/faq.md +696 -0
  16. package/docs/integration-modes.md +529 -0
  17. package/docs/integration-philosophy.md +313 -0
  18. package/docs/quick-start-with-ai-tools.md +374 -0
  19. package/docs/quick-start.md +711 -0
  20. package/docs/spec-workflow.md +453 -0
  21. package/docs/tools/claude-guide.md +653 -0
  22. package/docs/tools/cursor-guide.md +705 -0
  23. package/docs/tools/generic-guide.md +445 -0
  24. package/docs/tools/kiro-guide.md +308 -0
  25. package/docs/tools/vscode-guide.md +444 -0
  26. package/docs/tools/windsurf-guide.md +390 -0
  27. package/docs/troubleshooting.md +795 -0
  28. package/docs/zh/README.md +275 -0
  29. package/docs/zh/quick-start.md +711 -0
  30. package/docs/zh/tools/claude-guide.md +348 -0
  31. package/docs/zh/tools/cursor-guide.md +280 -0
  32. package/docs/zh/tools/generic-guide.md +498 -0
  33. package/docs/zh/tools/kiro-guide.md +342 -0
  34. package/docs/zh/tools/vscode-guide.md +448 -0
  35. package/docs/zh/tools/windsurf-guide.md +377 -0
  36. package/package.json +1 -1
@@ -0,0 +1,323 @@
1
+ # RESTful API with Authentication - Requirements
2
+
3
+ > Example Spec demonstrating API feature development
4
+
5
+ ---
6
+
7
+ **Version**: 1.0.0
8
+ **Last Updated**: 2026-01-23
9
+ **Spec Type**: Example - API Feature
10
+
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ This Spec demonstrates how to structure requirements for a RESTful API feature. We'll build a simple task management API with JWT authentication, covering common API patterns like CRUD operations, authentication, authorization, and error handling.
16
+
17
+ **Learning Points:**
18
+ - API endpoint design
19
+ - Authentication and authorization
20
+ - Request/response formats
21
+ - Error handling
22
+ - API versioning
23
+
24
+ ---
25
+
26
+ ## User Stories
27
+
28
+ ### US-1: User Registration
29
+ **As a** new user
30
+ **I want to** register an account with email and password
31
+ **So that** I can access the task management system
32
+
33
+ **Acceptance Criteria:**
34
+ - WHEN I POST to `/api/v1/auth/register` with valid email and password THEN I receive a success response with user ID
35
+ - WHEN I register with an existing email THEN I receive a 409 Conflict error
36
+ - WHEN I register with invalid email format THEN I receive a 400 Bad Request error
37
+ - WHEN I register with password < 8 characters THEN I receive a 400 Bad Request error
38
+
39
+ ---
40
+
41
+ ### US-2: User Login
42
+ **As a** registered user
43
+ **I want to** log in with my credentials
44
+ **So that** I can access my tasks
45
+
46
+ **Acceptance Criteria:**
47
+ - WHEN I POST to `/api/v1/auth/login` with valid credentials THEN I receive a JWT token
48
+ - WHEN I login with invalid credentials THEN I receive a 401 Unauthorized error
49
+ - WHEN I login successfully THEN the token expires after 24 hours
50
+ - WHEN I use an expired token THEN I receive a 401 Unauthorized error
51
+
52
+ ---
53
+
54
+ ### US-3: Create Task
55
+ **As an** authenticated user
56
+ **I want to** create a new task
57
+ **So that** I can track my work
58
+
59
+ **Acceptance Criteria:**
60
+ - WHEN I POST to `/api/v1/tasks` with valid token and task data THEN I receive the created task with ID
61
+ - WHEN I create a task without authentication THEN I receive a 401 Unauthorized error
62
+ - WHEN I create a task with missing required fields THEN I receive a 400 Bad Request error
63
+ - WHEN I create a task successfully THEN it's associated with my user ID
64
+
65
+ ---
66
+
67
+ ### US-4: List Tasks
68
+ **As an** authenticated user
69
+ **I want to** view all my tasks
70
+ **So that** I can see what I need to do
71
+
72
+ **Acceptance Criteria:**
73
+ - WHEN I GET `/api/v1/tasks` with valid token THEN I receive a list of my tasks
74
+ - WHEN I list tasks without authentication THEN I receive a 401 Unauthorized error
75
+ - WHEN I have no tasks THEN I receive an empty array
76
+ - WHEN I have multiple tasks THEN they are sorted by creation date (newest first)
77
+
78
+ ---
79
+
80
+ ### US-5: Update Task
81
+ **As an** authenticated user
82
+ **I want to** update a task's details
83
+ **So that** I can modify task information
84
+
85
+ **Acceptance Criteria:**
86
+ - WHEN I PUT `/api/v1/tasks/:id` with valid token and data THEN the task is updated
87
+ - WHEN I update another user's task THEN I receive a 403 Forbidden error
88
+ - WHEN I update a non-existent task THEN I receive a 404 Not Found error
89
+ - WHEN I update with invalid data THEN I receive a 400 Bad Request error
90
+
91
+ ---
92
+
93
+ ### US-6: Delete Task
94
+ **As an** authenticated user
95
+ **I want to** delete a task
96
+ **So that** I can remove completed or unwanted tasks
97
+
98
+ **Acceptance Criteria:**
99
+ - WHEN I DELETE `/api/v1/tasks/:id` with valid token THEN the task is deleted
100
+ - WHEN I delete another user's task THEN I receive a 403 Forbidden error
101
+ - WHEN I delete a non-existent task THEN I receive a 404 Not Found error
102
+ - WHEN I delete successfully THEN I receive a 204 No Content response
103
+
104
+ ---
105
+
106
+ ## Functional Requirements
107
+
108
+ ### FR-1: Authentication System
109
+ The system must provide JWT-based authentication for API access.
110
+
111
+ **Details:**
112
+ - Support user registration with email and password
113
+ - Support user login with credentials
114
+ - Generate JWT tokens with 24-hour expiration
115
+ - Validate JWT tokens on protected endpoints
116
+ - Hash passwords using bcrypt (10 rounds)
117
+
118
+ ---
119
+
120
+ ### FR-2: Task CRUD Operations
121
+ The system must provide complete CRUD operations for tasks.
122
+
123
+ **Details:**
124
+ - Create: POST `/api/v1/tasks`
125
+ - Read (list): GET `/api/v1/tasks`
126
+ - Read (single): GET `/api/v1/tasks/:id`
127
+ - Update: PUT `/api/v1/tasks/:id`
128
+ - Delete: DELETE `/api/v1/tasks/:id`
129
+
130
+ ---
131
+
132
+ ### FR-3: Authorization
133
+ The system must enforce user-level authorization for task operations.
134
+
135
+ **Details:**
136
+ - Users can only access their own tasks
137
+ - Users cannot view, update, or delete other users' tasks
138
+ - Return 403 Forbidden for unauthorized access attempts
139
+
140
+ ---
141
+
142
+ ### FR-4: Input Validation
143
+ The system must validate all input data before processing.
144
+
145
+ **Details:**
146
+ - Email: Valid email format, max 255 characters
147
+ - Password: Minimum 8 characters, max 128 characters
148
+ - Task title: Required, max 200 characters
149
+ - Task description: Optional, max 2000 characters
150
+ - Task status: Enum (pending, in_progress, completed)
151
+
152
+ ---
153
+
154
+ ### FR-5: Error Handling
155
+ The system must provide consistent error responses.
156
+
157
+ **Details:**
158
+ - Use standard HTTP status codes
159
+ - Return JSON error responses with message and error code
160
+ - Include validation errors with field-specific messages
161
+ - Log errors for debugging
162
+
163
+ ---
164
+
165
+ ### FR-6: API Versioning
166
+ The system must support API versioning for future compatibility.
167
+
168
+ **Details:**
169
+ - All endpoints prefixed with `/api/v1/`
170
+ - Version included in URL path
171
+ - Support for future versions without breaking existing clients
172
+
173
+ ---
174
+
175
+ ## Non-Functional Requirements
176
+
177
+ ### NFR-1: Performance
178
+ - API response time < 200ms for 95% of requests
179
+ - Support 100 concurrent users
180
+ - Database queries optimized with indexes
181
+
182
+ ### NFR-2: Security
183
+ - Passwords hashed with bcrypt
184
+ - JWT tokens signed with secret key
185
+ - HTTPS required in production
186
+ - Rate limiting: 100 requests per minute per IP
187
+ - Input sanitization to prevent injection attacks
188
+
189
+ ### NFR-3: Reliability
190
+ - 99.9% uptime
191
+ - Graceful error handling (no crashes)
192
+ - Database transactions for data consistency
193
+
194
+ ### NFR-4: Maintainability
195
+ - RESTful API design principles
196
+ - Consistent naming conventions
197
+ - Comprehensive API documentation
198
+ - Unit test coverage > 80%
199
+
200
+ ### NFR-5: Scalability
201
+ - Stateless API design (horizontal scaling)
202
+ - Database connection pooling
203
+ - Caching for frequently accessed data
204
+
205
+ ---
206
+
207
+ ## API Endpoints Summary
208
+
209
+ | Method | Endpoint | Auth Required | Description |
210
+ |--------|----------|---------------|-------------|
211
+ | POST | `/api/v1/auth/register` | No | Register new user |
212
+ | POST | `/api/v1/auth/login` | No | Login user |
213
+ | POST | `/api/v1/tasks` | Yes | Create task |
214
+ | GET | `/api/v1/tasks` | Yes | List all user's tasks |
215
+ | GET | `/api/v1/tasks/:id` | Yes | Get single task |
216
+ | PUT | `/api/v1/tasks/:id` | Yes | Update task |
217
+ | DELETE | `/api/v1/tasks/:id` | Yes | Delete task |
218
+
219
+ ---
220
+
221
+ ## Data Models
222
+
223
+ ### User
224
+ ```json
225
+ {
226
+ "id": "uuid",
227
+ "email": "string (unique)",
228
+ "password": "string (hashed)",
229
+ "createdAt": "timestamp",
230
+ "updatedAt": "timestamp"
231
+ }
232
+ ```
233
+
234
+ ### Task
235
+ ```json
236
+ {
237
+ "id": "uuid",
238
+ "userId": "uuid (foreign key)",
239
+ "title": "string",
240
+ "description": "string (optional)",
241
+ "status": "enum (pending, in_progress, completed)",
242
+ "createdAt": "timestamp",
243
+ "updatedAt": "timestamp"
244
+ }
245
+ ```
246
+
247
+ ---
248
+
249
+ ## Error Response Format
250
+
251
+ ```json
252
+ {
253
+ "error": {
254
+ "code": "ERROR_CODE",
255
+ "message": "Human-readable error message",
256
+ "details": {
257
+ "field": "Specific field error (for validation)"
258
+ }
259
+ }
260
+ }
261
+ ```
262
+
263
+ **Error Codes:**
264
+ - `INVALID_INPUT` - Validation error
265
+ - `UNAUTHORIZED` - Authentication required
266
+ - `FORBIDDEN` - Insufficient permissions
267
+ - `NOT_FOUND` - Resource not found
268
+ - `CONFLICT` - Resource already exists
269
+ - `INTERNAL_ERROR` - Server error
270
+
271
+ ---
272
+
273
+ ## Out of Scope
274
+
275
+ The following are explicitly out of scope for this Spec:
276
+
277
+ - ❌ Password reset functionality
278
+ - ❌ Email verification
279
+ - ❌ OAuth/social login
280
+ - ❌ Task sharing between users
281
+ - ❌ Task categories or tags
282
+ - ❌ File attachments
283
+ - ❌ Real-time notifications
284
+ - ❌ Admin panel
285
+
286
+ ---
287
+
288
+ ## Dependencies
289
+
290
+ - **Node.js** 14+ - Runtime environment
291
+ - **Express.js** 4.x - Web framework
292
+ - **PostgreSQL** 13+ - Database
293
+ - **jsonwebtoken** - JWT implementation
294
+ - **bcrypt** - Password hashing
295
+ - **express-validator** - Input validation
296
+
297
+ ---
298
+
299
+ ## Success Criteria
300
+
301
+ This feature is considered complete when:
302
+
303
+ 1. ✅ All 7 API endpoints are implemented and working
304
+ 2. ✅ All acceptance criteria pass
305
+ 3. ✅ Unit test coverage > 80%
306
+ 4. ✅ Integration tests cover all endpoints
307
+ 5. ✅ API documentation is complete
308
+ 6. ✅ Security requirements are met
309
+ 7. ✅ Performance requirements are met
310
+
311
+ ---
312
+
313
+ ## Related Documentation
314
+
315
+ - [Design Document](design.md) - Technical design and architecture
316
+ - [Tasks Document](tasks.md) - Implementation plan
317
+ - [API Documentation Guide](../../spec-workflow.md) - How to document APIs
318
+
319
+ ---
320
+
321
+ **Version**: 1.0.0
322
+ **Last Updated**: 2026-01-23
323
+ **Status**: Example Spec
@@ -0,0 +1,355 @@
1
+ # RESTful API with Authentication - Tasks
2
+
3
+ > Implementation plan for the task management API
4
+
5
+ ---
6
+
7
+ **Version**: 1.0.0
8
+ **Last Updated**: 2026-01-23
9
+ **Spec Type**: Example - API Feature
10
+
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ This tasks document breaks down the implementation into logical phases. Each task is specific enough for an AI assistant to implement while maintaining flexibility for different approaches.
16
+
17
+ **Estimated Total Time:** 12-16 hours
18
+ **Complexity:** Medium
19
+ **Prerequisites:** Node.js 14+, PostgreSQL 13+
20
+
21
+ ---
22
+
23
+ ## Phase 1: Project Setup
24
+
25
+ **Estimated Time:** 1-2 hours
26
+
27
+ - [ ] 1.1 Initialize Node.js project
28
+ - Create package.json with npm init
29
+ - Set up project structure (src/, tests/, config/)
30
+ - Create .gitignore file
31
+ - Create .env.example file
32
+
33
+ - [ ] 1.2 Install dependencies
34
+ - Install express, pg, jsonwebtoken, bcrypt, express-validator, dotenv, uuid
35
+ - Install dev dependencies: jest, supertest, nodemon
36
+ - Configure package.json scripts (start, dev, test)
37
+
38
+ - [ ] 1.3 Set up database
39
+ - Create PostgreSQL database
40
+ - Create users table with schema from design.md
41
+ - Create tasks table with schema from design.md
42
+ - Create indexes for performance
43
+
44
+ - [ ] 1.4 Configure environment
45
+ - Create .env file with database credentials
46
+ - Create config/database.js for database connection
47
+ - Create config/jwt.js for JWT configuration
48
+ - Test database connection
49
+
50
+ ---
51
+
52
+ ## Phase 2: Core Infrastructure
53
+
54
+ **Estimated Time:** 2-3 hours
55
+
56
+ - [ ] 2.1 Create error handling system
57
+ - Implement custom error classes (AppError, ValidationError, etc.)
58
+ - Create error handler middleware
59
+ - Add error logging utility
60
+ - Test error handling
61
+
62
+ - [ ] 2.2 Create Express app structure
63
+ - Create src/app.js with Express setup
64
+ - Configure middleware (json parser, cors, etc.)
65
+ - Set up route mounting
66
+ - Add error handler middleware
67
+
68
+ - [ ] 2.3 Create database connection pool
69
+ - Implement connection pool in config/database.js
70
+ - Add connection health check
71
+ - Handle connection errors gracefully
72
+ - Test connection pool
73
+
74
+ - [ ] 2.4 Create validation utilities
75
+ - Set up express-validator
76
+ - Create reusable validation middleware
77
+ - Test validation error formatting
78
+
79
+ ---
80
+
81
+ ## Phase 3: Authentication System
82
+
83
+ **Estimated Time:** 3-4 hours
84
+
85
+ - [ ] 3.1 Implement UserRepository
86
+ - Create src/repositories/user.repository.js
87
+ - Implement create() method
88
+ - Implement findByEmail() method
89
+ - Implement findById() method
90
+ - Write unit tests for repository
91
+
92
+ - [ ] 3.2 Implement AuthService
93
+ - Create src/services/auth.service.js
94
+ - Implement register() method with password hashing
95
+ - Implement login() method with password verification
96
+ - Implement generateToken() method
97
+ - Write unit tests for service
98
+
99
+ - [ ] 3.3 Implement AuthController
100
+ - Create src/controllers/auth.controller.js
101
+ - Implement register() endpoint handler
102
+ - Implement login() endpoint handler
103
+ - Handle validation errors
104
+ - Write unit tests for controller
105
+
106
+ - [ ] 3.4 Create authentication middleware
107
+ - Create src/middleware/auth.middleware.js
108
+ - Implement JWT token verification
109
+ - Extract user from token and attach to request
110
+ - Handle authentication errors
111
+ - Write unit tests for middleware
112
+
113
+ - [ ] 3.5 Create auth validators
114
+ - Create src/validators/auth.validator.js
115
+ - Implement registration validation rules
116
+ - Implement login validation rules
117
+ - Test validation rules
118
+
119
+ - [ ] 3.6 Create auth routes
120
+ - Create src/routes/auth.routes.js
121
+ - Define POST /api/v1/auth/register route
122
+ - Define POST /api/v1/auth/login route
123
+ - Mount routes in app.js
124
+ - Write integration tests for auth endpoints
125
+
126
+ ---
127
+
128
+ ## Phase 4: Task Management System
129
+
130
+ **Estimated Time:** 3-4 hours
131
+
132
+ - [ ] 4.1 Implement TaskRepository
133
+ - Create src/repositories/task.repository.js
134
+ - Implement create() method
135
+ - Implement findByUserId() method
136
+ - Implement findById() method
137
+ - Implement update() method
138
+ - Implement delete() method
139
+ - Write unit tests for repository
140
+
141
+ - [ ] 4.2 Implement TaskService
142
+ - Create src/services/task.service.js
143
+ - Implement create() method
144
+ - Implement findByUserId() method with sorting
145
+ - Implement findById() method
146
+ - Implement update() method
147
+ - Implement delete() method
148
+ - Write unit tests for service
149
+
150
+ - [ ] 4.3 Implement TaskController
151
+ - Create src/controllers/task.controller.js
152
+ - Implement create() endpoint handler
153
+ - Implement list() endpoint handler
154
+ - Implement getById() endpoint handler with ownership check
155
+ - Implement update() endpoint handler with ownership check
156
+ - Implement delete() endpoint handler with ownership check
157
+ - Write unit tests for controller
158
+
159
+ - [ ] 4.4 Create task validators
160
+ - Create src/validators/task.validator.js
161
+ - Implement task creation validation rules
162
+ - Implement task update validation rules
163
+ - Test validation rules
164
+
165
+ - [ ] 4.5 Create task routes
166
+ - Create src/routes/task.routes.js
167
+ - Apply authentication middleware to all routes
168
+ - Define POST /api/v1/tasks route
169
+ - Define GET /api/v1/tasks route
170
+ - Define GET /api/v1/tasks/:id route
171
+ - Define PUT /api/v1/tasks/:id route
172
+ - Define DELETE /api/v1/tasks/:id route
173
+ - Mount routes in app.js
174
+ - Write integration tests for task endpoints
175
+
176
+ ---
177
+
178
+ ## Phase 5: Security & Performance
179
+
180
+ **Estimated Time:** 2-3 hours
181
+
182
+ - [ ] 5.1 Implement rate limiting
183
+ - Create src/middleware/rate-limit.middleware.js
184
+ - Configure rate limiting (100 requests per minute)
185
+ - Apply to all routes
186
+ - Test rate limiting
187
+
188
+ - [ ] 5.2 Add input sanitization
189
+ - Add sanitization to validators
190
+ - Prevent SQL injection
191
+ - Prevent XSS attacks
192
+ - Test sanitization
193
+
194
+ - [ ] 5.3 Optimize database queries
195
+ - Add database indexes (already in schema)
196
+ - Implement connection pooling (already done)
197
+ - Add query logging for debugging
198
+ - Test query performance
199
+
200
+ - [ ] 5.4 Add security headers
201
+ - Install helmet middleware
202
+ - Configure security headers
203
+ - Test security headers
204
+
205
+ ---
206
+
207
+ ## Phase 6: Testing & Documentation
208
+
209
+ **Estimated Time:** 2-3 hours
210
+
211
+ - [ ] 6.1 Write comprehensive unit tests
212
+ - Test all repository methods
213
+ - Test all service methods
214
+ - Test all controller methods
215
+ - Test all middleware
216
+ - Achieve > 80% code coverage
217
+
218
+ - [ ] 6.2 Write integration tests
219
+ - Test complete registration flow
220
+ - Test complete login flow
221
+ - Test complete task CRUD flow
222
+ - Test authentication failures
223
+ - Test authorization failures
224
+ - Test validation errors
225
+
226
+ - [ ] 6.3 Create API documentation
227
+ - Document all endpoints with examples
228
+ - Document request/response formats
229
+ - Document error responses
230
+ - Document authentication flow
231
+ - Create Postman collection or OpenAPI spec
232
+
233
+ - [ ] 6.4 Add code comments
234
+ - Add JSDoc comments to all functions
235
+ - Document complex logic
236
+ - Add usage examples in comments
237
+
238
+ ---
239
+
240
+ ## Phase 7: Deployment Preparation
241
+
242
+ **Estimated Time:** 1-2 hours
243
+
244
+ - [ ] 7.1 Create production configuration
245
+ - Create production .env template
246
+ - Configure production database settings
247
+ - Set up HTTPS requirements
248
+ - Configure logging for production
249
+
250
+ - [ ] 7.2 Add health check endpoint
251
+ - Create GET /api/v1/health endpoint
252
+ - Check database connection
253
+ - Return system status
254
+ - Test health check
255
+
256
+ - [ ] 7.3 Create deployment scripts
257
+ - Create database migration scripts
258
+ - Create seed data scripts (optional)
259
+ - Create deployment documentation
260
+ - Test deployment process
261
+
262
+ - [ ] 7.4 Final testing
263
+ - Run all unit tests
264
+ - Run all integration tests
265
+ - Test with production-like data
266
+ - Verify all acceptance criteria
267
+
268
+ ---
269
+
270
+ ## Verification Checklist
271
+
272
+ Before marking this Spec as complete, verify:
273
+
274
+ ### Functionality
275
+ - [ ] All 7 API endpoints work correctly
276
+ - [ ] Authentication works (register, login, token verification)
277
+ - [ ] Authorization works (users can only access their own tasks)
278
+ - [ ] Input validation works for all endpoints
279
+ - [ ] Error handling works for all error cases
280
+
281
+ ### Testing
282
+ - [ ] Unit test coverage > 80%
283
+ - [ ] All integration tests pass
284
+ - [ ] All acceptance criteria from requirements.md pass
285
+ - [ ] Manual testing completed
286
+
287
+ ### Security
288
+ - [ ] Passwords are hashed with bcrypt
289
+ - [ ] JWT tokens are properly signed and verified
290
+ - [ ] Rate limiting is active
291
+ - [ ] Input sanitization prevents injection attacks
292
+ - [ ] Security headers are configured
293
+
294
+ ### Performance
295
+ - [ ] API response time < 200ms for 95% of requests
296
+ - [ ] Database queries are optimized with indexes
297
+ - [ ] Connection pooling is configured
298
+
299
+ ### Documentation
300
+ - [ ] API documentation is complete
301
+ - [ ] Code has JSDoc comments
302
+ - [ ] README has setup instructions
303
+ - [ ] Environment variables are documented
304
+
305
+ ---
306
+
307
+ ## Notes for AI Implementation
308
+
309
+ **When implementing this Spec:**
310
+
311
+ 1. **Follow the phase order** - Each phase builds on the previous one
312
+ 2. **Test as you go** - Write tests for each component before moving on
313
+ 3. **Use the design document** - Refer to design.md for exact method signatures and logic
314
+ 4. **Handle errors properly** - Use the custom error classes from design.md
315
+ 5. **Validate all inputs** - Use express-validator as specified
316
+ 6. **Check ownership** - Always verify users can only access their own tasks
317
+ 7. **Keep it simple** - Don't add features not in requirements.md
318
+
319
+ **Common pitfalls to avoid:**
320
+
321
+ - ❌ Don't skip error handling
322
+ - ❌ Don't forget to hash passwords
323
+ - ❌ Don't skip input validation
324
+ - ❌ Don't forget ownership checks on task operations
325
+ - ❌ Don't hardcode configuration values
326
+ - ❌ Don't skip tests
327
+
328
+ **Example AI prompt:**
329
+
330
+ ```
331
+ I'm implementing a RESTful API with authentication. Please implement Phase 3, Task 3.2: AuthService.
332
+
333
+ Requirements:
334
+ - See requirements.md for user stories and acceptance criteria
335
+ - See design.md for exact method signatures and logic
336
+ - Use bcrypt for password hashing (10 rounds)
337
+ - Use jsonwebtoken for token generation (24-hour expiration)
338
+ - Throw appropriate custom errors (UnauthorizedError, ConflictError)
339
+
340
+ Please implement the complete AuthService class with all methods and error handling.
341
+ ```
342
+
343
+ ---
344
+
345
+ ## Related Documentation
346
+
347
+ - [Requirements Document](requirements.md) - Feature requirements and acceptance criteria
348
+ - [Design Document](design.md) - Technical design and architecture
349
+ - [Spec Workflow Guide](../../spec-workflow.md) - Understanding Specs
350
+
351
+ ---
352
+
353
+ **Version**: 1.0.0
354
+ **Last Updated**: 2026-01-23
355
+ **Status**: Example Spec