@qazuor/claude-code-config 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 (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1248 -0
  3. package/dist/bin.cjs +11886 -0
  4. package/dist/bin.cjs.map +1 -0
  5. package/dist/bin.d.cts +1 -0
  6. package/dist/bin.d.ts +1 -0
  7. package/dist/bin.js +11869 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/index.cjs +3887 -0
  10. package/dist/index.cjs.map +1 -0
  11. package/dist/index.d.cts +1325 -0
  12. package/dist/index.d.ts +1325 -0
  13. package/dist/index.js +3835 -0
  14. package/dist/index.js.map +1 -0
  15. package/package.json +86 -0
  16. package/templates/.log/notifications.log +1775 -0
  17. package/templates/agents/README.md +164 -0
  18. package/templates/agents/_registry.json +443 -0
  19. package/templates/agents/design/content-writer.md +353 -0
  20. package/templates/agents/design/ux-ui-designer.md +382 -0
  21. package/templates/agents/engineering/astro-engineer.md +293 -0
  22. package/templates/agents/engineering/db-drizzle-engineer.md +360 -0
  23. package/templates/agents/engineering/express-engineer.md +316 -0
  24. package/templates/agents/engineering/fastify-engineer.md +399 -0
  25. package/templates/agents/engineering/hono-engineer.md +263 -0
  26. package/templates/agents/engineering/mongoose-engineer.md +473 -0
  27. package/templates/agents/engineering/nestjs-engineer.md +429 -0
  28. package/templates/agents/engineering/nextjs-engineer.md +451 -0
  29. package/templates/agents/engineering/node-typescript-engineer.md +347 -0
  30. package/templates/agents/engineering/prisma-engineer.md +432 -0
  31. package/templates/agents/engineering/react-senior-dev.md +394 -0
  32. package/templates/agents/engineering/tanstack-start-engineer.md +447 -0
  33. package/templates/agents/engineering/tech-lead.md +269 -0
  34. package/templates/agents/product/product-functional.md +329 -0
  35. package/templates/agents/product/product-technical.md +578 -0
  36. package/templates/agents/quality/debugger.md +514 -0
  37. package/templates/agents/quality/qa-engineer.md +390 -0
  38. package/templates/agents/specialized/enrichment-agent.md +277 -0
  39. package/templates/agents/specialized/i18n-specialist.md +322 -0
  40. package/templates/agents/specialized/seo-ai-specialist.md +387 -0
  41. package/templates/agents/specialized/tech-writer.md +300 -0
  42. package/templates/code-style/.editorconfig +27 -0
  43. package/templates/code-style/.prettierignore +25 -0
  44. package/templates/code-style/.prettierrc +12 -0
  45. package/templates/code-style/biome.json +78 -0
  46. package/templates/code-style/commitlint.config.js +44 -0
  47. package/templates/commands/README.md +175 -0
  48. package/templates/commands/_registry.json +420 -0
  49. package/templates/commands/add-new-entity.md +211 -0
  50. package/templates/commands/audit/accessibility-audit.md +360 -0
  51. package/templates/commands/audit/performance-audit.md +290 -0
  52. package/templates/commands/audit/security-audit.md +231 -0
  53. package/templates/commands/code-check.md +127 -0
  54. package/templates/commands/five-why.md +225 -0
  55. package/templates/commands/formatting/format-markdown.md +197 -0
  56. package/templates/commands/git/commit.md +247 -0
  57. package/templates/commands/meta/create-agent.md +257 -0
  58. package/templates/commands/meta/create-command.md +312 -0
  59. package/templates/commands/meta/create-skill.md +321 -0
  60. package/templates/commands/meta/help.md +318 -0
  61. package/templates/commands/planning/check-completed-tasks.md +224 -0
  62. package/templates/commands/planning/cleanup-issues.md +248 -0
  63. package/templates/commands/planning/planning-cleanup.md +251 -0
  64. package/templates/commands/planning/sync-planning-github.md +133 -0
  65. package/templates/commands/planning/sync-todos-github.md +203 -0
  66. package/templates/commands/quality-check.md +211 -0
  67. package/templates/commands/run-tests.md +159 -0
  68. package/templates/commands/start-feature-plan.md +232 -0
  69. package/templates/commands/start-refactor-plan.md +244 -0
  70. package/templates/commands/sync-planning.md +176 -0
  71. package/templates/commands/update-docs.md +242 -0
  72. package/templates/docs/CHECKPOINT-SYSTEM.md +504 -0
  73. package/templates/docs/INDEX.md +677 -0
  74. package/templates/docs/RECOMMENDED-HOOKS.md +415 -0
  75. package/templates/docs/_registry.json +329 -0
  76. package/templates/docs/diagrams/README.md +220 -0
  77. package/templates/docs/diagrams/agent-hierarchy.mmd +55 -0
  78. package/templates/docs/diagrams/documentation-map.mmd +61 -0
  79. package/templates/docs/diagrams/tools-relationship.mmd +55 -0
  80. package/templates/docs/diagrams/workflow-decision-tree.mmd +38 -0
  81. package/templates/docs/doc-sync.md +533 -0
  82. package/templates/docs/examples/end-to-end-workflow.md +1505 -0
  83. package/templates/docs/glossary.md +495 -0
  84. package/templates/docs/guides/mockup-prompt-engineering.md +644 -0
  85. package/templates/docs/guides/mockup-setup.md +737 -0
  86. package/templates/docs/learnings/README.md +250 -0
  87. package/templates/docs/learnings/common-architectural-patterns.md +123 -0
  88. package/templates/docs/learnings/common-mistakes-to-avoid.md +149 -0
  89. package/templates/docs/learnings/markdown-formatting-standards.md +104 -0
  90. package/templates/docs/learnings/monorepo-command-execution.md +64 -0
  91. package/templates/docs/learnings/optimization-tips.md +146 -0
  92. package/templates/docs/learnings/planning-linear-sync-workflow.md +70 -0
  93. package/templates/docs/learnings/shell-compatibility-fish.md +46 -0
  94. package/templates/docs/learnings/test-organization-structure.md +68 -0
  95. package/templates/docs/mcp-installation.md +613 -0
  96. package/templates/docs/mcp-servers.md +989 -0
  97. package/templates/docs/notification-installation.md +570 -0
  98. package/templates/docs/quick-start.md +354 -0
  99. package/templates/docs/standards/architecture-patterns.md +1064 -0
  100. package/templates/docs/standards/atomic-commits.md +513 -0
  101. package/templates/docs/standards/code-standards.md +993 -0
  102. package/templates/docs/standards/design-standards.md +656 -0
  103. package/templates/docs/standards/documentation-standards.md +1160 -0
  104. package/templates/docs/standards/testing-standards.md +969 -0
  105. package/templates/docs/system-maintenance.md +604 -0
  106. package/templates/docs/templates/PDR-template.md +561 -0
  107. package/templates/docs/templates/TODOs-template.md +534 -0
  108. package/templates/docs/templates/tech-analysis-template.md +800 -0
  109. package/templates/docs/workflows/README.md +519 -0
  110. package/templates/docs/workflows/atomic-task-protocol.md +955 -0
  111. package/templates/docs/workflows/decision-tree.md +482 -0
  112. package/templates/docs/workflows/edge-cases.md +856 -0
  113. package/templates/docs/workflows/phase-1-planning.md +957 -0
  114. package/templates/docs/workflows/phase-2-implementation.md +896 -0
  115. package/templates/docs/workflows/phase-3-validation.md +792 -0
  116. package/templates/docs/workflows/phase-4-finalization.md +927 -0
  117. package/templates/docs/workflows/quick-fix-protocol.md +505 -0
  118. package/templates/docs/workflows/task-atomization.md +537 -0
  119. package/templates/docs/workflows/task-completion-protocol.md +448 -0
  120. package/templates/hooks/on-notification.sh +28 -0
  121. package/templates/schemas/checkpoint.schema.json +97 -0
  122. package/templates/schemas/code-registry.schema.json +84 -0
  123. package/templates/schemas/pdr.schema.json +314 -0
  124. package/templates/schemas/problems.schema.json +55 -0
  125. package/templates/schemas/tech-analysis.schema.json +404 -0
  126. package/templates/schemas/telemetry.schema.json +298 -0
  127. package/templates/schemas/todos.schema.json +234 -0
  128. package/templates/schemas/workflows.schema.json +69 -0
  129. package/templates/scripts/add-changelogs.sh +105 -0
  130. package/templates/scripts/generate-code-registry.ts +270 -0
  131. package/templates/scripts/health-check.sh +343 -0
  132. package/templates/scripts/sync-registry.sh +40 -0
  133. package/templates/scripts/telemetry-report.ts +36 -0
  134. package/templates/scripts/validate-docs.sh +224 -0
  135. package/templates/scripts/validate-registry.sh +225 -0
  136. package/templates/scripts/validate-schemas.ts +283 -0
  137. package/templates/scripts/validate-structure.sh +165 -0
  138. package/templates/scripts/worktree-cleanup.sh +81 -0
  139. package/templates/scripts/worktree-create.sh +63 -0
  140. package/templates/sessions/planning/.gitkeep +0 -0
  141. package/templates/sessions/planning/archived/.gitkeep +0 -0
  142. package/templates/settings.json +202 -0
  143. package/templates/settings.local.json +138 -0
  144. package/templates/skills/README.md +197 -0
  145. package/templates/skills/_registry.json +473 -0
  146. package/templates/skills/audit/accessibility-audit.md +309 -0
  147. package/templates/skills/audit/performance-audit.md +257 -0
  148. package/templates/skills/audit/security-audit.md +217 -0
  149. package/templates/skills/auth/nextauth-patterns.md +308 -0
  150. package/templates/skills/brand-guidelines.md +240 -0
  151. package/templates/skills/documentation/markdown-formatter.md +302 -0
  152. package/templates/skills/git/git-commit-helper.md +321 -0
  153. package/templates/skills/i18n/i18n-patterns.md +251 -0
  154. package/templates/skills/patterns/error-handling-patterns.md +242 -0
  155. package/templates/skills/patterns/tdd-methodology.md +342 -0
  156. package/templates/skills/qa/qa-criteria-validator.md +383 -0
  157. package/templates/skills/qa/web-app-testing.md +398 -0
  158. package/templates/skills/react/react-hook-form-patterns.md +359 -0
  159. package/templates/skills/state/redux-toolkit-patterns.md +272 -0
  160. package/templates/skills/state/tanstack-query-patterns.md +299 -0
  161. package/templates/skills/state/zustand-patterns.md +301 -0
  162. package/templates/skills/tech/mermaid-diagram-specialist.md +195 -0
  163. package/templates/skills/tech/shadcn-specialist.md +252 -0
  164. package/templates/skills/tech/vercel-specialist.md +297 -0
  165. package/templates/skills/testing/api-app-testing.md +254 -0
  166. package/templates/skills/testing/performance-testing.md +275 -0
  167. package/templates/skills/testing/security-testing.md +348 -0
  168. package/templates/skills/utils/add-memory.md +295 -0
  169. package/templates/skills/utils/json-data-auditor.md +283 -0
  170. package/templates/skills/utils/pdf-creator-editor.md +342 -0
  171. package/templates/tools/format-markdown.sh +185 -0
@@ -0,0 +1,856 @@
1
+ # Workflow Edge Cases & Exception Handling
2
+
3
+ This document covers non-standard scenarios, exceptions, and edge cases that may occur during any workflow level.
4
+
5
+ ## Table of Contents
6
+
7
+ <!-- markdownlint-disable MD051 -->
8
+
9
+ - [During Planning](#during-planning)
10
+ - [During Implementation](#during-implementation)
11
+ - [During Validation](#during-validation)
12
+ - [During Finalization](#during-finalization)
13
+ - [Cross-Phase Issues](#cross-phase-issues)
14
+
15
+ <!-- markdownlint-enable MD051 -->
16
+
17
+ ---
18
+
19
+ ## During Planning
20
+
21
+ ### Edge Case 1: Unclear or Conflicting Requirements
22
+
23
+ **Scenario:** User provides vague or contradictory requirements
24
+
25
+ **Example:**
26
+
27
+ > "Add search functionality but keep it simple... oh and also make it support advanced filters, autocomplete, and AI-powered suggestions"
28
+
29
+ **Resolution:**
30
+
31
+ 1. **Do NOT** make assumptions or proceed with implementation
32
+ 2. **Use** AskUserQuestion tool to clarify
33
+ 3. **Present** multiple options with trade-offs
34
+ 4. **Document** clarified requirements in PDR
35
+
36
+ **Template:**
37
+
38
+ ```text
39
+ I see potential conflicts in the requirements:
40
+
41
+ Option 1: Simple Search
42
+ - Basic text search only
43
+ - Effort: 1 day
44
+ - Trade-off: Limited functionality
45
+
46
+ Option 2: Advanced Search
47
+ - Filters + autocomplete
48
+ - Effort: 3 days
49
+ - Trade-off: More complex
50
+
51
+ Option 3: Full-Featured
52
+ - All features including AI
53
+ - Effort: 2 weeks
54
+ - Trade-off: Significant effort, external dependencies
55
+
56
+ Which aligns best with current priorities?
57
+ ```
58
+
59
+ ### Edge Case 2: Technical Feasibility Concerns
60
+
61
+ **Scenario:** Product requirements may not be technically feasible
62
+
63
+ **Example:** "Load 1 million records in under 100ms with no backend pagination"
64
+
65
+ **Resolution:**
66
+
67
+ 1. **Analyze** technical constraints
68
+ 2. **Escalate** to tech-lead for validation
69
+ 3. **Present** alternatives with feasibility analysis
70
+ 4. **Recommend** best approach
71
+
72
+ **Template:**
73
+
74
+ ```text
75
+ ⚠️ Feasibility Concern
76
+
77
+ Requirement: [exact requirement]
78
+ Issue: [technical limitation]
79
+
80
+ Analysis:
81
+ - Current approach would take ~[X]ms (exceeds target)
82
+ - Database/API constraints: [explain]
83
+
84
+ Alternatives:
85
+ 1. [Alternative 1] - Meets [X] but not [Y]
86
+ 2. [Alternative 2] - Different approach, achieves [Z]
87
+ 3. [Compromise] - Partial solution, realistic timeline
88
+
89
+ Recommendation: [Which alternative and why]
90
+
91
+ Needs your decision to proceed.
92
+ ```
93
+
94
+ ### Edge Case 3: Missing Information or Access
95
+
96
+ **Scenario:** Cannot proceed with planning due to missing dependencies
97
+
98
+ **Examples:**
99
+
100
+ - Need API credentials not yet provisioned
101
+ - Design mockups not ready
102
+ - Third-party service documentation unavailable
103
+
104
+ **Resolution:**
105
+
106
+ 1. **Document** blocking dependency in TODOs.md
107
+ 2. **Create** dependency task: `PB-000: Obtain [resource]`
108
+ 3. **Notify** user of blocker
109
+ 4. **Proceed** with non-dependent tasks if possible
110
+ 5. **Pause** planning if critical blocker
111
+
112
+ **Template:**
113
+
114
+ ```markdown
115
+ ## Blockers
116
+
117
+ ### PB-000: Obtain Stripe API Credentials
118
+
119
+ - **Status**: Blocked
120
+ - **Dependency**: Stripe account setup
121
+ - **Impact**: Cannot implement payment processing (PB-005, PB-006)
122
+ - **Action Required**: User must create Stripe account and provide keys
123
+ - **ETA**: Waiting on user
124
+
125
+ **Tasks that can proceed in parallel:**
126
+
127
+ - PB-001: Database schema
128
+ - PB-002: Models
129
+ - PB-003: Mock payment service (for development)
130
+ ```
131
+
132
+ ### Edge Case 4: Scope Creep During Planning
133
+
134
+ **Scenario:** Requirements keep growing during planning session
135
+
136
+ **Resolution:**
137
+
138
+ 1. **Stop** adding to current scope
139
+ 2. **Document** new requirements as "Future Enhancements"
140
+ 3. **Propose** phased approach
141
+ 4. **Get** user confirmation on Phase 1 scope
142
+
143
+ **Template:**
144
+
145
+ ```text
146
+ I notice the scope has expanded significantly:
147
+
148
+ Original Scope (1 week):
149
+ - [Feature A]
150
+ - [Feature B]
151
+
152
+ Current Scope (3+ weeks):
153
+ - [Feature A]
154
+ - [Feature B]
155
+ - [Feature C - new]
156
+ - [Feature D - new]
157
+ - [Feature E - new]
158
+
159
+ Recommendation - Phased Approach:
160
+
161
+ Phase 1 (MVP - 1 week):
162
+ - [Feature A]
163
+ - [Feature B]
164
+
165
+ Phase 2 (Enhancements - 2 weeks):
166
+ - [Feature C]
167
+ - [Feature D]
168
+
169
+ Future:
170
+ - [Feature E]
171
+
172
+ This ensures we deliver value quickly while managing complexity.
173
+
174
+ Should we proceed with Phase 1 as the current session scope?
175
+ ```
176
+
177
+ ---
178
+
179
+ ## During Implementation
180
+
181
+ ### Edge Case 5: Test Failures Block Progress
182
+
183
+ **Scenario:** Existing tests fail after changes, unrelated to current task
184
+
185
+ **Example:** Changed a util function, now 15 unrelated tests fail
186
+
187
+ **Resolution:**
188
+
189
+ 1. **Do NOT** commit broken tests
190
+ 2. **Assess** if failures are:
191
+ - **Related**: Fix as part of current task
192
+ - **Unrelated**: Create separate bug task
193
+ 3. **If related**: Fix and include in task
194
+ 4. **If unrelated**: Document as `PB-XXX-BUG: Fix broken tests`
195
+
196
+ **Template:**
197
+
198
+ ```text
199
+ ⚠️ Test Failures Detected
200
+
201
+ Current Task: PB-005 (Add booking service)
202
+
203
+ Failing Tests (15):
204
+ - 12 tests in payment.service.test.ts
205
+ - 3 tests in user.service.test.ts
206
+
207
+ Analysis:
208
+ - ALL failures related to util function change in date-helpers.ts
209
+ - NOT directly related to booking service
210
+
211
+ Action:
212
+ 1. Create task: PB-005-BUG: Fix date-helpers breaking changes
213
+ 2. Revert date-helpers changes
214
+ 3. Complete PB-005 with stable utils
215
+ 4. Address date-helpers in separate task
216
+
217
+ Proceed this way?
218
+ ```
219
+
220
+ ### Edge Case 6: Estimation Significantly Wrong
221
+
222
+ **Scenario:** Task estimated at 2 hours, already at 6 hours and 50% done
223
+
224
+ **Resolution:**
225
+
226
+ 1. **Stop** and assess why
227
+ 2. **Document** actual complexity
228
+ 3. **Update** TODOs.md with revised estimate
229
+ 4. **Inform** user if impacts timeline significantly
230
+ 5. **Continue** or **pause** for re-planning
231
+
232
+ **Template:**
233
+
234
+ ```text
235
+ ⚠️ Estimation Mismatch
236
+
237
+ Task: PB-007 - Frontend components
238
+ Estimated: 4 hours
239
+ Actual: 8 hours (and counting)
240
+ Completion: ~50%
241
+
242
+ Root Cause:
243
+ - Underestimated complexity of [X]
244
+ - Did not account for [Y]
245
+ - Discovered need for [Z]
246
+
247
+ Impact:
248
+ - This task needs ~16 hours total (12 more)
249
+ - Phase 2 timeline extended by 1.5 days
250
+ - Overall feature: 5 days → 6.5 days
251
+
252
+ Options:
253
+ 1. Continue with revised timeline
254
+ 2. Reduce scope (remove [feature])
255
+ 3. Pause for re-planning
256
+
257
+ Recommendation: [Your recommendation]
258
+
259
+ How should we proceed?
260
+ ```
261
+
262
+ ### Edge Case 7: Discovered Legacy Code Issues
263
+
264
+ **Scenario:** Current task exposes technical debt or bugs in existing code
265
+
266
+ **Example:** Implementing new feature reveals old code doesn't handle edge cases
267
+
268
+ **Resolution:**
269
+
270
+ 1. **Assess** severity:
271
+ - **Critical**: Blocks current task → Fix now
272
+ - **High**: Doesn't block → Separate task
273
+ - **Low**: Document for later
274
+ 2. **Create** bug task if needed
275
+ 3. **Continue** with current task if non-blocking
276
+
277
+ **Template:**
278
+
279
+ ```text
280
+ 🔍 Discovered Issue in Existing Code
281
+
282
+ Current Task: PB-004 (Implement search service)
283
+
284
+ Issue Found:
285
+ - File: packages/db/models/entity.model.ts
286
+ - Problem: findById() doesn't handle soft deletes
287
+ - Impact: Search results may include deleted entitys
288
+
289
+ Severity: HIGH (doesn't block search, but data integrity issue)
290
+
291
+ Action:
292
+ - Create task: PB-004-BUG: Fix soft delete handling in EntityModel
293
+ - Continue PB-004 with workaround (filter deleted in service layer)
294
+ - Address PB-004-BUG after PB-004 complete
295
+
296
+ Documented in TODOs.md.
297
+ ```
298
+
299
+ ### Edge Case 8: Merge Conflicts
300
+
301
+ **Scenario:** Pull/merge from main introduces conflicts
302
+
303
+ **Resolution:**
304
+
305
+ 1. **Assess** conflict complexity
306
+ 2. **If simple**: Resolve immediately
307
+ 3. **If complex**: Ask for guidance
308
+ 4. **Never** auto-resolve without understanding
309
+
310
+ **Template:**
311
+
312
+ ```text
313
+ ⚠️ Merge Conflict Detected
314
+
315
+ Files in conflict:
316
+ - packages/db/src/models/user.model.ts (5 conflicts)
317
+ - packages/service-core/src/auth.service.ts (2 conflicts)
318
+
319
+ Analysis:
320
+ - user.model.ts: Conflicting changes to findByEmail() method
321
+ - main branch: Added pagination
322
+ - my branch: Added soft delete check
323
+ - auth.service.ts: Both added new methods (no overlap)
324
+
325
+ Resolution Strategy:
326
+ 1. user.model.ts: Keep both changes (combine pagination + soft delete)
327
+ 2. auth.service.ts: Keep both methods
328
+
329
+ Will resolve and test. Is this approach correct?
330
+ ```
331
+
332
+ ### Edge Case 9: Breaking Changes in Dependencies
333
+
334
+ **Scenario:** Dependency update breaks existing code
335
+
336
+ **Example:** `@tanstack/query` v6 has breaking API changes
337
+
338
+ **Resolution:**
339
+
340
+ 1. **Do NOT** update mid-task unless critical security fix
341
+ 2. **Document** as future task
342
+ 3. **Pin** version in package.json
343
+ 4. **Complete** current task with stable dependency
344
+
345
+ **Template:**
346
+
347
+ ```text
348
+ ⚠️ Dependency Breaking Change Detected
349
+
350
+ Dependency: @tanstack/query v5 → v6
351
+ Issue: API changes break 15 files
352
+
353
+ Current Task: PB-006 (Add favorites UI)
354
+
355
+ Decision:
356
+ - Pin @tanstack/query to v5.x in package.json
357
+ - Complete PB-006 with stable version
358
+ - Create separate task: PB-100: Upgrade TanStack Query to v6
359
+
360
+ This avoids scope creep and maintains stability.
361
+
362
+ Documented in TODOs.md under "Future Tasks".
363
+ ```
364
+
365
+ ### Edge Case 10: API Changes During Implementation
366
+
367
+ **Scenario:** Backend API changes after frontend work started
368
+
369
+ **Resolution:**
370
+
371
+ 1. **Coordinate** with backend team
372
+ 2. **Use** API versioning if available
373
+ 3. **Update** contracts in real-time
374
+ 4. **Adjust** timeline if significant
375
+
376
+ **Template:**
377
+
378
+ ```text
379
+ 🔄 API Change Detected
380
+
381
+ Endpoint: POST /api/bookings
382
+ Change: Added required field `guestCount`
383
+
384
+ Current Task: PB-007 (Booking form)
385
+ Impact: Form validation needs update
386
+
387
+ Action:
388
+ 1. Update Zod schema to include guestCount
389
+ 2. Add field to form UI
390
+ 3. Update tests
391
+ 4. Estimate: +1 hour
392
+
393
+ No major timeline impact. Proceeding with changes.
394
+ ```
395
+
396
+ ---
397
+
398
+ ## During Validation
399
+
400
+ ### Edge Case 11: E2E Tests Flaky
401
+
402
+ **Scenario:** E2E tests pass locally, fail in CI
403
+
404
+ **Resolution:**
405
+
406
+ 1. **Identify** flakiness cause (timing, state, env)
407
+ 2. **Fix** root cause (don't just retry)
408
+ 3. **Add** explicit waits if timing issue
409
+ 4. **Document** if environment-specific
410
+
411
+ **Template:**
412
+
413
+ ```text
414
+ 🔄 Flaky E2E Test
415
+
416
+ Test: "should complete booking flow"
417
+ Status: Passes locally (10/10), fails in CI (3/10)
418
+
419
+ Root Cause Analysis:
420
+ - CI environment slower than local
421
+ - Test doesn't wait for payment confirmation toast
422
+ - Race condition: clicking "confirm" before data loads
423
+
424
+ Fix:
425
+ ```typescript
426
+ // Before (flaky):
427
+ await page.click('[data-testid="confirm-button"]');
428
+
429
+ // After (stable):
430
+ await page.waitForSelector('[data-testid="confirm-button"]:not([disabled])');
431
+ await page.click('[data-testid="confirm-button"]');
432
+ await page.waitForSelector('text=Booking confirmed');
433
+ ```
434
+
435
+ Applying fix to PB-009.
436
+
437
+ ```
438
+
439
+ ### Edge Case 12: Coverage Below 90% Threshold
440
+
441
+ **Scenario:** Test coverage reports 87%, target is 90%
442
+
443
+ **Resolution:**
444
+
445
+ 1. **Identify** untested paths with coverage report
446
+ 2. **Add** missing tests
447
+ 3. **Do NOT** lower threshold without user approval
448
+
449
+ **Template:**
450
+
451
+ ```text
452
+ ⚠️ Coverage Below Threshold
453
+
454
+ Current: 87%
455
+ Target: 90%
456
+ Gap: 3%
457
+
458
+ Untested Areas (from coverage report):
459
+ - packages/service-core/src/booking.service.ts:
460
+ - Lines 145-156: Error handling for double booking
461
+ - Lines 201-210: Refund calculation edge case
462
+
463
+ Action:
464
+ - Adding 2 test cases to booking.service.test.ts
465
+ - Estimated: 1 hour
466
+
467
+ ETA: Coverage will reach ~92% after tests added.
468
+ ```
469
+
470
+ ### Edge Case 13: Performance Regression Detected
471
+
472
+ **Scenario:** New code causes performance degradation
473
+
474
+ **Example:** API response time increased from 150ms to 800ms
475
+
476
+ **Resolution:**
477
+
478
+ 1. **Profile** to find bottleneck
479
+ 2. **Fix** if simple (missing index, N+1 query)
480
+ 3. **Escalate** if complex architectural issue
481
+
482
+ **Template:**
483
+
484
+ ```text
485
+ ⚠️ Performance Regression
486
+
487
+ Endpoint: GET /api/entitys
488
+ Before: 150ms (p95)
489
+ After: 800ms (p95)
490
+ Threshold: < 200ms
491
+
492
+ Root Cause:
493
+ - New filter joins 3 additional tables
494
+ - Missing index on `amenities.entity_id`
495
+
496
+ Fix:
497
+ ```sql
498
+ CREATE INDEX idx_amenities_entity
499
+ ON amenities(entity_id);
500
+ ```
501
+
502
+ After fix: 120ms (p95) ✅
503
+
504
+ Creating migration: PB-010-PERF.
505
+
506
+ ```
507
+
508
+ ### Edge Case 14: Security Vulnerability Found
509
+
510
+ **Scenario:** Security audit reveals SQL injection risk
511
+
512
+ **Resolution:**
513
+
514
+ 1. **STOP** validation immediately
515
+ 2. **Fix** security issue (highest priority)
516
+ 3. **Re-run** security audit
517
+ 4. **Document** in security log
518
+
519
+ **Template:**
520
+
521
+ ```text
522
+ 🚨 SECURITY ISSUE DETECTED
523
+
524
+ Severity: HIGH
525
+ Type: SQL Injection
526
+ Location: packages/db/models/search.model.ts:45
527
+
528
+ Code:
529
+ ```typescript
530
+ // VULNERABLE:
531
+ const query = `SELECT * FROM entitys WHERE title LIKE '%${input}%'`;
532
+ ```
533
+
534
+ Fix:
535
+
536
+ ```typescript
537
+ // SECURE:
538
+ const query = this.db
539
+ .select()
540
+ .from(entitys)
541
+ .where(like(entitys.title, `%${input}%`));
542
+ ```
543
+
544
+ Status: FIXED
545
+ Verification: Re-running security audit...
546
+
547
+ MUST fix before proceeding with deployment.
548
+
549
+ ```
550
+
551
+ ---
552
+
553
+ ## During Finalization
554
+
555
+ ### Edge Case 15: Documentation Out of Sync
556
+
557
+ **Scenario:** Code changed during implementation, docs don't reflect
558
+
559
+ **Resolution:**
560
+
561
+ 1. **Review** all docs against actual implementation
562
+ 2. **Update** any discrepancies
563
+ 3. **Verify** code examples actually work
564
+
565
+ **Template:**
566
+
567
+ ```text
568
+ 📝 Documentation Sync Required
569
+
570
+ Discrepancies Found:
571
+ 1. API docs show POST /api/bookings requires `roomType`
572
+ - Actual: Field is `entityType`
573
+ - Fix: Update OpenAPI spec
574
+
575
+ 2. User guide shows 3-step flow
576
+ - Actual: Now 4 steps (added confirmation)
577
+ - Fix: Update screenshots + text
578
+
579
+ 3. Code example in README outdated
580
+ - Uses old API (v1)
581
+ - Fix: Update to current API (v2)
582
+
583
+ Applying fixes to docs (PB-012).
584
+ ```
585
+
586
+ ### Edge Case 16: CHANGELOG Merge Conflict
587
+
588
+ **Scenario:** Multiple features updating CHANGELOG.md simultaneously
589
+
590
+ **Resolution:**
591
+
592
+ 1. **Fetch** latest from main
593
+ 2. **Merge** CHANGELOG entries chronologically
594
+ 3. **Preserve** both feature entries
595
+ 4. **Follow** Keep a Changelog format
596
+
597
+ **Template:**
598
+
599
+ ```text
600
+ 🔀 CHANGELOG Conflict
601
+
602
+ My feature: User Favorites
603
+ Other feature: Payment Integration (already merged)
604
+
605
+ Resolution:
606
+ ```markdown
607
+ ## [Unreleased]
608
+
609
+ ### Added
610
+
611
+ - **Payment Integration** - Process payments via Stripe
612
+ - Multiple payment methods
613
+ - Automatic receipt generation
614
+ - [Details](docs/payment-integration.md)
615
+
616
+ - **User Favorites** - Save favorite entitys
617
+ - Add/remove favorites
618
+ - Dedicated favorites page
619
+ - [Details](docs/favorites.md)
620
+ ```
621
+
622
+ Both entries preserved, alphabetically sorted within "Added" section.
623
+
624
+ ```
625
+
626
+ ---
627
+
628
+ ## Cross-Phase Issues
629
+
630
+ ### Edge Case 17: Critical Bug in Production
631
+
632
+ **Scenario:** Production bug requires immediate fix during ongoing feature work
633
+
634
+ **Resolution:**
635
+
636
+ 1. **Assess** severity:
637
+ - **Critical**: Stop feature, fix bug immediately
638
+ - **High**: Complete current atomic task, then fix
639
+ - **Medium/Low**: Continue feature, bug task later
640
+ 2. **Use** `hotfix/*` branch for critical fixes
641
+ 3. **Return** to feature after fix deployed
642
+
643
+ **Template:**
644
+
645
+ ```text
646
+ 🚨 PRODUCTION BUG
647
+
648
+ Severity: CRITICAL
649
+ Impact: Users cannot complete bookings
650
+ Affected: 100% of booking attempts
651
+
652
+ Current Work: Feature - User Favorites (50% complete)
653
+
654
+ Decision: PAUSE FEATURE
655
+ 1. Commit current work to main (atomic commits)
656
+ 2. Fix critical bug immediately
657
+ 3. Test and deploy hotfix
658
+ 4. Resume favorites feature
659
+
660
+ Current task (PB-006) will be delayed by ~4 hours.
661
+
662
+ Pausing feature work, switching to hotfix...
663
+ ```
664
+
665
+ ### Edge Case 18: Requirements Change Mid-Implementation
666
+
667
+ **Scenario:** User changes requirements after Phase 2 started
668
+
669
+ **Resolution:**
670
+
671
+ 1. **Assess** impact:
672
+ - **Small**: Adjust current task
673
+ - **Medium**: Add new tasks to Phase 2
674
+ - **Large**: Stop and re-plan
675
+ 2. **Update** PDR and TODOs if accepting change
676
+ 3. **Inform** of timeline impact
677
+
678
+ **Template:**
679
+
680
+ ```text
681
+ 🔄 Requirements Change
682
+
683
+ Original: "Users can favorite up to 50 entitys"
684
+ New: "Users can organize favorites into lists (unlimited)"
685
+
686
+ Current Progress: 60% (8/13 tasks complete)
687
+ Impact: SIGNIFICANT
688
+
689
+ Analysis:
690
+ - Requires new table: `favorite_lists`
691
+ - New API endpoints for list management
692
+ - UI changes for list organization
693
+ - +10-15 hours additional work
694
+
695
+ Options:
696
+ 1. STOP and re-plan (recommended for large changes)
697
+ - Pro: Proper planning, better architecture
698
+ - Con: Delay current feature
699
+
700
+ 2. Continue with Phase 2 approach
701
+ - Complete current "simple favorites"
702
+ - Plan "favorite lists" as Phase 2
703
+ - Pro: Deliver value incrementally
704
+
705
+ 3. Hybrid: Add minimal lists support
706
+ - Single "default" list now
707
+ - Multiple lists later
708
+ - Pro: Some benefit, manageable scope
709
+
710
+ Recommendation: Option 2 (phased approach)
711
+
712
+ Your decision?
713
+ ```
714
+
715
+ ### Edge Case 19: Team Member Unavailable
716
+
717
+ **Scenario:** Agent or specialist needed but not available
718
+
719
+ **Example:** Database engineer needed for complex migration but unavailable
720
+
721
+ **Resolution:**
722
+
723
+ 1. **Check** if task can be done by another agent with guidance
724
+ 2. **Consult** tech-lead for architecture decisions
725
+ 3. **Pause** task if requires specific expertise
726
+ 4. **Document** blocker and adjust timeline
727
+
728
+ **Template:**
729
+
730
+ ```text
731
+ ⚠️ Resource Unavailable
732
+
733
+ Task: PB-003 (Complex database migration with triggers)
734
+ Requires: @db-engineer
735
+ Status: Not available (on leave)
736
+
737
+ Options:
738
+ 1. PAUSE task until db-engineer returns (ETA: 3 days)
739
+ 2. Have @hono-engineer tackle with tech-lead guidance
740
+ 3. Simplify migration to avoid triggers (defer complexity)
741
+
742
+ Current Impact:
743
+ - 3 tasks blocked (PB-004, PB-005, PB-006 depend on PB-003)
744
+ - Can work on independent tasks: PB-007, PB-008
745
+
746
+ Recommendation: Option 3 + adjust timeline
747
+ - Simplify migration for now
748
+ - Create future task for optimization
749
+
750
+ Proceed?
751
+ ```
752
+
753
+ ### Edge Case 20: Disagreement Between Agents
754
+
755
+ **Scenario:** Tech-lead and architect disagree on approach
756
+
757
+ **Resolution:**
758
+
759
+ 1. **Present** both viewpoints to user
760
+ 2. **List** pros/cons of each approach
761
+ 3. **User decides** final direction
762
+ 4. **Document** decision and rationale
763
+
764
+ **Template:**
765
+
766
+ ```text
767
+ 🤔 Architecture Decision Needed
768
+
769
+ Disagreement: Caching strategy for search results
770
+
771
+ **tech-lead's View:**
772
+ Use Redis for caching
773
+ - Pros: Fast, proven, separate concern
774
+ - Cons: Additional infrastructure, cost
775
+ - Complexity: Medium
776
+
777
+ **product-technical's View:**
778
+ Use in-memory caching (Node.js)
779
+ - Pros: Simple, no extra infra, free
780
+ - Cons: Lost on restart, limited by memory
781
+ - Complexity: Low
782
+
783
+ **Context:**
784
+ - Expected: 1000 searches/day
785
+ - Cache TTL: 5 minutes
786
+ - Data size: ~5MB total
787
+
788
+ **My Analysis:**
789
+ For current scale, in-memory sufficient.
790
+ Redis when > 10K searches/day.
791
+
792
+ **Recommendation:** Start with in-memory, plan Redis migration
793
+
794
+ Both approaches are valid. Your preference?
795
+ ```
796
+
797
+ ---
798
+
799
+ ## General Principles for Edge Cases
800
+
801
+ ### 1. Always Communicate
802
+
803
+ - **Never** silently work around issues
804
+ - **Always** inform user of blockers or changes
805
+ - **Document** all decisions and rationale
806
+
807
+ ### 2. Prefer Explicit Over Implicit
808
+
809
+ - **Ask** when uncertain
810
+ - **Present** options with analysis
811
+ - **Get** confirmation before deviating from plan
812
+
813
+ ### 3. Maintain Quality Standards
814
+
815
+ - **Never** skip tests to save time
816
+ - **Never** commit broken code
817
+ - **Never** lower quality bars without approval
818
+
819
+ ### 4. Document Everything
820
+
821
+ - **Update** PDR, tech-analysis, TODOs when things change
822
+ - **Track** decisions in docs
823
+ - **Note** edge cases for future reference
824
+
825
+ ### 5. Escalate When Appropriate
826
+
827
+ - **Technical**: Escalate to tech-lead
828
+ - **Product**: Escalate to user
829
+ - **Blocking**: Escalate immediately
830
+ - **Non-blocking**: Document and continue
831
+
832
+ ---
833
+
834
+ ## Quick Reference
835
+
836
+ | Situation | Severity | Action |
837
+ |-----------|----------|--------|
838
+ | Unclear requirements | Medium | AskUserQuestion, present options |
839
+ | Missing credentials | High | Document blocker, pause if critical |
840
+ | Test failures (related) | Medium | Fix as part of current task |
841
+ | Test failures (unrelated) | Low | Create separate bug task |
842
+ | Wrong estimate | Medium | Update timeline, inform user |
843
+ | Merge conflict | Medium | Resolve carefully, ask if complex |
844
+ | Dependency breaking change | Low | Pin version, defer upgrade |
845
+ | Performance regression | High | Fix before merging |
846
+ | Security vulnerability | CRITICAL | Stop everything, fix immediately |
847
+ | Production bug | CRITICAL | Pause feature, hotfix |
848
+ | Requirements change | Varies | Assess impact, present options |
849
+
850
+ ---
851
+
852
+ *This document covers common edge cases. For scenarios not listed, follow general principles: communicate, document, and escalate when needed.*
853
+
854
+ ---
855
+
856
+ Last updated: 2025-11-03