mycontext-cli 1.0.84 → 1.0.85

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.
@@ -72,20 +72,24 @@ class GenerateContextFilesCommand {
72
72
  await this.generateUserFlowsFile(contextDir, contextContent);
73
73
  await this.generateEdgeCasesFile(contextDir, contextContent);
74
74
  await this.generateTechnicalSpecsFile(contextDir, contextContent);
75
- logger_1.logger.success("Context Files Generated Successfully!");
76
- logger_1.logger.verbose("Generated files:");
77
- logger_1.logger.verbose(" • 01a-features.md - Product features and capabilities");
78
- logger_1.logger.verbose(" • 01b-user-flows.md - User journey maps and interactions");
79
- logger_1.logger.verbose(" • 01c-edge-cases.md - Error scenarios and edge conditions");
80
- logger_1.logger.verbose(" • 01d-technical-specs.md - Architecture and technical requirements");
81
- logger_1.logger.step("Next Steps:");
82
- logger_1.logger.info("1. Review and refine the generated context files");
83
- logger_1.logger.info("2. Run 'mycontext compile-prd' to generate the PRD");
84
- logger_1.logger.verbose("3. Run 'mycontext generate types' to generate TypeScript types");
85
- logger_1.logger.verbose("4. Run 'mycontext generate brand-kit' to create brand guidelines");
86
- logger_1.logger.verbose("5. Run 'mycontext generate components-list' to plan components");
87
- logger_1.logger.verbose("6. Run 'mycontext generate-components all --local --with-tests' to generate components");
88
- this.spinner.succeed("Context files generated successfully!");
75
+ logger_1.logger.success("User-Centric Context Documentation Generated Successfully!");
76
+ logger_1.logger.verbose("Generated user interaction documentation files:");
77
+ logger_1.logger.verbose(" • 01a-features.md - Every user action and system response");
78
+ logger_1.logger.verbose(" • 01b-user-flows.md - Complete user journey interactions");
79
+ logger_1.logger.verbose(" • 01c-edge-cases.md - User error scenarios and recovery paths");
80
+ logger_1.logger.verbose(" • 01d-technical-specs.md - Technical details supporting user experience");
81
+ logger_1.logger.step("🚨 CRITICAL NEXT STEP - Human-in-the-Loop Validation:");
82
+ logger_1.logger.info("1. 📖 Read each context file carefully - AI might miss requirements");
83
+ logger_1.logger.info("2. ✏️ Edit files to correct mistakes and add missing business logic");
84
+ logger_1.logger.info("3. 🎯 Add specific requirements AI doesn't know about your domain");
85
+ logger_1.logger.info("4. 🔍 Clarify ambiguous areas and remove irrelevant content");
86
+ logger_1.logger.step("💡 This is why MyContext works - you ensure accuracy at the source!");
87
+ logger_1.logger.info("5. Run 'mycontext compile-prd' when satisfied with context files");
88
+ logger_1.logger.verbose("6. Run 'mycontext generate types' to generate TypeScript types");
89
+ logger_1.logger.verbose("7. Run 'mycontext generate brand-kit' to create brand guidelines");
90
+ logger_1.logger.verbose("8. Run 'mycontext generate components-list' to plan components");
91
+ logger_1.logger.verbose("9. Run 'mycontext generate-components all --with-tests' to generate components from your corrected context");
92
+ this.spinner.succeed("User-centric context documentation generated successfully!");
89
93
  }
90
94
  catch (error) {
91
95
  this.spinner.fail("Context file generation failed");
@@ -124,10 +128,10 @@ class GenerateContextFilesCommand {
124
128
  });
125
129
  const content = this.formatFeaturesContent(response.text);
126
130
  await fs.writeFile(path_1.default.join(contextDir, "01a-features.md"), content);
127
- console.log(chalk_1.default.green(" ✅ Features generated"));
131
+ console.log(chalk_1.default.green(" ✅ User interactions documented"));
128
132
  }
129
133
  catch (error) {
130
- console.log(chalk_1.default.red(" ❌ Features generation failed"));
134
+ console.log(chalk_1.default.red(" ❌ User interactions documentation failed"));
131
135
  throw error;
132
136
  }
133
137
  }
@@ -147,10 +151,10 @@ class GenerateContextFilesCommand {
147
151
  });
148
152
  const content = this.formatUserFlowsContent(response.text);
149
153
  await fs.writeFile(path_1.default.join(contextDir, "01b-user-flows.md"), content);
150
- console.log(chalk_1.default.green(" ✅ User flows generated"));
154
+ console.log(chalk_1.default.green(" ✅ User interaction flows documented"));
151
155
  }
152
156
  catch (error) {
153
- console.log(chalk_1.default.red(" ❌ User flows generation failed"));
157
+ console.log(chalk_1.default.red(" ❌ User interaction flows documentation failed"));
154
158
  throw error;
155
159
  }
156
160
  }
@@ -170,10 +174,10 @@ class GenerateContextFilesCommand {
170
174
  });
171
175
  const content = this.formatEdgeCasesContent(response.text);
172
176
  await fs.writeFile(path_1.default.join(contextDir, "01c-edge-cases.md"), content);
173
- console.log(chalk_1.default.green(" ✅ Edge cases generated"));
177
+ console.log(chalk_1.default.green(" ✅ User error scenarios documented"));
174
178
  }
175
179
  catch (error) {
176
- console.log(chalk_1.default.red(" ❌ Edge cases generation failed"));
180
+ console.log(chalk_1.default.red(" ❌ User error scenarios documentation failed"));
177
181
  throw error;
178
182
  }
179
183
  }
@@ -193,25 +197,103 @@ class GenerateContextFilesCommand {
193
197
  });
194
198
  const content = this.formatTechnicalSpecsContent(response.text);
195
199
  await fs.writeFile(path_1.default.join(contextDir, "01d-technical-specs.md"), content);
196
- console.log(chalk_1.default.green(" ✅ Technical specs generated"));
200
+ console.log(chalk_1.default.green(" ✅ Technical implementation documented"));
197
201
  }
198
202
  catch (error) {
199
- console.log(chalk_1.default.red(" ❌ Technical specs generation failed"));
203
+ console.log(chalk_1.default.red(" ❌ Technical implementation documentation failed"));
200
204
  throw error;
201
205
  }
202
206
  }
203
207
  buildFeaturesPrompt(contextContent) {
204
- return `You are a product manager creating a comprehensive features document for a web application.
208
+ return `You are a user experience researcher documenting every user interaction for a web application.
205
209
 
206
- ${contextContent ? `Project Context (from PRD): ${contextContent}` : "Generate features for a modern web application."}
210
+ ${contextContent ? `Project Context: ${contextContent}` : "Generate user interaction documentation for a modern web application."}
207
211
 
208
- Create a detailed features document that includes:
212
+ Create a comprehensive user-centric features document that documents every user interaction:
209
213
 
210
- 1. **Core Features** - Primary functionality that defines the product
211
- 2. **User Features** - Features that directly benefit end users
212
- 3. **Admin Features** - Administrative and management capabilities
213
- 4. **Technical Features** - Backend, API, and infrastructure features
214
- 5. **Integration Features** - Third-party integrations and APIs
214
+ ## 🎯 **User-Centric Features Documentation**
215
+
216
+ ### **What Users Can Do (User Actions)**
217
+ Document every action users can take in the application:
218
+
219
+ **❌ Don't write technical specs:**
220
+ - User authentication system
221
+ - Shopping cart functionality
222
+ - Payment processing
223
+
224
+ **✅ Write user interactions:**
225
+ - User can click "Sign Up" to create an account
226
+ - User can browse products by category and search
227
+ - User can add items to cart with quantity selection
228
+ - User can complete checkout with multiple payment options
229
+ - User can view order history and track deliveries
230
+
231
+ ### **What Users See (System Responses)**
232
+ Document what users see after each action:
233
+
234
+ **❌ Don't write:**
235
+ - Dashboard displays user profile
236
+ - Products show in grid layout
237
+
238
+ **✅ Write:**
239
+ - After login, user sees personalized dashboard with recent orders
240
+ - Product catalog shows items with images, prices, and "Add to Cart" buttons
241
+ - Shopping cart displays items with quantity controls and remove options
242
+ - Checkout form shows shipping address, payment method, and order summary
243
+ - Order confirmation page displays order number, estimated delivery, and tracking info
244
+
245
+ ### **User Journey Documentation**
246
+ Document complete user journeys from start to finish:
247
+
248
+ 1. **New User Onboarding**
249
+ - User visits homepage → sees hero section with "Get Started" button
250
+ - User clicks "Get Started" → registration form appears
251
+ - User fills out form → email verification sent
252
+ - User verifies email → redirected to dashboard
253
+
254
+ 2. **Product Purchase Flow**
255
+ - User browses catalog → sees product grid with filters
256
+ - User selects product → product detail page with reviews
257
+ - User adds to cart → cart shows item count in header
258
+ - User checks out → payment form with saved addresses
259
+
260
+ ### **User Feedback and States**
261
+ Document what users see in different states:
262
+
263
+ **Success States:**
264
+ - Registration successful → welcome message with next steps
265
+ - Order placed → confirmation with order number and tracking
266
+ - Payment processed → receipt with download option
267
+
268
+ **Error States:**
269
+ - Login failed → error message with "Forgot password?" link
270
+ - Out of stock → "Notify when available" option
271
+ - Payment declined → retry form with error explanation
272
+
273
+ **Loading States:**
274
+ - Page loading → skeleton screens matching final layout
275
+ - Form submitting → disabled inputs with progress indicator
276
+ - Image loading → placeholder with smooth transition
277
+
278
+ ### **User Interactions by Role**
279
+ Document interactions for different user types:
280
+
281
+ **Guest Users:**
282
+ - Can browse products and read reviews
283
+ - Can add items to cart (requires registration to checkout)
284
+ - Can view help documentation and contact support
285
+
286
+ **Registered Users:**
287
+ - Can save payment methods and addresses
288
+ - Can view order history and reorder items
289
+ - Can update profile and preferences
290
+ - Can leave reviews and ratings
291
+
292
+ **Admin Users:**
293
+ - Can manage products and inventory
294
+ - Can view user analytics and reports
295
+ - Can process refunds and handle support
296
+ - Can update site content and settings
215
297
  6. **Security Features** - Authentication, authorization, and data protection
216
298
  7. **Performance Features** - Optimization and scalability features
217
299
  8. **Accessibility Features** - WCAG compliance and inclusive design
@@ -226,86 +308,356 @@ For each feature, include:
226
308
  Format the output as a well-structured markdown document with clear sections and bullet points.`;
227
309
  }
228
310
  buildUserFlowsPrompt(contextContent) {
229
- return `You are a UX designer creating comprehensive user flow documentation for a web application.
311
+ return `You are a user experience researcher documenting every user interaction and system response for a web application.
312
+
313
+ ${contextContent ? `Project Context: ${contextContent}` : "Generate user interaction flows for a modern web application."}
314
+
315
+ Create comprehensive user-centric flow documentation that captures every user interaction:
316
+
317
+ ## 🎯 **User Interaction Flow Documentation**
318
+
319
+ ### **Document Every User Action → System Response**
230
320
 
231
- ${contextContent ? `Project Context (from PRD): ${contextContent}` : "Generate user flows for a modern web application."}
321
+ **❌ Don't write technical flows:**
322
+ - User navigates to login page
323
+ - System validates credentials
324
+ - User is redirected
232
325
 
233
- Create detailed user flow documentation that includes:
326
+ **✅ Write complete user interactions:**
327
+ - User clicks "Login" button in navigation → login form appears with email and password fields
328
+ - User enters email and clicks "Continue" → password field appears with "Show/Hide" toggle
329
+ - User enters password and clicks "Sign In" → loading spinner shows for 2 seconds
330
+ - User sees error message "Invalid credentials" with "Forgot password?" link → can click link to reset password
331
+ - User clicks "Forgot password?" → reset form appears with email field and "Send reset link" button
332
+ - User enters email and clicks "Send reset link" → success message "Check your email for reset instructions"
234
333
 
235
- 1. **Primary User Journeys** - Main user paths through the application
236
- 2. **Authentication Flows** - Login, signup, password reset, etc.
237
- 3. **Core Feature Flows** - How users interact with main features
238
- 4. **Error Handling Flows** - What happens when things go wrong
239
- 5. **Admin/Management Flows** - Administrative user journeys
240
- 6. **Mobile vs Desktop Flows** - Responsive design considerations
241
- 7. **Accessibility Flows** - Screen reader and keyboard navigation paths
334
+ ### **Complete User Journey Documentation**
335
+ Document every step users take and what they see:
242
336
 
243
- For each flow, include:
244
- - Flow name and description
245
- - Step-by-step user actions
246
- - System responses and feedback
247
- - Decision points and branches
248
- - Error states and recovery
249
- - Success criteria
337
+ 1. **Homepage Interaction Flow**
338
+ - User visits homepage → sees hero section with "Get Started" button
339
+ - User clicks "Get Started" → registration form slides in from right
340
+ - User sees form with name, email, password fields → each field has validation
341
+ - User fills out form with valid data → "Create Account" button becomes enabled
342
+ - User clicks "Create Account" → loading state with "Creating your account..."
343
+ - User sees success message "Account created! Please check your email to verify"
250
344
 
251
- Format the output as a well-structured markdown document with clear sections, numbered steps, and flow diagrams in text format.`;
345
+ 2. **Product Browsing Flow**
346
+ - User visits products page → sees filter sidebar and product grid
347
+ - User clicks category filter → products update instantly with smooth animation
348
+ - User searches for "wireless headphones" → search results appear with suggestions
349
+ - User clicks on product image → product detail page loads with image gallery
350
+ - User clicks "Add to Cart" → cart icon in header shows "1" and success toast appears
351
+ - User clicks cart icon → cart dropdown opens showing added item with quantity controls
352
+
353
+ 3. **Checkout Process Flow**
354
+ - User clicks "Checkout" → shipping address form appears with saved addresses
355
+ - User selects address or fills new one → payment method selection appears
356
+ - User chooses payment method → payment form loads with security indicators
357
+ - User enters payment details → order summary updates with totals and fees
358
+ - User clicks "Complete Order" → processing animation with progress steps
359
+ - User sees order confirmation → with order number, tracking info, and "Download receipt" button
360
+
361
+ ### **User Feedback Documentation**
362
+ Document what users see in every state:
363
+
364
+ **Success Feedback:**
365
+ - Form submitted successfully → green checkmark with "Success!" message
366
+ - Item added to cart → toast notification "Added to cart" with item name
367
+ - Order completed → confetti animation with "Order confirmed!" message
368
+ - Email sent → blue info banner "Check your email for next steps"
369
+
370
+ **Error Feedback:**
371
+ - Invalid email format → red error under field "Please enter a valid email"
372
+ - Network error → retry banner "Connection lost. Please check your internet"
373
+ - Payment failed → error card "Payment declined. Please try another card"
374
+ - Session expired → redirect to login with "Please log in again" message
375
+
376
+ **Loading Feedback:**
377
+ - Page loading → skeleton screens matching the final layout
378
+ - Form submitting → disabled inputs with pulsing "Processing..." button
379
+ - Image loading → blur placeholder that sharpens when loaded
380
+ - Search loading → "Searching..." with animated dots
381
+
382
+ ### **User Decision Points**
383
+ Document where users make choices and what happens:
384
+
385
+ **Navigation Choices:**
386
+ - User clicks "Products" → product catalog loads with filters visible
387
+ - User clicks "Categories" → category page with subcategories and breadcrumbs
388
+ - User clicks "Profile" → account settings with tabs for different sections
389
+ - User clicks "Help" → help center with search and popular topics
390
+
391
+ **Feature Choices:**
392
+ - User can choose "Express checkout" → skips shipping form and uses defaults
393
+ - User can select "Guest checkout" → creates account automatically after purchase
394
+ - User can choose "Save for later" → item moves to wishlist instead of cart
395
+ - User can select "Notify me" → gets alerts when out-of-stock items return
396
+
397
+ **Preference Choices:**
398
+ - User can toggle "Dark mode" → entire interface switches theme instantly
399
+ - User can select "Language" → content translates with loading indicator
400
+ - User can choose "Notifications" → settings panel with granular options
401
+ - User can set "Privacy" → different levels affect what data is collected
402
+
403
+ ### **User Error Recovery**
404
+ Document how users recover from mistakes:
405
+
406
+ **Input Errors:**
407
+ - User enters invalid email → field highlights red with helpful message
408
+ - User leaves required field empty → "This field is required" appears on blur
409
+ - User enters weak password → strength meter shows with improvement tips
410
+ - User selects invalid date → calendar widget shows available dates
411
+
412
+ **System Errors:**
413
+ - Server error during save → retry button with "Try again" and exponential backoff
414
+ - Network timeout → offline banner with "Reconnecting..." and auto-retry
415
+ - File upload fails → drag-and-drop area shows "Upload failed. Try again?"
416
+ - Payment processing error → clear error message with support contact info
417
+
418
+ **User Actions:**
419
+ - User can click "Cancel" at any time → confirmation dialog "Discard changes?"
420
+ - User can use "Back" button → returns to previous state without data loss
421
+ - User can click "Help" icons → contextual help appears without leaving flow
422
+ - User can contact support → chat widget opens with conversation context
423
+
424
+ Format the output as a well-structured markdown document with clear sections and numbered steps.`;
252
425
  }
253
426
  buildEdgeCasesPrompt(contextContent) {
254
- return `You are a QA engineer creating comprehensive edge cases and error scenarios documentation for a web application.
255
-
256
- ${contextContent ? `Project Context (from PRD): ${contextContent}` : "Generate edge cases for a modern web application."}
257
-
258
- Create detailed edge cases documentation that includes:
259
-
260
- 1. **Input Validation Edge Cases** - Invalid, malformed, or extreme input scenarios
261
- 2. **Network Edge Cases** - Offline, slow connections, timeouts, API failures
262
- 3. **Browser Edge Cases** - Different browsers, versions, disabled features
263
- 4. **Device Edge Cases** - Mobile, tablet, desktop, different screen sizes
264
- 5. **Data Edge Cases** - Empty data, large datasets, concurrent modifications
265
- 6. **Security Edge Cases** - Injection attacks, XSS, CSRF, unauthorized access
266
- 7. **Performance Edge Cases** - High load, memory constraints, slow operations
267
- 8. **Accessibility Edge Cases** - Screen readers, keyboard-only navigation, high contrast
268
- 9. **Integration Edge Cases** - Third-party service failures, API changes
269
- 10. **Business Logic Edge Cases** - Boundary conditions, race conditions
270
-
271
- For each edge case, include:
272
- - Scenario description
273
- - Expected behavior
274
- - Potential impact
275
- - Mitigation strategies
276
- - Testing approach
427
+ return `You are a user experience researcher documenting error scenarios and edge cases from the user's perspective.
428
+
429
+ ${contextContent ? `Project Context: ${contextContent}` : "Generate user error scenarios for a modern web application."}
430
+
431
+ Create comprehensive user-centric error documentation that captures what users experience when things go wrong:
432
+
433
+ ## 🎯 **User-Centric Error Scenarios Documentation**
434
+
435
+ ### **Document What Users See When Errors Happen**
436
+
437
+ **❌ Don't write technical edge cases:**
438
+ - Network timeout after 30 seconds
439
+ - Invalid input validation failure
440
+ - Database connection error
441
+
442
+ **✅ Write user experiences:**
443
+ - User clicks "Save" → sees "Saving..." for 5 seconds → gets "Connection lost. Please check your internet" message
444
+ - User enters email without @ → field turns red → "Please enter a valid email address" appears below field
445
+ - User tries to login with wrong password → "Invalid credentials" message appears → "Forgot password?" link becomes clickable
446
+
447
+ ### **User Error Recovery Documentation**
448
+ Document how users recover from different error scenarios:
449
+
450
+ 1. **Network Issues**
451
+ - User clicks "Submit form" → sees loading spinner → connection drops
452
+ - User sees "Connection lost" banner with "Reconnecting..." message
453
+ - After 10 seconds, user sees "Connection restored" with auto-retry
454
+ - User can click "Retry now" to manually retry or "Try again later" to save draft
455
+
456
+ 2. **Input Validation Errors**
457
+ - User enters phone number "123" → field highlights red → "Phone number must be at least 10 digits"
458
+ - User leaves required field empty → clicks "Next" → form scrolls to empty field with red border
459
+ - User enters password "123" → strength meter shows red → "Password must be at least 8 characters"
460
+ - User enters mismatched passwords → confirmation field shows "Passwords don't match"
461
+
462
+ 3. **Authentication Errors**
463
+ - User clicks "Sign In" → loading spinner appears → "Invalid email or password" message shows
464
+ - User sees "Forgot password?" link → clicks it → reset form loads with email field
465
+ - User enters unregistered email for password reset → "No account found with that email" appears
466
+ - User enters registered email → "Reset instructions sent" with "Check your email" message
467
+
468
+ 4. **Payment Errors**
469
+ - User clicks "Complete payment" → processing animation starts → "Payment declined" message appears
470
+ - User sees "Please try another payment method" with card form → can select saved cards or add new
471
+ - User enters expired card → "Card expired. Please use a different card" with date validation
472
+ - User enters insufficient funds → "Insufficient funds" with suggestion to use different payment method
473
+
474
+ 5. **Data Loading Errors**
475
+ - User opens product page → sees skeleton loading → "Failed to load product information" message
476
+ - User clicks "Load more" → loading spinner appears → "Connection timeout. Try again?" message
477
+ - User searches for products → search bar shows "Searching..." → "No results found" with suggestions
478
+ - User opens cart → sees "Loading cart..." → "Your cart is empty" or "Failed to load cart items"
479
+
480
+ 6. **File Upload Errors**
481
+ - User drags file to upload area → sees "Uploading..." → "File too large (max 10MB)" message
482
+ - User selects unsupported file type → "Unsupported file type. Please use JPG, PNG, or PDF"
483
+ - User tries to upload during network issue → "Upload failed due to connection issues" with retry
484
+ - User uploads corrupted file → "File appears to be corrupted. Please try again"
485
+
486
+ 7. **Session Management Errors**
487
+ - User tries to access protected page → sees "Session expired. Please log in again" modal
488
+ - User clicks "Stay logged in" → redirected to login form with "Re-login required" message
489
+ - User logs in from new device → sees "Login from unrecognized device" with security options
490
+ - User has multiple tabs open → one tab shows "Account accessed from another location"
491
+
492
+ 8. **Browser/Device Compatibility**
493
+ - User on old browser → sees "Your browser is not supported. Please update to latest version"
494
+ - User on mobile device → sees "This feature works best on desktop" with mobile-optimized version
495
+ - User with JavaScript disabled → sees "JavaScript required for this feature to work"
496
+ - User with slow connection → sees "Loading slowly? Try our mobile app for better performance"
497
+
498
+ 9. **Business Logic Errors**
499
+ - User tries to buy out-of-stock item → sees "Out of stock" with "Notify when available" option
500
+ - User applies expired coupon → sees "Coupon expired" with suggestion to use current offers
501
+ - User tries to access admin area without permission → sees "Access denied" with contact info
502
+ - User reaches usage limits → sees "You've reached your monthly limit" with upgrade options
503
+
504
+ 10. **Third-Party Integration Errors**
505
+ - User tries to login with Google → sees "Google login temporarily unavailable" with email option
506
+ - User pays with PayPal → sees "PayPal service unavailable" with alternative payment methods
507
+ - User shares on social media → sees "Unable to connect to [platform]" with manual share option
508
+ - User gets email notifications → sees "Notification service issue" with settings to check preferences
509
+
510
+ ### **User Feedback and Recovery Patterns**
511
+ Document consistent patterns for error handling:
512
+
513
+ **Error Message Guidelines:**
514
+ - Always explain what went wrong in user-friendly language
515
+ - Suggest next steps or alternatives when possible
516
+ - Provide contact information for complex issues
517
+ - Use consistent visual styling (red borders, warning icons)
518
+
519
+ **Recovery Action Guidelines:**
520
+ - Offer retry options with clear labels ("Try again", "Retry", "Refresh")
521
+ - Provide alternative paths when primary action fails
522
+ - Save user progress when possible (drafts, partial forms)
523
+ - Allow users to go back without losing data
524
+
525
+ **Loading State Guidelines:**
526
+ - Show progress indicators for long operations
527
+ - Disable inputs during processing to prevent double-submission
528
+ - Provide cancel options for non-critical operations
529
+ - Use skeleton screens that match final layout
530
+
531
+ **Help and Support Guidelines:**
532
+ - Contextual help available without leaving current flow
533
+ - Clear escalation paths for complex issues
534
+ - Self-service options before contacting support
535
+ - Preserve context when transferring to support
277
536
 
278
537
  Format the output as a well-structured markdown document with clear sections and detailed scenarios.`;
279
538
  }
280
539
  buildTechnicalSpecsPrompt(contextContent) {
281
- return `You are a technical architect creating comprehensive technical specifications for a web application.
282
-
283
- ${contextContent ? `Project Context (from PRD): ${contextContent}` : "Generate technical specs for a modern web application."}
284
-
285
- Create detailed technical specifications that include:
286
-
287
- 1. **Architecture Overview** - System design, components, and relationships
288
- 2. **Technology Stack** - Frontend, backend, database, deployment technologies
289
- 3. **API Specifications** - Endpoints, request/response formats, authentication
290
- 4. **Database Design** - Schema, relationships, indexing, data flow
291
- 5. **Security Requirements** - Authentication, authorization, data protection
292
- 6. **Performance Requirements** - Response times, throughput, scalability
293
- 7. **Deployment Architecture** - Infrastructure, CI/CD, monitoring
294
- 8. **Integration Requirements** - Third-party services, APIs, webhooks
295
- 9. **Development Standards** - Code style, testing, documentation
296
- 10. **Monitoring and Logging** - Error tracking, analytics, performance monitoring
297
-
298
- For each specification, include:
299
- - Requirement description
300
- - Technical approach
301
- - Implementation details
302
- - Dependencies
303
- - Success criteria
304
-
305
- Format the output as a well-structured markdown document with clear sections and technical details.`;
540
+ return `You are a user experience researcher documenting technical implementation details from the user's perspective.
541
+
542
+ ${contextContent ? `Project Context: ${contextContent}` : "Generate technical implementation details for a modern web application."}
543
+
544
+ Create user-centric technical documentation that explains how the system works behind the scenes to support user interactions:
545
+
546
+ ## 🎯 **User-Centric Technical Implementation Documentation**
547
+
548
+ ### **Document Technical Details That Support User Experiences**
549
+
550
+ **❌ Don't write abstract technical specs:**
551
+ - React 18 with Next.js 14
552
+ - PostgreSQL database with Prisma ORM
553
+ - JWT authentication with refresh tokens
554
+
555
+ **✅ Write user-focused technical details:**
556
+ - Pages load instantly with React Server Components → users see content immediately without loading delays
557
+ - Database queries optimized for product catalog → users can browse thousands of products with instant search
558
+ - Authentication tokens automatically refreshed → users stay logged in even after browser restart
559
+ - Images served via CDN → users see product photos instantly even on slow connections
560
+
561
+ ### **User Performance Documentation**
562
+ Document how technical choices affect user experience:
563
+
564
+ 1. **Loading Performance**
565
+ - Homepage loads in <2 seconds → users see hero content immediately
566
+ - Product images load progressively → users see low-res preview first, then full quality
567
+ - Search results appear in <100ms → users get instant feedback as they type
568
+ - Page transitions use client-side routing → users navigate without full page reloads
569
+
570
+ 2. **Responsive Design Implementation**
571
+ - CSS Grid and Flexbox for flexible layouts → users see properly aligned content on any screen size
572
+ - Mobile-first responsive breakpoints → users get optimized experience on phones and tablets
573
+ - Touch-friendly interaction targets → users can easily tap buttons and links on mobile
574
+ - Keyboard navigation support → users can navigate entirely with keyboard if needed
575
+
576
+ 3. **Accessibility Implementation**
577
+ - ARIA labels and semantic HTML → screen readers announce content correctly to users
578
+ - High contrast color schemes → users with visual impairments can read all text
579
+ - Keyboard shortcuts for common actions → power users can navigate efficiently
580
+ - Focus management for complex interactions → users never lose their place in forms
581
+
582
+ 4. **Error Handling Implementation**
583
+ - Graceful degradation for failed requests → users see helpful messages instead of blank pages
584
+ - Retry mechanisms with exponential backoff → users get automatic recovery from temporary issues
585
+ - Offline detection and messaging → users understand when connection issues occur
586
+ - Fallback content for missing data → users see alternative content when primary data fails to load
587
+
588
+ 5. **Security Implementation**
589
+ - HTTPS encryption for all data → users' personal information is protected in transit
590
+ - CSRF protection on forms → users' actions are protected from cross-site attacks
591
+ - XSS prevention measures → users' data is safe from script injection attacks
592
+ - Secure password hashing → users' credentials are protected even if database is compromised
593
+
594
+ 6. **Data Management Implementation**
595
+ - Real-time data synchronization → users see live updates without refreshing
596
+ - Optimistic UI updates → users see immediate feedback while server processes requests
597
+ - Conflict resolution for concurrent edits → users' changes are preserved when multiple people edit
598
+ - Data validation on client and server → users get immediate feedback on invalid input
599
+
600
+ 7. **Integration Implementation**
601
+ - Payment processor integration → users can complete purchases securely
602
+ - Email service integration → users receive order confirmations and notifications
603
+ - Analytics tracking → user behavior is measured to improve experience
604
+ - Social media integration → users can share products with their networks
605
+
606
+ 8. **Performance Optimization**
607
+ - Code splitting for faster loading → users only download code they need for current page
608
+ - Image optimization and lazy loading → users see optimized images without waiting
609
+ - Caching strategies for repeat visits → returning users get even faster experience
610
+ - Bundle optimization → users download minimal JavaScript for fast execution
611
+
612
+ 9. **Monitoring and Analytics**
613
+ - User interaction tracking → understand how users navigate and where they get stuck
614
+ - Performance monitoring → identify slow pages and optimize user experience
615
+ - Error tracking → quickly identify and fix issues affecting users
616
+ - A/B testing framework → test different approaches to improve user experience
617
+
618
+ 10. **Scalability Considerations**
619
+ - Horizontal scaling capabilities → handle traffic spikes without user impact
620
+ - Database optimization → maintain performance as user base grows
621
+ - CDN integration → serve content quickly to users worldwide
622
+ - Rate limiting protection → prevent abuse while maintaining service for legitimate users
623
+
624
+ ### **Technical Implementation Guidelines**
625
+ Document how technical choices support user needs:
626
+
627
+ **User Experience Priority:**
628
+ - Always prioritize user experience over technical complexity
629
+ - Choose technologies that enable smooth, fast user interactions
630
+ - Implement graceful fallbacks for when things go wrong
631
+ - Monitor real user impact of technical changes
632
+
633
+ **Performance First:**
634
+ - Optimize for perceived performance (what users actually experience)
635
+ - Use loading states and progress indicators
636
+ - Implement skeleton screens that match final layouts
637
+ - Cache intelligently to improve repeat visit performance
638
+
639
+ **Accessibility by Design:**
640
+ - Build accessibility into components from the start
641
+ - Test with screen readers and keyboard navigation
642
+ - Follow WCAG guidelines for color contrast and interaction
643
+ - Consider users with different abilities and devices
644
+
645
+ **Error Resilience:**
646
+ - Implement comprehensive error handling
647
+ - Provide clear recovery paths for users
648
+ - Use retry mechanisms with user-friendly messaging
649
+ - Log errors for developers while showing helpful messages to users
650
+
651
+ **Security User-Focused:**
652
+ - Protect user data without compromising usability
653
+ - Use security measures that are invisible to users
654
+ - Provide clear security status indicators
655
+ - Balance security with user convenience
656
+
657
+ Format the output as a well-structured markdown document with clear sections and detailed scenarios.`;
306
658
  }
307
659
  formatFeaturesContent(response) {
308
- return `# Product Features
660
+ return `# User-Centric Features Documentation
309
661
 
310
662
  ${response}
311
663
 
@@ -315,7 +667,7 @@ ${response}
315
667
  `;
316
668
  }
317
669
  formatUserFlowsContent(response) {
318
- return `# User Flows
670
+ return `# User Interaction Flows Documentation
319
671
 
320
672
  ${response}
321
673
 
@@ -325,7 +677,7 @@ ${response}
325
677
  `;
326
678
  }
327
679
  formatEdgeCasesContent(response) {
328
- return `# Edge Cases and Error Scenarios
680
+ return `# User Error Scenarios and Recovery Documentation
329
681
 
330
682
  ${response}
331
683
 
@@ -335,7 +687,7 @@ ${response}
335
687
  `;
336
688
  }
337
689
  formatTechnicalSpecsContent(response) {
338
- return `# Technical Specifications
690
+ return `# User-Centric Technical Implementation Documentation
339
691
 
340
692
  ${response}
341
693