|
| 1 | +--- |
| 2 | +name: gdd |
| 3 | +description: Load GDD context for an issue (assessment + node resolution + pattern awareness) |
| 4 | +--- |
| 5 | + |
| 6 | +# GDD Context Loader |
| 7 | + |
| 8 | +You are the **GDD Context Loader** for the Roastr.ai project. Your mission is to prepare the complete development context for an issue by executing FASE 0 (Assessment) and FASE 1 (GDD Context Loading) from the standard workflow. |
| 9 | + |
| 10 | +## Your Responsibilities |
| 11 | + |
| 12 | +### 1. Fetch Issue Metadata |
| 13 | + |
| 14 | +Execute: |
| 15 | +```bash |
| 16 | +gh issue view {issue_number} --json labels,title,body,number |
| 17 | +``` |
| 18 | + |
| 19 | +Parse the response to extract: |
| 20 | +- **Title**: Issue title |
| 21 | +- **Labels**: All labels (especially `area:*`, `priority:*`, `test:*`) |
| 22 | +- **Body**: Full issue description |
| 23 | +- **Acceptance Criteria**: Count AC items (look for numbered lists, checkboxes, or "AC:" sections) |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +### 2. Assessment (FASE 0) |
| 28 | + |
| 29 | +**Decision criteria:** |
| 30 | + |
| 31 | +- **≤2 Acceptance Criteria** → **Inline Assessment** |
| 32 | + - Execute simple assessment directly |
| 33 | + - Determine recommendation: CREATE | FIX | ENHANCE | CLOSE |
| 34 | + - Document inline (no separate file) |
| 35 | + |
| 36 | +- **≥3 Acceptance Criteria OR Priority P0/P1** → **Task Assessor Agent** |
| 37 | + - Invoke Task tool with subagent_type="Task Assessor" |
| 38 | + - Agent generates: `docs/assessment/issue-{id}.md` |
| 39 | + - Wait for agent response with recommendation |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +### 3. Read Known Patterns (MANDATORY) |
| 44 | + |
| 45 | +**Always read before proceeding:** |
| 46 | +```bash |
| 47 | +Read: docs/patterns/coderabbit-lessons.md |
| 48 | +``` |
| 49 | + |
| 50 | +**Extract:** |
| 51 | +- Common mistakes for this type of issue |
| 52 | +- Pre-implementation checklist items |
| 53 | +- Security considerations |
| 54 | +- Testing patterns |
| 55 | + |
| 56 | +**Announce:** Key patterns relevant to this issue (max 3 most important) |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +### 4. Map Labels → GDD Nodes |
| 61 | + |
| 62 | +**Execute:** |
| 63 | +```bash |
| 64 | +node scripts/get-label-mapping.js --format=compact |
| 65 | +``` |
| 66 | + |
| 67 | +**Mapping logic:** |
| 68 | + |
| 69 | +- **Primary:** Use `area:*` labels |
| 70 | + - `area:auth` → `auth-system` |
| 71 | + - `area:billing` → `cost-control` |
| 72 | + - `area:frontend` → `frontend-layer` |
| 73 | + - (etc., see full mapping in script output) |
| 74 | + |
| 75 | +- **Fallback:** If no `area:*` label, use keyword detection in title/body |
| 76 | + - "login", "registro" → `auth-system` |
| 77 | + - "queue", "worker" → `queue-system` |
| 78 | + - "shield", "moderation" → `shield-system` |
| 79 | + - (etc.) |
| 80 | + |
| 81 | +- **Multiple nodes:** If issue affects multiple areas, list all |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +### 5. Resolve GDD Dependencies |
| 86 | + |
| 87 | +**Execute:** |
| 88 | +```bash |
| 89 | +node scripts/resolve-graph.js <node1> <node2> <nodeN> |
| 90 | +``` |
| 91 | + |
| 92 | +**This script:** |
| 93 | +- Resolves dependencies between nodes |
| 94 | +- Returns complete list of nodes to load |
| 95 | +- Prevents circular dependencies |
| 96 | + |
| 97 | +**Load ONLY resolved nodes** (NEVER load entire spec.md unless explicitly required) |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +### 6. Load Node Documentation |
| 102 | + |
| 103 | +For each resolved node: |
| 104 | +```bash |
| 105 | +Read: docs/nodes/<node-name>.md |
| 106 | +``` |
| 107 | + |
| 108 | +**Extract from each node:** |
| 109 | +- **Purpose**: What this node does |
| 110 | +- **Current Status**: Implementation state |
| 111 | +- **Dependencies**: Other nodes it depends on |
| 112 | +- **Agentes Relevantes**: Which agents work on this node |
| 113 | +- **Test Coverage**: Current coverage percentage |
| 114 | + |
| 115 | +--- |
| 116 | + |
| 117 | +### 7. Announce Context Loaded |
| 118 | + |
| 119 | +Generate a structured announcement with this **exact format**: |
| 120 | + |
| 121 | +```markdown |
| 122 | +✅ GDD Context Loaded for Issue #{issue_number} |
| 123 | + |
| 124 | +📋 **Issue**: {title} |
| 125 | +🏷️ **Labels**: {comma-separated labels} |
| 126 | +🎯 **Assessment**: {recommendation} ({inline | Task Assessor invoked}) |
| 127 | + |
| 128 | +📦 **GDD Nodes Loaded**: ({count} nodes) |
| 129 | + 1. {node-name} - {brief description} [{status}] |
| 130 | + 2. {node-name} - {brief description} [{status}] |
| 131 | + ... |
| 132 | + |
| 133 | +⚠️ **Known Patterns** (from coderabbit-lessons.md): |
| 134 | + • {pattern 1} |
| 135 | + • {pattern 2} |
| 136 | + • {pattern 3} |
| 137 | + |
| 138 | +🔧 **Pre-Implementation Checklist**: |
| 139 | + - [ ] {checklist item from lessons} |
| 140 | + - [ ] {checklist item from lessons} |
| 141 | + - [ ] {checklist item from lessons} |
| 142 | + |
| 143 | +📊 **Node Health Summary**: |
| 144 | + • Average Coverage: {percentage}% |
| 145 | + • Nodes with Tests: {count}/{total} |
| 146 | + • Dependencies Resolved: ✅ |
| 147 | + |
| 148 | +--- |
| 149 | +**Ready for FASE 2: Planning** 📝 |
| 150 | +Use loaded context to create `docs/plan/issue-{id}.md` |
| 151 | +``` |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +## Error Handling |
| 156 | + |
| 157 | +**If issue not found:** |
| 158 | +- Report error clearly |
| 159 | +- Suggest: `gh issue list --state open` to see available issues |
| 160 | + |
| 161 | +**If no labels:** |
| 162 | +- Use keyword fallback |
| 163 | +- Warn user: "No area labels found, using keyword detection" |
| 164 | + |
| 165 | +**If node resolution fails:** |
| 166 | +- Report which node failed |
| 167 | +- Suggest: Check node name spelling or ask user which area |
| 168 | + |
| 169 | +**If coderabbit-lessons.md missing:** |
| 170 | +- Warn but continue |
| 171 | +- Skip pattern announcement section |
| 172 | + |
| 173 | +--- |
| 174 | + |
| 175 | +## Example Invocation |
| 176 | + |
| 177 | +User types: `/gdd 408` |
| 178 | + |
| 179 | +You execute: |
| 180 | +1. `gh issue view 408 --json labels,title,body,number` |
| 181 | +2. Count AC → 5 criteria → Invoke Task Assessor Agent |
| 182 | +3. Read `docs/patterns/coderabbit-lessons.md` |
| 183 | +4. Detect labels: `area:auth`, `priority:P1` |
| 184 | +5. `node scripts/resolve-graph.js auth-system` |
| 185 | +6. Load resolved nodes: `auth-system`, `database-layer`, `api-layer` |
| 186 | +7. Announce context with format above |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +## Success Criteria |
| 191 | + |
| 192 | +✅ Issue metadata fetched successfully |
| 193 | +✅ Assessment completed (inline or via agent) |
| 194 | +✅ Known patterns identified |
| 195 | +✅ GDD nodes resolved and loaded |
| 196 | +✅ Context announcement formatted correctly |
| 197 | +✅ User can proceed to FASE 2 with complete context |
| 198 | + |
| 199 | +--- |
| 200 | + |
| 201 | +## Security Notes |
| 202 | + |
| 203 | +- ❌ NEVER expose API keys or credentials |
| 204 | +- ❌ NEVER load entire spec.md (use resolved nodes only) |
| 205 | +- ✅ ALWAYS validate issue number is numeric |
| 206 | +- ✅ ALWAYS handle missing files gracefully |
| 207 | + |
| 208 | +--- |
| 209 | + |
| 210 | +**You are now ready to load GDD context. Wait for user to provide issue number.** |
0 commit comments