rails_claude_skills 0.1.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.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE/bug_report.yml +134 -0
  3. data/.github/ISSUE_TEMPLATE/config.yml +11 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.yml +129 -0
  5. data/.github/ISSUE_TEMPLATE/question.yml +90 -0
  6. data/.github/dependabot.yml +19 -0
  7. data/.github/workflows/ci.yml +77 -0
  8. data/.github/workflows/release.yml +66 -0
  9. data/.rubocop.yml +52 -0
  10. data/CHANGELOG.md +94 -0
  11. data/CLAUDE.md +332 -0
  12. data/CODE_OF_CONDUCT.md +134 -0
  13. data/CONTRIBUTING.md +580 -0
  14. data/LICENSE.txt +21 -0
  15. data/README.md +544 -0
  16. data/Rakefile +8 -0
  17. data/lib/generators/claude/agent/agent_generator.rb +71 -0
  18. data/lib/generators/claude/agent/templates/agent.md.tt +62 -0
  19. data/lib/generators/claude/command/command_generator.rb +50 -0
  20. data/lib/generators/claude/command/templates/command.md.tt +28 -0
  21. data/lib/generators/claude/commands_library/create-pr.md +27 -0
  22. data/lib/generators/claude/commands_library/dbchange.md +19 -0
  23. data/lib/generators/claude/commands_library/quality.md +20 -0
  24. data/lib/generators/claude/commands_library/stimulus.md +19 -0
  25. data/lib/generators/claude/commands_library/turbo-feature.md +17 -0
  26. data/lib/generators/claude/install/install_generator.rb +211 -0
  27. data/lib/generators/claude/install/templates/README.md.tt +59 -0
  28. data/lib/generators/claude/install/templates/USAGE +28 -0
  29. data/lib/generators/claude/install/templates/agents/api-dev.md.tt +46 -0
  30. data/lib/generators/claude/install/templates/agents/fullstack-dev.md.tt +48 -0
  31. data/lib/generators/claude/install/templates/agents/rails-developer.md.tt +40 -0
  32. data/lib/generators/claude/install/templates/settings.local.json.tt +13 -0
  33. data/lib/generators/claude/rule/rule_generator.rb +175 -0
  34. data/lib/generators/claude/rule/templates/rule.md.tt +7 -0
  35. data/lib/generators/claude/rules_library/code-style.md +37 -0
  36. data/lib/generators/claude/rules_library/database.md +47 -0
  37. data/lib/generators/claude/rules_library/hotwire.md +56 -0
  38. data/lib/generators/claude/rules_library/security.md +54 -0
  39. data/lib/generators/claude/rules_library/testing.md +47 -0
  40. data/lib/generators/claude/skill/skill_generator.rb +196 -0
  41. data/lib/generators/claude/skill/templates/SKILL.md.tt +27 -0
  42. data/lib/generators/claude/skills_library/create-task-files/SKILL.md +311 -0
  43. data/lib/generators/claude/skills_library/create-task-files/templates/bug.md +60 -0
  44. data/lib/generators/claude/skills_library/create-task-files/templates/epic.md +47 -0
  45. data/lib/generators/claude/skills_library/create-task-files/templates/issue.md +45 -0
  46. data/lib/generators/claude/skills_library/create-task-files/templates/user-story.md +57 -0
  47. data/lib/generators/claude/skills_library/minitest-testing/SKILL.md +398 -0
  48. data/lib/generators/claude/skills_library/minitest-testing/references/examples.md +889 -0
  49. data/lib/generators/claude/skills_library/plan-feature/SKILL.md +253 -0
  50. data/lib/generators/claude/skills_library/rails-api-controllers/SKILL.md +1041 -0
  51. data/lib/generators/claude/skills_library/rails-api-controllers/references/api-documentation.md +422 -0
  52. data/lib/generators/claude/skills_library/rails-api-controllers/references/serialization.md +456 -0
  53. data/lib/generators/claude/skills_library/rails-auth-with-devise/SKILL.md +191 -0
  54. data/lib/generators/claude/skills_library/rails-auth-with-devise/references/advanced.md +331 -0
  55. data/lib/generators/claude/skills_library/rails-auth-with-devise/references/api-auth.md +266 -0
  56. data/lib/generators/claude/skills_library/rails-auth-with-devise/references/omniauth.md +194 -0
  57. data/lib/generators/claude/skills_library/rails-authorization-cancancan/SKILL.md +603 -0
  58. data/lib/generators/claude/skills_library/rails-authorization-cancancan/references/api-authorization.md +543 -0
  59. data/lib/generators/claude/skills_library/rails-authorization-cancancan/references/complex-permissions.md +572 -0
  60. data/lib/generators/claude/skills_library/rails-authorization-cancancan/references/multi-tenancy.md +373 -0
  61. data/lib/generators/claude/skills_library/rails-controllers/SKILL.md +514 -0
  62. data/lib/generators/claude/skills_library/rails-debugging/SKILL.md +260 -0
  63. data/lib/generators/claude/skills_library/rails-deployment/SKILL.md +437 -0
  64. data/lib/generators/claude/skills_library/rails-deployment/references/examples.md +901 -0
  65. data/lib/generators/claude/skills_library/rails-hotwire/SKILL.md +367 -0
  66. data/lib/generators/claude/skills_library/rails-jobs/MISSION_CONTROL_SETUP.md +639 -0
  67. data/lib/generators/claude/skills_library/rails-jobs/SKILL.md +704 -0
  68. data/lib/generators/claude/skills_library/rails-mailers/SKILL.md +549 -0
  69. data/lib/generators/claude/skills_library/rails-models/SKILL.md +379 -0
  70. data/lib/generators/claude/skills_library/rails-pagination-kaminari/SKILL.md +622 -0
  71. data/lib/generators/claude/skills_library/rails-pagination-kaminari/references/api-pagination.md +523 -0
  72. data/lib/generators/claude/skills_library/rails-pagination-kaminari/references/custom-themes.md +498 -0
  73. data/lib/generators/claude/skills_library/rails-pagination-kaminari/references/performance.md +478 -0
  74. data/lib/generators/claude/skills_library/rails-views/SKILL.md +508 -0
  75. data/lib/generators/claude/skills_library/refine-requirements/SKILL.md +226 -0
  76. data/lib/generators/claude/skills_library/refine-requirements/references/examples.md +344 -0
  77. data/lib/generators/claude/skills_library/refine-requirements/references/reference.md +298 -0
  78. data/lib/generators/claude/skills_library/rspec-testing/SKILL.md +572 -0
  79. data/lib/generators/claude/skills_library/rspec-testing/references/better_specs_guide.md +273 -0
  80. data/lib/generators/claude/skills_library/rspec-testing/references/thoughtbot_patterns.md +407 -0
  81. data/lib/generators/claude/skills_library/tailwindcss/SKILL.md +371 -0
  82. data/lib/generators/claude/views/views_generator.rb +113 -0
  83. data/lib/rails_claude_skills/railtie.rb +16 -0
  84. data/lib/rails_claude_skills/version.rb +5 -0
  85. data/lib/rails_claude_skills.rb +27 -0
  86. data/sig/rails_claude_skills.rbs +4 -0
  87. metadata +199 -0
@@ -0,0 +1,226 @@
1
+ ---
2
+ name: refine-requirements
3
+ description: Refine and clarify feature requirements by asking targeted follow-up questions, then update or create tasks based on answers. Use after initial planning when requirements need clarification, or when the user mentions "refine", "clarify", "more details", or "questions".
4
+ allowed-tools: Read, AskUserQuestion, TodoWrite
5
+ ---
6
+
7
+ # Refine Requirements Skill
8
+
9
+ Ask targeted follow-up questions to clarify ambiguous requirements and update implementation tasks based on the answers. Used after initial feature planning to ensure comprehensive understanding before coding.
10
+
11
+ ## When to Use This Skill
12
+
13
+ Use this skill when:
14
+ - After running `/plan-feature` and need more clarity
15
+ - User says "I need to clarify some things"
16
+ - Requirements seem ambiguous or incomplete
17
+ - User mentions "refine", "more details", "questions"
18
+ - Before starting implementation to reduce rework
19
+
20
+ ## Instructions
21
+
22
+ Follow these steps to refine requirements:
23
+
24
+ ### Step 1: Understand Current Context
25
+
26
+ First, gather context about what's been planned:
27
+
28
+ 1. Check if TodoWrite has active tasks (indicates planning already happened)
29
+ 2. If tasks exist, read them to understand the feature scope
30
+ 3. If no tasks, ask user: "What feature are you refining requirements for?"
31
+
32
+ Present current understanding:
33
+ ```
34
+ I can see you're planning [feature name] with [N] tasks. Let me ask some clarifying questions to refine the requirements.
35
+ ```
36
+
37
+ ### Step 2: Identify Gaps and Ambiguities
38
+
39
+ Analyze the current plan for common gaps:
40
+
41
+ **Data/Schema Questions:**
42
+ - Missing field validations or constraints
43
+ - Unclear relationships or associations
44
+ - Missing indexes or performance considerations
45
+ - Data migration or seeding needs
46
+
47
+ **Business Logic Questions:**
48
+ - Edge cases not covered
49
+ - Validation rules unclear
50
+ - State transitions undefined
51
+ - Authorization rules ambiguous
52
+
53
+ **UI/UX Questions:**
54
+ - User workflows incomplete
55
+ - Error handling unclear
56
+ - Success/failure states undefined
57
+ - Mobile vs desktop behavior
58
+
59
+ **Technical Questions:**
60
+ - Performance requirements unclear
61
+ - Caching strategy undefined
62
+ - Background job needs
63
+ - Real-time updates needed?
64
+ - API requirements
65
+
66
+ ### Step 3: Ask Targeted Questions
67
+
68
+ Use AskUserQuestion to ask 3-5 focused questions based on the feature type.
69
+
70
+ **Question selection strategy:**
71
+ 1. Refer to [reference.md](reference.md) for question templates by feature type
72
+ 2. Prioritize questions that will change implementation significantly
73
+ 3. Focus on gaps that could cause rework later
74
+ 4. Avoid questions already answered in the plan
75
+
76
+ **Format questions clearly:**
77
+ - One topic per question
78
+ - Provide context for why you're asking
79
+ - Offer common options when applicable
80
+ - Use multiSelect when appropriate
81
+
82
+ ### Step 4: Analyze Answers
83
+
84
+ After receiving answers, analyze impact:
85
+
86
+ 1. **New tasks needed?** - Do answers introduce new work?
87
+ 2. **Existing tasks change?** - Do answers modify planned approach?
88
+ 3. **Dependencies shift?** - Do answers change task ordering?
89
+ 4. **Scope change?** - Do answers significantly expand/reduce scope?
90
+
91
+ ### Step 5: Update or Create Tasks
92
+
93
+ Based on answers, update the implementation plan:
94
+
95
+ **If TodoWrite tasks exist:**
96
+ - Use TodoWrite to update existing tasks with new details
97
+ - Add new tasks if answers revealed additional work
98
+ - Reorder tasks if dependencies changed
99
+ - Mark tasks as pending that need revision
100
+
101
+ **If no tasks exist:**
102
+ - Create initial task list using TodoWrite
103
+ - Include all details from the refinement conversation
104
+
105
+ **Task updates should include:**
106
+ - Specific details from answers (validation rules, UI states, etc.)
107
+ - New acceptance criteria
108
+ - Changed technical approach
109
+ - Additional files to create/modify
110
+
111
+ ### Step 6: Present Refinement Summary
112
+
113
+ Provide a clear summary of what changed:
114
+
115
+ ```
116
+ ## Requirements Refined
117
+
118
+ ### Questions Asked
119
+ 1. [Question 1]
120
+ - Answer: [Summary]
121
+ - Impact: [What this changes]
122
+
123
+ 2. [Question 2]
124
+ - Answer: [Summary]
125
+ - Impact: [What this changes]
126
+
127
+ ### Changes to Implementation Plan
128
+
129
+ **Tasks Updated:**
130
+ - Task 3: Added email uniqueness validation
131
+ - Task 5: Changed to use Turbo Stream instead of full page reload
132
+
133
+ **New Tasks Added:**
134
+ - Task 7: Implement password strength indicator
135
+ - Task 8: Add "remember me" functionality
136
+
137
+ **Technical Approach Changes:**
138
+ - Using Devise instead of custom auth
139
+ - Adding Kredis for session storage
140
+ - Implementing rate limiting with Rack::Attack
141
+
142
+ ### Updated Scope
143
+ - Original: [X] tasks
144
+ - Refined: [Y] tasks
145
+ - Effort change: [increased/decreased/same]
146
+
147
+ ### Ready to Proceed?
148
+ The implementation plan has been updated based on your answers. Review the updated tasks and let me know if you'd like to proceed or need further refinement.
149
+ ```
150
+
151
+ ## Question Strategies by Feature Type
152
+
153
+ For detailed question templates, see [reference.md](reference.md).
154
+
155
+ **Quick reference:**
156
+
157
+ ### Authentication Features
158
+ Focus on: method, security, sessions, recovery, MFA
159
+
160
+ ### CRUD Features
161
+ Focus on: validations, permissions, UI flows, real-time updates
162
+
163
+ ### Admin/Dashboard Features
164
+ Focus on: metrics, filters, exports, access control
165
+
166
+ ### API Features
167
+ Focus on: versioning, authentication, rate limiting, documentation
168
+
169
+ ### Background Jobs
170
+ Focus on: triggers, frequency, error handling, monitoring
171
+
172
+ ## Best Practices
173
+
174
+ **Do:**
175
+ - ✅ Ask questions that will significantly impact implementation
176
+ - ✅ Reference existing Rails patterns in the project
177
+ - ✅ Prioritize security and performance clarifications
178
+ - ✅ Focus on edge cases and error scenarios
179
+ - ✅ Consider mobile vs desktop differences
180
+ - ✅ Update tasks with specific, actionable details
181
+
182
+ **Don't:**
183
+ - ❌ Ask questions already answered in the plan
184
+ - ❌ Ask more than 5 questions at once (overwhelming)
185
+ - ❌ Ask vague questions without context
186
+ - ❌ Skip updating tasks after getting answers
187
+ - ❌ Make assumptions - clarify instead
188
+ - ❌ Ignore technical debt or performance implications
189
+
190
+ ## Integration with Other Skills
191
+
192
+ **After plan-feature:**
193
+ ```bash
194
+ /plan-feature "Add commenting system"
195
+ # ... initial plan created ...
196
+ /refine-requirements
197
+ # ... asks follow-up questions, updates tasks ...
198
+ ```
199
+
200
+ **Before create-task-files:**
201
+ ```bash
202
+ /plan-feature "Add commenting system"
203
+ /refine-requirements # Clarify first
204
+ /create-task-files # Then export
205
+ ```
206
+
207
+ **Standalone:**
208
+ ```bash
209
+ /refine-requirements
210
+ # Asks: "What feature are you refining?"
211
+ # Creates tasks based on detailed answers
212
+ ```
213
+
214
+ ## Examples
215
+
216
+ For real-world examples of requirement refinement sessions, see [examples.md](examples.md).
217
+
218
+ ## Output
219
+
220
+ Always use TodoWrite to update or create tasks. Ensure:
221
+ - Tasks include specific details from answers
222
+ - Acceptance criteria updated with new requirements
223
+ - Technical approach reflects refined understanding
224
+ - Dependencies and ordering adjusted if needed
225
+
226
+ This skill ensures thorough requirement gathering, reduces implementation rework, and catches edge cases early in the planning phase.
@@ -0,0 +1,344 @@
1
+ # Requirement Refinement Examples
2
+
3
+ Real-world examples of requirement refinement sessions showing how follow-up questions lead to better implementation plans.
4
+
5
+ ## Example 1: Blog Post Commenting System
6
+
7
+ ### Initial Plan (from /plan-feature)
8
+
9
+ **Feature:** Add commenting system for blog posts
10
+
11
+ **Initial Tasks:**
12
+ 1. Create Comment model with migration
13
+ 2. Add CommentsController with CRUD actions
14
+ 3. Build comment form partial
15
+ 4. Display comments list
16
+ 5. Add tests
17
+
18
+ ### Refinement Session
19
+
20
+ **Questions Asked:**
21
+
22
+ **Q1: Comment Threading**
23
+ - Header: "Nesting"
24
+ - Question: "Should comments support nested replies (threaded discussions) or stay flat?"
25
+ - Options:
26
+ - Flat comments only (simpler)
27
+ - One level of nesting (reply to comments)
28
+ - Unlimited nesting depth (full threading)
29
+
30
+ **Answer:** One level of nesting
31
+
32
+ **Q2: Moderation**
33
+ - Header: "Moderation"
34
+ - Question: "How should comment moderation work?"
35
+ - Options:
36
+ - Auto-publish all comments
37
+ - Admin approval required before publishing
38
+ - Auto-publish but allow flagging for review
39
+ - Spam detection with Akismet integration
40
+
41
+ **Answer:** Auto-publish but allow flagging for review
42
+
43
+ **Q3: Editing & Deletion**
44
+ - Header: "Edit/Delete"
45
+ - Question: "Can users edit or delete their comments after posting?"
46
+ - Options:
47
+ - No editing or deletion
48
+ - Edit within 5 minutes of posting
49
+ - Edit anytime, show edit indicator
50
+ - Soft delete only (hide but preserve)
51
+
52
+ **Answer:** Edit within 5 minutes, soft delete
53
+
54
+ **Q4: Notifications**
55
+ - Header: "Notifications"
56
+ - Question: "Should users be notified of replies to their comments?"
57
+ - Options:
58
+ - No notifications
59
+ - Email notifications (immediate)
60
+ - In-app notifications only
61
+ - Both email and in-app with user preference
62
+
63
+ **Answer:** Both email and in-app with user preference
64
+
65
+ ### Updated Implementation Plan
66
+
67
+ **New/Modified Tasks:**
68
+
69
+ 1. ✏️ **Updated:** Create Comment model with migration
70
+ - Add `parent_id` for one-level nesting
71
+ - Add `deleted_at` for soft deletes
72
+ - Add `edited` boolean flag
73
+ - Add `flagged` boolean and `flag_count` integer
74
+ - Add indexes: `parent_id`, `deleted_at`, `post_id + created_at`
75
+
76
+ 2. **New:** Add CommentNotificationPreference model
77
+ - Migration for user notification preferences
78
+ - Default to email + in-app enabled
79
+
80
+ 3. ✏️ **Updated:** Add CommentsController
81
+ - CRUD actions
82
+ - Add `flag` action for reporting
83
+ - Add edit action with 5-minute time check
84
+ - Add soft delete (update deleted_at)
85
+ - Add `replies` action for nested comments
86
+
87
+ 4. **New:** Add CommentNotificationJob
88
+ - Background job to send email notifications
89
+ - Check user preferences before sending
90
+ - Use ActionMailer
91
+
92
+ 5. ✏️ **Updated:** Build comment form partial
93
+ - Support reply context (parent comment)
94
+ - Show "replying to @username"
95
+ - Cancel reply button
96
+
97
+ 6. ✏️ **Updated:** Display comments list
98
+ - Show nested replies (indented)
99
+ - Show edit indicator if edited
100
+ - Hide deleted comments (show "[deleted]")
101
+ - Flag button for inappropriate content
102
+ - Edit button (only if < 5 minutes and owner)
103
+ - Delete button (owner only)
104
+
105
+ 7. **New:** Add in-app notification system
106
+ - Create Notification model
107
+ - Add notification bell UI component
108
+ - Mark as read functionality
109
+
110
+ 8. **New:** Add admin moderation dashboard
111
+ - List flagged comments
112
+ - Approve/delete actions
113
+ - Ban user capability
114
+
115
+ 9. ✏️ **Updated:** Add tests
116
+ - Test nested replies
117
+ - Test soft delete behavior
118
+ - Test edit time window
119
+ - Test flagging workflow
120
+ - Test notification delivery
121
+
122
+ **Scope Change:**
123
+ - Original: 5 tasks
124
+ - Refined: 13 tasks
125
+ - Effort: Significantly increased (but prevented rework)
126
+
127
+ ---
128
+
129
+ ## Example 2: User Authentication
130
+
131
+ ### Initial Plan
132
+
133
+ **Feature:** Add user login with email/password
134
+
135
+ **Initial Tasks:**
136
+ 1. Install Devise
137
+ 2. Generate User model
138
+ 3. Add login/logout routes
139
+ 4. Create login form
140
+ 5. Add tests
141
+
142
+ ### Refinement Session
143
+
144
+ **Questions Asked:**
145
+
146
+ **Q1: Registration Flow**
147
+ "What's required for user registration?"
148
+ - Email + password only
149
+ - Email + password + name ✓
150
+ - Email + password + name + profile photo
151
+ - OAuth only (Google/GitHub)
152
+
153
+ **Q2: Email Verification**
154
+ "Should users verify email before accessing the app?"
155
+ - No verification needed
156
+ - Optional verification (can use app immediately) ✓
157
+ - Required verification (can't login until verified)
158
+
159
+ **Q3: Password Security**
160
+ "What password security requirements?"
161
+ - Basic (6+ characters)
162
+ - Medium (8+ chars, mix of letters/numbers) ✓
163
+ - Strong (10+ chars, uppercase, lowercase, numbers, symbols)
164
+
165
+ **Q4: Session Management**
166
+ "How should user sessions work?"
167
+ - Standard session (logout on browser close)
168
+ - Remember me checkbox (30 days) ✓
169
+ - Always remember (persistent session)
170
+
171
+ ### Updated Implementation Plan
172
+
173
+ **Changes:**
174
+ - Added name field to User model
175
+ - Added email confirmation columns
176
+ - Added Devise confirmable module
177
+ - Added password strength validator gem
178
+ - Added remember_me checkbox to login form
179
+ - Added welcome email on registration
180
+ - Added email confirmation instructions email
181
+ - Added profile name to navigation
182
+ - Added tests for email confirmation flow
183
+ - Added tests for password validation
184
+ - Added tests for remember me functionality
185
+
186
+ **Scope Change:**
187
+ - Original: 5 tasks
188
+ - Refined: 9 tasks
189
+
190
+ ---
191
+
192
+ ## Example 3: Admin Dashboard
193
+
194
+ ### Initial Plan
195
+
196
+ **Feature:** Create admin dashboard to manage posts
197
+
198
+ **Initial Tasks:**
199
+ 1. Add admin role to User model
200
+ 2. Create Admin::PostsController
201
+ 3. Build admin posts index view
202
+ 4. Add authorization checks
203
+ 5. Add tests
204
+
205
+ ### Refinement Session
206
+
207
+ **Questions Asked:**
208
+
209
+ **Q1: Metrics Display**
210
+ "What metrics should the dashboard show?"
211
+ - Just post count
212
+ - Post count + user count + comment count ✓
213
+ - Full analytics (views, engagement, trends)
214
+
215
+ **Q2: Filtering**
216
+ "How should admins filter posts?"
217
+ - No filtering
218
+ - By status (published/draft) ✓
219
+ - By status + author + date range ✓
220
+
221
+ **Q3: Bulk Actions**
222
+ "Should admins be able to perform bulk actions?"
223
+ - No bulk actions
224
+ - Bulk delete only
225
+ - Bulk publish/unpublish ✓
226
+ - Full bulk edit capabilities
227
+
228
+ **Q4: Activity Log**
229
+ "Should admin actions be logged?"
230
+ - No logging
231
+ - Log in Rails logger only
232
+ - Database audit log ✓
233
+ - Database log + email notifications for critical actions
234
+
235
+ ### Updated Implementation Plan
236
+
237
+ **Changes:**
238
+ - Added dashboard homepage with metrics cards
239
+ - Added counter caches for metrics
240
+ - Added filtering form with status, author, date range
241
+ - Added bulk action checkboxes
242
+ - Added bulk controller actions
243
+ - Added AdminAuditLog model
244
+ - Added audit log viewer
245
+ - Added Turbo Frames for inline editing
246
+ - Added Stimulus controller for bulk selection
247
+ - Extended test coverage for all features
248
+
249
+ **Scope Change:**
250
+ - Original: 5 tasks
251
+ - Refined: 14 tasks
252
+
253
+ ---
254
+
255
+ ## Example 4: API Endpoint
256
+
257
+ ### Initial Plan
258
+
259
+ **Feature:** Add JSON API for blog posts
260
+
261
+ **Initial Tasks:**
262
+ 1. Create API::PostsController
263
+ 2. Add JSON serialization
264
+ 3. Add API routes
265
+ 4. Add tests
266
+
267
+ ### Refinement Session
268
+
269
+ **Questions Asked:**
270
+
271
+ **Q1: Authentication**
272
+ "How should API clients authenticate?"
273
+ - No authentication (public API)
274
+ - API keys ✓
275
+ - JWT tokens
276
+ - OAuth 2.0
277
+
278
+ **Q2: Versioning**
279
+ "How should we version the API?"
280
+ - No versioning
281
+ - URL versioning (/api/v1) ✓
282
+ - Header versioning
283
+ - Query parameter versioning
284
+
285
+ **Q3: Rate Limiting**
286
+ "Should we rate limit API requests?"
287
+ - No rate limiting
288
+ - Basic rate limit (100 requests/hour per IP)
289
+ - Tiered rate limits by API key tier ✓
290
+ - Dynamic rate limiting based on load
291
+
292
+ **Q4: Response Format**
293
+ "What should API responses include?"
294
+ - Just the data
295
+ - Data + metadata (pagination, links) ✓
296
+ - Data + metadata + HATEOAS links
297
+
298
+ ### Updated Implementation Plan
299
+
300
+ **Changes:**
301
+ - Added ApiKey model with generation and tiers
302
+ - Added API authentication middleware
303
+ - Added rack-attack for rate limiting
304
+ - Added tier-based rate limit configuration
305
+ - Added /api/v1 namespace
306
+ - Added pagination with Kaminari
307
+ - Added metadata in responses
308
+ - Added API documentation with OpenAPI spec
309
+ - Added rate limit headers in responses
310
+ - Added API key management UI for admins
311
+ - Added comprehensive API tests
312
+
313
+ **Scope Change:**
314
+ - Original: 4 tasks
315
+ - Refined: 11 tasks
316
+
317
+ ---
318
+
319
+ ## Key Takeaways from Examples
320
+
321
+ ### Common Patterns
322
+
323
+ 1. **Initial plans are often too simple** - Missing edge cases, validation rules, and UX details
324
+ 2. **Security and performance are often overlooked** - Rate limiting, authorization, caching
325
+ 3. **User experience details matter** - Notifications, feedback, error handling
326
+ 4. **Admin/management tools needed** - Moderation, audit logs, bulk actions
327
+
328
+ ### Impact of Refinement
329
+
330
+ - **Prevents rework** - Catches requirements early
331
+ - **Improves quality** - Forces thinking about edge cases
332
+ - **Sets expectations** - User knows full scope upfront
333
+ - **Better estimates** - More accurate task breakdown
334
+
335
+ ### Best Questions to Ask
336
+
337
+ 1. **Edge cases** - What happens when X fails or is unusual?
338
+ 2. **Permissions** - Who can do what?
339
+ 3. **User experience** - How should this feel to use?
340
+ 4. **Performance** - How fast must this be?
341
+ 5. **Security** - What could go wrong?
342
+ 6. **Scale** - How many records/users/requests?
343
+
344
+ Use these examples as templates for your own requirement refinement sessions.