gemini-helper-friend 2.0.0 → 2.0.2

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.
@@ -1,13 +1,52 @@
1
1
  # Gemini Helper Friend MCP - Subagent Configuration
2
2
  # YAML for metadata only - prompt templates in MDX files
3
- # Version: 2.0
3
+ # Version: 2.1 - Enhanced descriptions with forcing patterns
4
+ # Optimization: Detailed descriptions that force high-quality, structured prompts
4
5
 
5
- version: "2.0"
6
+ version: "2.1"
6
7
 
7
8
  metadata:
8
9
  name: "gemini-helper-friend-mcp"
9
10
  displayName: "Gemini - Helper Friend MCP"
10
- description: "Autonomous AI helper with specialized task types"
11
+ description: "Autonomous AI helper with specialized task types for code review, research, and testing"
12
+
13
+ # ============================================================================
14
+ # SHARED PRINCIPLES - Apply to ALL task types
15
+ # ============================================================================
16
+ shared:
17
+ core_philosophy: |
18
+ These subagents are designed for COMPREHENSIVE task execution through specialized modes.
19
+ Vague prompts = vague results. Detailed prompts = actionable insights.
20
+
21
+ **CRITICAL:** The quality of output is DIRECTLY proportional to prompt detail.
22
+ - Short prompts (50 chars) → Generic, unhelpful responses
23
+ - Medium prompts (200 chars) → Partially useful responses
24
+ - Detailed prompts (500+ chars) → Specific, actionable insights
25
+
26
+ principles:
27
+ context_is_king: |
28
+ The subagent has NO context about your task except what you provide.
29
+ Assume it knows NOTHING about your codebase, your goals, or your constraints.
30
+ Provide ALL relevant context - files, requirements, what you've tried, what failed.
31
+
32
+ specificity_matters: |
33
+ "Check if it's done" → USELESS
34
+ "Verify Task X against requirements A, B, C using files X, Y, Z" → ACTIONABLE
35
+
36
+ structured_input: |
37
+ Follow the template for each task type. Each section exists for a reason.
38
+ Skipping sections = missing critical context = suboptimal results.
39
+
40
+ workflow_pattern: |
41
+ MANDATORY for all subagent calls:
42
+ 1. GATHER CONTEXT → Collect all relevant files, requirements, constraints
43
+ 2. STRUCTURE PROMPT → Follow the task-specific template (ALL sections!)
44
+ 3. CALL SUBAGENT → Execute with async=true (default) or async=false for quick tasks
45
+ 4. CHECK STATUS → Poll with check_subagent_task until completed
46
+ 5. REVIEW RESULT → Evaluate output, take action on recommendations
47
+
48
+ Why this works: Structured context enables the subagent to provide
49
+ specific, actionable recommendations instead of generic advice.
11
50
 
12
51
  # ============================================================================
13
52
  # GLOBAL SETTINGS
@@ -44,7 +83,25 @@ task_types:
44
83
 
45
84
  completion-inspector:
46
85
  display_name: "Completion Inspector"
47
- description: "CTO-level code inspector that verifies if a task is TRULY 100% complete"
86
+ description: |
87
+ **🔍 CTO-LEVEL CODE INSPECTOR - Verifies if task is TRULY 100% complete**
88
+
89
+ This subagent performs exhaustive verification that your implementation meets ALL requirements,
90
+ follows existing patterns, and leaves no cleanup debt.
91
+
92
+ **What it analyzes:**
93
+ - Git diff (line-by-line change review against requirements)
94
+ - Codebase patterns (consistency with existing code style)
95
+ - Duplicate detection (find similar code that should be abstracted)
96
+ - Quality assessment (identify cleanup opportunities)
97
+ - Requirement coverage (map changes to acceptance criteria)
98
+
99
+ **Output includes:**
100
+ - Completion percentage (0-100%)
101
+ - Requirements checklist (✅ met / ❌ not met)
102
+ - Quality issues found
103
+ - Specific action items with file locations
104
+
48
105
  category: "verification"
49
106
  default_model: "" # Auto-select
50
107
  template_file: "completion-inspector.mdx"
@@ -59,7 +116,31 @@ task_types:
59
116
 
60
117
  helper-friend:
61
118
  display_name: "Helper Friend"
62
- description: "Research companion for deep analysis, bug investigation, and informed decision-making"
119
+ description: |
120
+ **🧠 RESEARCH COMPANION - Deep analysis, bug investigation, informed decisions**
121
+
122
+ This subagent conducts comprehensive research using codebase search, web research,
123
+ deep research with file attachments, and community consensus analysis.
124
+
125
+ **What it does:**
126
+ - Codebase search (understand code structure, find similar patterns)
127
+ - Web research (best practices, documentation, tutorials)
128
+ - Deep research (technical questions with YOUR code as context)
129
+ - Reddit consensus (community experiences, real-world feedback)
130
+
131
+ **Use cases:**
132
+ - 🐛 Bug investigation & root cause analysis
133
+ - 🏗️ Architecture & technology decisions
134
+ - 📚 Codebase understanding & discovery
135
+ - ✅ Best practices & pattern research
136
+ - 🔬 Pre-implementation research
137
+
138
+ **Output includes:**
139
+ - Research findings with sources
140
+ - Recommendations with trade-offs
141
+ - Code examples where applicable
142
+ - Next steps and action items
143
+
63
144
  category: "research"
64
145
  default_model: "" # Auto-select
65
146
  template_file: "helper-friend.mdx"
@@ -80,7 +161,28 @@ task_types:
80
161
 
81
162
  manual-tester:
82
163
  display_name: "Manual Tester"
83
- description: "QA engineer who manually tests implementation using real Chrome browser and terminal"
164
+ description: |
165
+ **🧪 QA ENGINEER - Tests implementation using REAL Chrome browser and terminal**
166
+
167
+ This subagent manually tests your implementation like a human QA engineer,
168
+ using Chrome DevTools MCP for browser interactions and terminal for API testing.
169
+
170
+ **What it tests:**
171
+ - UI interactions (clicks, forms, navigation)
172
+ - Visual verification (screenshots, layout)
173
+ - Console monitoring (JS errors, warnings)
174
+ - Network inspection (API calls, responses)
175
+ - API testing (curl commands, response validation)
176
+ - Responsive design (multiple viewport sizes)
177
+
178
+ **Output includes:**
179
+ - Test results (✅ PASS / ❌ FAIL for each test case)
180
+ - Screenshots of key states
181
+ - Console errors captured
182
+ - API response verification
183
+ - Reproduction steps for failures
184
+ - Recommendations for fixes
185
+
84
186
  category: "testing"
85
187
  default_model: "" # Auto-select
86
188
  template_file: "manual-tester.mdx"
@@ -93,6 +195,54 @@ task_types:
93
195
  screenshots_max: 30
94
196
  api_calls_max: 50
95
197
  warpgrep_max: 10
198
+
199
+ manual:
200
+ display_name: "Manual Executor"
201
+ description: |
202
+ **🔨 GENERAL-PURPOSE EXECUTOR - Implements, fixes, creates, and completes work**
203
+
204
+ This subagent is a versatile executor that can handle ANY task that doesn't fit
205
+ the specialized categories. Unlike the other subagents (inspector, researcher, tester),
206
+ this one EXECUTES and COMPLETES work.
207
+
208
+ **What it does:**
209
+ - Implements features (writes code, creates files)
210
+ - Fixes bugs (debugs, patches, tests)
211
+ - Refactors code (restructures, improves)
212
+ - Sets up projects (initializes, configures)
213
+ - Modifies existing code (updates, enhances)
214
+ - Runs commands (tests, builds, deploys)
215
+
216
+ **Use cases:**
217
+ - 🔨 Feature implementation from scratch
218
+ - 🐛 Bug fixes with code changes
219
+ - ♻️ Code refactoring and restructuring
220
+ - 🏗️ Project setup and configuration
221
+ - ✏️ Code modifications and enhancements
222
+ - 🔧 General development tasks
223
+
224
+ **Output includes:**
225
+ - Summary of changes made
226
+ - Files created/modified with details
227
+ - Commands executed and results
228
+ - Verification of requirements met
229
+ - Notes and recommendations
230
+
231
+ category: "execution"
232
+ default_model: "" # Auto-select
233
+ template_file: "manual.mdx"
234
+
235
+ tool_limits:
236
+ sequentialthinking_max: 30
237
+ sequentialthinking_min: 8
238
+ warpgrep_max: 20
239
+ warpgrep_min: 3
240
+ deep_research_max: 30
241
+ deep_research_per_call: 5
242
+ web_search_keywords_max: 100
243
+ web_search_per_call: 10
244
+ file_operations_max: 50
245
+ terminal_commands_max: 30
96
246
 
97
247
  # ============================================================================
98
248
  # TOOL DEFINITION (Single consolidated tool)
@@ -218,7 +368,7 @@ tools:
218
368
  📋 TASK TYPE ENUM (Required - NO STRINGS, NO GUESSING!)
219
369
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
220
370
 
221
- Must be EXACTLY one of these three values:
371
+ Must be EXACTLY one of these four values:
222
372
 
223
373
  **1. `completion-inspector`** - CTO-Level Code Review
224
374
 
@@ -302,6 +452,34 @@ tools:
302
452
 
303
453
  **Model:** Auto-select (Gemini CLI chooses best)
304
454
 
455
+ ---
456
+
457
+ **4. `manual`** - General-Purpose Executor
458
+
459
+ **Purpose:** Implements, fixes, creates, and completes ANY task
460
+
461
+ **Uses:**
462
+ - File operations (read, write, edit)
463
+ - Terminal commands (test, build, install)
464
+ - Codebase search (understand existing code)
465
+ - Research tools (when external knowledge needed)
466
+
467
+ **When to use:**
468
+ - ✅ Feature implementation from scratch
469
+ - ✅ Bug fixes with code changes
470
+ - ✅ Code refactoring and restructuring
471
+ - ✅ Project setup and configuration
472
+ - ✅ General development tasks
473
+
474
+ **When NOT to use:**
475
+ - ❌ Only need inspection (use completion-inspector)
476
+ - ❌ Only need research (use helper-friend)
477
+ - ❌ Only need testing (use manual-tester)
478
+
479
+ **Output:** Summary of changes, files modified, verification results
480
+
481
+ **Model:** Auto-select (Gemini CLI chooses best)
482
+
305
483
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
306
484
  ⚙️ HOW IT WORKS
307
485
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -319,16 +497,70 @@ tools:
319
497
  type: string
320
498
  required: true
321
499
  validation:
322
- pattern: "^(completion-inspector|helper-friend|manual-tester)$"
500
+ pattern: "^(completion-inspector|helper-friend|manual-tester|manual)$"
323
501
  description: |
324
- **[REQUIRED] Task type enum - NO STRINGS, NO GUESSING**
502
+ **🎯 [REQUIRED] TASK TYPE SELECTOR - Choose Your Specialist**
503
+
504
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
505
+ ⚠️ STRICT ENUM - Must be EXACTLY one of these four values!
506
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
507
+
508
+ **1️⃣ `completion-inspector`** - CTO-Level Code Auditor
509
+
510
+ **Use when:** You think your task is done and need verification
511
+ **What it does:** Analyzes git diff, checks patterns, finds issues
512
+ **Output:** Completion %, requirements checklist, action items
513
+
514
+ ✅ Use for: After implementation, before PR, after refactoring
515
+ ❌ Skip if: Still coding, no changes yet, trivial fixes
516
+
517
+ ---
518
+
519
+ **2️⃣ `helper-friend`** - Research & Investigation Expert
520
+
521
+ **Use when:** You need research, analysis, or decision support
522
+ **What it does:** Searches codebase, web, docs, community
523
+ **Output:** Findings, recommendations, trade-offs, sources
524
+
525
+ ✅ Use for: Bug investigation, architecture decisions, learning patterns
526
+ ❌ Skip if: You already know what to do, simple questions
527
+
528
+ ---
529
+
530
+ **3️⃣ `manual-tester`** - QA Engineer with Real Browser
531
+
532
+ **Use when:** Implementation is complete and needs testing
533
+ **What it does:** Browser testing, API testing, screenshots
534
+ **Output:** Test results, failures, screenshots, console errors
535
+
536
+ ✅ Use for: UI testing, API testing, integration testing
537
+ ❌ Skip if: Code not ready, no user-facing changes, pure refactor
325
538
 
326
- Must be EXACTLY one of:
327
- - `completion-inspector` - Code review and verification
328
- - `helper-friend` - Research and investigation
329
- - `manual-tester` - QA testing with browser
539
+ ---
330
540
 
331
- The system will load the appropriate MDX template and merge with your prompt.
541
+ **4️⃣ `manual`** - General-Purpose Executor
542
+
543
+ **Use when:** You need to implement, fix, create, or complete a task
544
+ **What it does:** Executes file operations, terminal commands, codebase search, and research tools
545
+ **Output:** Summary of changes, files modified, verification results
546
+
547
+ ✅ Use for: Feature implementation, bug fixes, code refactoring, project setup, and general development tasks
548
+ ❌ Skip if: Only need inspection, research, or testing
549
+
550
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
551
+ 🔄 RECOMMENDED WORKFLOW
552
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
553
+
554
+ ```
555
+ 1. Research phase → helper-friend (understand problem)
556
+ 2. Implementation → [your coding work]
557
+ 3. Verification → completion-inspector (is it done?)
558
+ 4. Testing → manual-tester (does it work?)
559
+ 5. Done → PR/commit
560
+ ```
561
+
562
+ **VALIDATION:** Server rejects invalid task types immediately.
563
+ The selected type loads a specialized MDX template optimized for that task.
332
564
 
333
565
  prompt:
334
566
  type: string
@@ -336,25 +568,24 @@ tools:
336
568
  validation:
337
569
  minLength: 20
338
570
  description: |
339
- **[REQUIRED] Your task-specific prompt**
340
-
341
- This will be merged with the task type's MDX template.
342
-
343
- **For completion-inspector, provide:**
344
- - Original task requirements
345
- - Acceptance criteria
346
- - Implementation summary
347
- - Files changed with descriptions
348
- - START_COMMIT hash
349
- - Why you think it's complete
350
-
351
- **For helper-friend, provide:**
352
- - Ultimate goal and success criteria
353
- - Current situation
354
- - Files involved with descriptions
355
- - What you've tried
356
- - Current blocker/question
357
- - Constraints
571
+ **🔥🔥🔥 [REQUIRED] YOUR TASK-SPECIFIC PROMPT - MINIMUM 500-1000 WORDS EXPECTED 🔥🔥🔥**
572
+
573
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
574
+ ⚠️ CRITICAL: THE SUBAGENT IS COMPLETELY BLIND WITHOUT YOUR CONTEXT
575
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
576
+
577
+ The subagent has **ZERO** context about:
578
+ - Your codebase structure
579
+ - Your project goals
580
+ - Your tech stack
581
+ - Your constraints
582
+ - What you've already tried
583
+ - What files exist
584
+ - What the task even is
585
+
586
+ **YOU MUST PROVIDE EVERYTHING.** Assume you're explaining to a brilliant
587
+ engineer who just joined the team 5 minutes ago. They're smart but they
588
+ know NOTHING about your project.
358
589
 
359
590
  **For manual-tester, provide:**
360
591
  - Frontend URL (MANDATORY!)
@@ -365,7 +596,480 @@ tools:
365
596
  - Test data
366
597
  - Edge cases to test
367
598
 
599
+ **For manual, provide:**
600
+ - Clear task description
601
+ - Requirements or acceptance criteria
602
+ - Relevant file paths or context
603
+ - Any constraints or preferences
604
+ - Expected outcome
605
+
368
606
  Minimum 20 characters required.
607
+ PROVIDE EVERYTHING.** Assume you're explaining to a brilliant
608
+ engineer who just joined the team 5 minutes ago. They're smart but they
609
+ know NOTHING about your project.
610
+
611
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
612
+ 📊 QUALITY SCALE - BE BRUTALLY HONEST WITH YOURSELF
613
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
614
+
615
+ **WORD COUNT → QUALITY LEVEL → WHAT YOU'LL GET**
616
+
617
+ **< 50 words** → 💀 GARBAGE
618
+ - "Check if done" / "Fix the bug" / "Test login"
619
+ - Response: Generic platitudes, wastes everyone's time
620
+ - You're better off not calling the subagent at all
621
+
622
+ **50-100 words** → ❌ USELESS
623
+ - Brief mention of task, no files, no context
624
+ - Response: Vague suggestions that don't apply to your code
625
+ - The subagent is guessing blindly
626
+
627
+ **100-200 words** → ⚠️ POOR
628
+ - Some context but missing critical details
629
+ - Response: Partially relevant but misses your actual situation
630
+ - 50% of insights will be off-target
631
+
632
+ **200-300 words** → 😐 MEDIOCRE
633
+ - Basic context, some files mentioned
634
+ - Response: Generally useful but lacks specificity
635
+ - You'll need follow-up questions
636
+
637
+ **300-500 words** → ✅ ACCEPTABLE
638
+ - Good context, file paths included, requirements stated
639
+ - Response: Relevant and actionable
640
+ - Minimum threshold for useful output
641
+
642
+ **500-750 words** → 🎯 GOOD
643
+ - Comprehensive context, detailed file descriptions
644
+ - What you tried, why it failed, specific questions
645
+ - Response: Highly targeted, specific recommendations
646
+
647
+ **750-1000 words** → ⭐ EXCELLENT
648
+ - Full context: files, requirements, acceptance criteria
649
+ - Tech stack, constraints, edge cases, what you've tried
650
+ - Response: Expert-level analysis, production-ready advice
651
+
652
+ **1000+ words** → 🏆 EXCEPTIONAL
653
+ - Complete project context, detailed file-by-file breakdown
654
+ - Historical context, related issues, future considerations
655
+ - Response: CTO-level strategic recommendations
656
+
657
+ **🎯 TARGET: 500-1000 words minimum for any serious task!**
658
+
659
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
660
+ 📁 FILE CONTEXT - ABSOLUTELY MANDATORY
661
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
662
+
663
+ **YOU MUST INCLUDE relative file paths for ALL relevant files!**
664
+
665
+ The subagent CANNOT see your filesystem. If you don't tell it which
666
+ files exist and what they do, it's operating completely blind.
667
+
668
+ **FORMAT:** Use relative paths from project root with descriptions:
669
+
670
+ ```
671
+ 📁 FILES CHANGED/RELEVANT:
672
+
673
+ src/auth/auth.controller.ts
674
+ - Purpose: Handles login/register/logout endpoints
675
+ - What changed: Added JWT refresh token logic (lines 45-120)
676
+ - Dependencies: Uses src/auth/jwt.service.ts for token generation
677
+ - Exports: AuthController class with 4 public methods
678
+
679
+ src/auth/jwt.service.ts
680
+ - Purpose: JWT token generation and validation
681
+ - What changed: New refreshToken() method added
682
+ - Key functions: generateToken(), validateToken(), refreshToken()
683
+ - Config: Uses JWT_SECRET from environment
684
+
685
+ src/middleware/auth.guard.ts
686
+ - Purpose: Protects routes requiring authentication
687
+ - What changed: Now checks for refresh token in cookie
688
+ - How it works: Extracts token from Authorization header or cookie
689
+ - Used by: All /api/protected/* routes
690
+
691
+ src/types/auth.types.ts
692
+ - Purpose: TypeScript interfaces for auth
693
+ - What changed: Added RefreshTokenPayload interface
694
+ - Exports: User, TokenPayload, RefreshTokenPayload, AuthResponse
695
+
696
+ tests/auth/auth.controller.spec.ts
697
+ - Purpose: Unit tests for auth controller
698
+ - What changed: Added 5 new tests for refresh flow
699
+ - Coverage: Now covers happy path + 3 error cases
700
+ ```
701
+
702
+ **WHY THIS MATTERS:**
703
+ - Subagent can understand your architecture
704
+ - Can identify missing pieces
705
+ - Can check for consistency across files
706
+ - Can suggest improvements based on actual structure
707
+
708
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
709
+ 📋 TASK CONTEXT - WHAT ARE YOU ACTUALLY DOING?
710
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
711
+
712
+ **Include the FULL context of what task you're working on:**
713
+
714
+ ```
715
+ 🎯 TASK CONTEXT:
716
+
717
+ **Task Title:** Add JWT refresh token authentication
718
+
719
+ **Background:**
720
+ We're building a SaaS platform. Users were complaining about
721
+ being logged out every hour. We need refresh tokens to keep
722
+ sessions alive for 7 days while maintaining security.
723
+
724
+ **Original Requirements:**
725
+ 1. Access tokens expire in 15 minutes (security)
726
+ 2. Refresh tokens expire in 7 days (convenience)
727
+ 3. Refresh tokens stored in HTTP-only cookie (XSS protection)
728
+ 4. Refresh token rotation on each refresh (security)
729
+ 5. Invalidate all tokens on password change
730
+
731
+ **Acceptance Criteria:**
732
+ - [ ] POST /auth/login returns access token + sets refresh cookie
733
+ - [ ] POST /auth/refresh exchanges refresh token for new access token
734
+ - [ ] Refresh token is rotated on each use
735
+ - [ ] Old refresh tokens are invalidated
736
+ - [ ] Password change invalidates all user sessions
737
+
738
+ **Tech Stack:**
739
+ - Node.js 20 + Express 4.18
740
+ - TypeScript 5.3
741
+ - PostgreSQL 15 with Prisma ORM
742
+ - Jest for testing
743
+ - Redis for token blacklist
744
+
745
+ **What I've Done So Far:**
746
+ 1. Created jwt.service.ts with token generation ✅
747
+ 2. Updated auth.controller.ts with refresh endpoint ✅
748
+ 3. Added refresh token to login response ✅
749
+ 4. Modified auth.guard.ts to check cookies ✅
750
+ 5. Written basic tests ⏳ (in progress)
751
+
752
+ **What's Not Working:**
753
+ - Token rotation works but old tokens aren't being blacklisted
754
+ - Tests are flaky - sometimes pass, sometimes fail
755
+ - Not sure if my Redis implementation is correct
756
+
757
+ **Specific Questions:**
758
+ 1. Is my refresh token rotation implementation secure?
759
+ 2. Should I use Redis SET or SORTED SET for blacklist?
760
+ 3. How do I make my tests deterministic?
761
+ ```
762
+
763
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
764
+ 🔧 WHAT YOU'VE TRIED - PREVENT DUPLICATE SUGGESTIONS
765
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
766
+
767
+ **Tell the subagent what you've already attempted:**
768
+
769
+ ```
770
+ 🔄 WHAT I'VE TRIED:
771
+
772
+ 1. Used JWT library's built-in expiry
773
+ → Problem: Couldn't invalidate tokens before expiry
774
+
775
+ 2. Stored tokens in database
776
+ → Problem: Too slow, 50ms+ per request
777
+
778
+ 3. Redis with simple SET
779
+ → Problem: No automatic expiry, memory grows forever
780
+
781
+ 4. Asked ChatGPT
782
+ → Got generic advice that didn't fit our architecture
783
+ ```
784
+
785
+ **WHY THIS MATTERS:**
786
+ - Avoids wasting time on already-tried solutions
787
+ - Helps subagent understand what DOESN'T work
788
+ - Shows your thinking process for better recommendations
789
+
790
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
791
+ 📋 PROMPT TEMPLATES BY TASK TYPE (FOLLOW EXACTLY!)
792
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
793
+
794
+ **═══ COMPLETION-INSPECTOR TEMPLATE ═══**
795
+
796
+ ```
797
+ 🎯 TASK TITLE: [One-line description]
798
+
799
+ 📋 ORIGINAL REQUIREMENTS:
800
+ 1. [Requirement 1 - be specific]
801
+ 2. [Requirement 2 - include acceptance criteria]
802
+ 3. [Requirement 3 - mention edge cases if any]
803
+
804
+ ✅ ACCEPTANCE CRITERIA:
805
+ - [Criterion 1 - how to verify it's met]
806
+ - [Criterion 2 - testable condition]
807
+ - [Criterion 3 - measurable outcome]
808
+
809
+ 📝 IMPLEMENTATION SUMMARY:
810
+ [2-3 sentences describing what you implemented and your approach]
811
+
812
+ 📁 FILES CHANGED:
813
+ - `src/path/to/file1.ts` - [What changed and why]
814
+ - `src/path/to/file2.ts` - [What changed and why]
815
+ - `tests/path/to/test.ts` - [Tests added/modified]
816
+
817
+ 🔖 GIT CONTEXT:
818
+ - START_COMMIT: [hash or "HEAD~N"]
819
+ - Branch: [feature branch name]
820
+
821
+ 💭 WHY I THINK IT'S COMPLETE:
822
+ [Explain your reasoning - what makes you confident it's done?]
823
+
824
+ ⚠️ AREAS OF CONCERN (if any):
825
+ [Any parts you're unsure about or want extra scrutiny on]
826
+ ```
827
+
828
+ **═══ HELPER-FRIEND TEMPLATE ═══**
829
+
830
+ ```
831
+ 🎯 ULTIMATE GOAL:
832
+ [What are you trying to achieve? What does success look like?]
833
+
834
+ 📍 CURRENT SITUATION:
835
+ [Where are you now? What's the context?]
836
+
837
+ 📁 RELEVANT FILES (with descriptions):
838
+ - `src/path/to/file1.ts` - [What this file does, why it's relevant]
839
+ - `src/path/to/file2.ts` - [What this file does, why it's relevant]
840
+
841
+ 🔄 WHAT I'VE TRIED:
842
+ 1. [Approach 1] → [Result/Why it didn't work]
843
+ 2. [Approach 2] → [Result/Why it didn't work]
844
+
845
+ ❓ SPECIFIC QUESTIONS:
846
+ 1. [Question 1 - be specific, not vague]
847
+ 2. [Question 2 - include context]
848
+ 3. [Question 3 - what decision does this inform?]
849
+
850
+ 🚧 CURRENT BLOCKER:
851
+ [What's stopping you? Be specific about the problem.]
852
+
853
+ 📌 CONSTRAINTS:
854
+ - [Constraint 1 - tech stack limitations]
855
+ - [Constraint 2 - timeline/scope]
856
+ - [Constraint 3 - compatibility requirements]
857
+
858
+ 🎯 WHAT I NEED FROM YOU:
859
+ [Specific ask - research? recommendations? code examples?]
860
+ ```
861
+
862
+ **═══ MANUAL-TESTER TEMPLATE ═══**
863
+
864
+ ```
865
+ 🌐 URLS (MANDATORY!):
866
+ - Frontend: [http://localhost:3000 or deployed URL]
867
+ - Backend API: [http://localhost:8000/api or deployed URL]
868
+ - Admin panel: [if applicable]
869
+
870
+ 🔐 AUTH CREDENTIALS (if needed):
871
+ - Username: [test user]
872
+ - Password: [test password]
873
+ - Or: [How to authenticate]
874
+
875
+ 📝 FEATURE TO TEST:
876
+ [Describe the feature in 2-3 sentences]
877
+
878
+ ✅ EXPECTED BEHAVIORS:
879
+ 1. [When user does X] → [Y should happen]
880
+ 2. [When user does A] → [B should appear]
881
+ 3. [Form validation] → [These errors should show]
882
+
883
+ 🧪 TEST SCENARIOS:
884
+ - Happy path: [Normal user flow to test]
885
+ - Error path: [Invalid input scenarios]
886
+ - Edge cases: [Boundary conditions]
887
+
888
+ 📊 TEST DATA:
889
+ - Valid input: [example values]
890
+ - Invalid input: [example values that should fail]
891
+
892
+ 📱 VIEWPORTS TO TEST:
893
+ - Desktop (1920x1080)
894
+ - Tablet (768x1024)
895
+ - Mobile (375x667)
896
+
897
+ ⚠️ KNOWN ISSUES (skip these):
898
+ [Any known bugs to ignore during testing]
899
+ ```
900
+
901
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
902
+ ❌ BAD vs ✅ GOOD EXAMPLES - THE DIFFERENCE IS NIGHT AND DAY
903
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
904
+
905
+ **💀 GARBAGE (~5 words) - Complete waste of time:**
906
+ ```
907
+ "Check if it's done"
908
+ "Fix the bug"
909
+ "Test login"
910
+ ```
911
+ → Response will be: "I don't have enough context to help. Please provide..."
912
+ → You've wasted time and learned nothing
913
+
914
+ **❌ USELESS (~30 words) - Subagent is guessing blindly:**
915
+ ```
916
+ "I added authentication to my Node.js app. Can you verify
917
+ it's complete? I think I covered everything but not sure."
918
+ ```
919
+ → What kind of auth? What files? What requirements? What's "everything"?
920
+ → Response will be generic checklist that may not apply to your code
921
+
922
+ **⚠️ POOR (~80 words) - Half the insights will be wrong:**
923
+ ```
924
+ "I'm working on JWT authentication for our Express API. I created
925
+ auth.controller.ts and jwt.service.ts. The login works but I'm
926
+ not sure about the refresh token implementation. We need tokens
927
+ to expire in 1 hour but users shouldn't be logged out while active."
928
+ ```
929
+ → Better but: What's in those files? What's the actual implementation?
930
+ → What does "not sure" mean specifically? What have you tried?
931
+
932
+ **✅ ACCEPTABLE (~200 words) - Minimum for useful output:**
933
+ ```
934
+ 🎯 TASK: JWT refresh token authentication
935
+
936
+ 📋 REQUIREMENTS:
937
+ 1. Access tokens expire in 15 minutes
938
+ 2. Refresh tokens expire in 7 days
939
+ 3. Refresh tokens in HTTP-only cookies
940
+
941
+ 📁 FILES:
942
+ - src/auth/auth.controller.ts - Login/register/refresh endpoints
943
+ - src/auth/jwt.service.ts - Token generation and validation
944
+ - src/middleware/auth.guard.ts - Route protection
945
+
946
+ ✅ ACCEPTANCE:
947
+ - POST /auth/login returns access token + sets refresh cookie
948
+ - POST /auth/refresh returns new access token
949
+ - Invalid tokens return 401
950
+
951
+ 💭 STATUS: Login works, refresh endpoint exists but untested
952
+
953
+ ❓ QUESTIONS:
954
+ 1. Is storing refresh token in cookie secure?
955
+ 2. Should I rotate refresh tokens?
956
+ ```
957
+
958
+ **🎯 GOOD (~500 words) - Highly targeted recommendations:**
959
+ ```
960
+ 🎯 TASK TITLE: Implement JWT refresh token authentication
961
+
962
+ **Background:**
963
+ Building a SaaS dashboard. Users complained about hourly logouts.
964
+ Need refresh tokens to maintain sessions for 7 days while keeping
965
+ access tokens short-lived for security.
966
+
967
+ 📋 ORIGINAL REQUIREMENTS:
968
+ 1. Access tokens: 15 minute expiry (security best practice)
969
+ 2. Refresh tokens: 7 day expiry (user convenience)
970
+ 3. Refresh tokens: HTTP-only cookie (XSS protection)
971
+ 4. Token rotation: New refresh token on each refresh (security)
972
+ 5. Revocation: Password change invalidates all sessions
973
+
974
+ ✅ ACCEPTANCE CRITERIA:
975
+ - [ ] POST /auth/login returns {accessToken} + sets refreshToken cookie
976
+ - [ ] POST /auth/refresh exchanges refresh for new access + new refresh
977
+ - [ ] Protected routes return 401 without valid access token
978
+ - [ ] Refresh with old/rotated token fails (single-use enforcement)
979
+ - [ ] Password change via /auth/password invalidates all tokens
980
+
981
+ 📁 FILES CHANGED:
982
+
983
+ src/auth/auth.controller.ts (lines 1-120)
984
+ - Purpose: HTTP endpoints for auth operations
985
+ - Changes: Added /refresh endpoint, modified /login to set cookie
986
+ - Exports: AuthController with login(), register(), refresh(), logout()
987
+ - Dependencies: JwtService, UserService, Response (for cookies)
988
+
989
+ src/auth/jwt.service.ts (lines 1-85)
990
+ - Purpose: Token generation, validation, rotation logic
991
+ - Changes: Added generateRefreshToken(), rotateRefreshToken(), blacklistToken()
992
+ - Key logic: Uses Redis for token blacklist with TTL matching token expiry
993
+ - Config: JWT_SECRET, REFRESH_SECRET from env
994
+
995
+ src/middleware/auth.guard.ts (lines 1-45)
996
+ - Purpose: Protects routes requiring authentication
997
+ - Changes: Now extracts token from Authorization header OR cookie
998
+ - Logic: Validates access token, attaches user to request
999
+
1000
+ src/auth/dto/auth.dto.ts (lines 1-30)
1001
+ - Purpose: Request/response type definitions
1002
+ - Changes: Added RefreshTokenDto, TokenResponseDto
1003
+
1004
+ tests/auth/auth.e2e-spec.ts (lines 1-150)
1005
+ - Purpose: End-to-end auth flow tests
1006
+ - Changes: Added 8 tests for refresh flow
1007
+ - Coverage: Happy path, expired token, rotated token, blacklisted token
1008
+
1009
+ 🔖 GIT CONTEXT:
1010
+ - START_COMMIT: abc123 (before auth changes)
1011
+ - Current branch: feature/refresh-tokens
1012
+ - 12 commits since start
1013
+
1014
+ 🔧 TECH STACK:
1015
+ - Node.js 20, Express 4.18, TypeScript 5.3
1016
+ - Prisma ORM with PostgreSQL 15
1017
+ - Redis 7 for token blacklist
1018
+ - Jest + Supertest for testing
1019
+
1020
+ 🔄 WHAT I'VE TRIED:
1021
+ 1. Storing tokens in database → Too slow (50ms/request)
1022
+ 2. JWT blacklist without Redis → Memory leak in production
1023
+ 3. Simple refresh without rotation → Security concern flagged in review
1024
+
1025
+ 💭 WHY I THINK IT'S COMPLETE:
1026
+ - All 5 requirements implemented
1027
+ - 8/8 e2e tests passing
1028
+ - Manual testing works in Postman
1029
+ - Code reviewed by team lead
1030
+
1031
+ ⚠️ AREAS OF CONCERN:
1032
+ - Redis connection handling during reconnects
1033
+ - Is my token rotation truly atomic?
1034
+ - Should blacklist use SET or SORTED SET?
1035
+
1036
+ ❓ SPECIFIC QUESTIONS:
1037
+ 1. Is the refresh token rotation implementation secure against race conditions?
1038
+ 2. Is storing the refresh token family ID sufficient for revocation?
1039
+ 3. Any edge cases I'm missing in my test coverage?
1040
+ ```
1041
+ → This prompt gives the subagent EVERYTHING it needs to provide
1042
+ expert-level, specific, actionable recommendations
1043
+
1044
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1045
+ 💡 PRO TIPS FOR MAXIMUM QUALITY OUTPUT
1046
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1047
+
1048
+ 1. **TARGET 500-1000 WORDS** - Seriously, more context = better output
1049
+ 2. **LIST EVERY FILE** - With relative paths AND what each file does
1050
+ 3. **DESCRIBE WHAT CHANGED** - Not just "modified" but HOW and WHY
1051
+ 4. **INCLUDE LINE NUMBERS** - "auth logic at lines 45-120" helps focus
1052
+ 5. **STATE YOUR TECH STACK** - Versions matter for compatibility advice
1053
+ 6. **EXPLAIN WHAT YOU TRIED** - Prevents duplicate suggestions
1054
+ 7. **ASK SPECIFIC QUESTIONS** - "Is X secure?" not "Is it good?"
1055
+ 8. **MENTION EDGE CASES** - What weird scenarios worry you?
1056
+ 9. **INCLUDE ERROR MESSAGES** - Exact errors, not paraphrased
1057
+ 10. **SHARE YOUR REASONING** - Why you made certain choices
1058
+
1059
+ **THE GOLDEN RULE:**
1060
+
1061
+ Imagine you're onboarding a brilliant senior engineer who just joined
1062
+ your team. They've never seen your codebase. What would you tell them
1063
+ to get them up to speed and able to give expert advice?
1064
+
1065
+ **THAT is what your prompt should contain.**
1066
+
1067
+ **REMEMBER:**
1068
+ - 💀 < 50 words = You're wasting everyone's time
1069
+ - ⚠️ 50-200 words = Expect generic, often wrong advice
1070
+ - ✅ 200-500 words = Acceptable, targeted recommendations
1071
+ - 🎯 500-1000 words = Expert-level, production-ready insights
1072
+ - 🏆 1000+ words = CTO-level strategic guidance
369
1073
 
370
1074
  model:
371
1075
  type: string