@atlashub/smartstack-cli 1.13.2 → 1.14.1

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 (214) hide show
  1. package/.documentation/agents.html +1 -1
  2. package/.documentation/apex.html +1 -1
  3. package/.documentation/business-analyse.html +1 -1
  4. package/.documentation/cli-commands.html +3 -3
  5. package/.documentation/commands.html +1 -1
  6. package/.documentation/efcore.html +1 -1
  7. package/.documentation/gitflow.html +231 -236
  8. package/.documentation/hooks.html +1 -1
  9. package/.documentation/index.html +1 -1
  10. package/.documentation/init.html +3 -3
  11. package/.documentation/installation.html +1075 -351
  12. package/.documentation/ralph-loop.html +1 -1
  13. package/.documentation/test-web.html +1 -1
  14. package/README.md +88 -20
  15. package/config/default-config.json +10 -1
  16. package/dist/index.js +276 -85
  17. package/dist/index.js.map +1 -1
  18. package/package.json +1 -1
  19. package/templates/agents/code-reviewer.md +163 -0
  20. package/templates/agents/efcore/db-deploy.md +25 -7
  21. package/templates/agents/efcore/db-reset.md +31 -10
  22. package/templates/agents/efcore/db-status.md +22 -5
  23. package/templates/agents/efcore/migration.md +70 -20
  24. package/templates/agents/gitflow/cleanup.md +8 -1
  25. package/templates/agents/gitflow/commit.md +7 -5
  26. package/templates/agents/gitflow/finish.md +6 -4
  27. package/templates/agents/gitflow/pr.md +8 -1
  28. package/templates/agents/gitflow/start.md +1 -1
  29. package/templates/commands/check-version.md +267 -0
  30. package/templates/commands/efcore/_shared.md +31 -2
  31. package/templates/commands/efcore/db-reset.md +18 -6
  32. package/templates/commands/efcore/migration.md +1 -1
  33. package/templates/commands/efcore/rebase-snapshot.md +1 -1
  34. package/templates/commands/efcore/squash.md +1 -0
  35. package/templates/commands/refactor.md +164 -0
  36. package/templates/project/DependencyInjection.Application.cs.template +25 -0
  37. package/templates/project/DependencyInjection.Infrastructure.cs.template +61 -0
  38. package/templates/project/DesignTimeExtensionsDbContextFactory.cs.template +70 -0
  39. package/templates/project/ExampleEntity.cs.template +116 -0
  40. package/templates/project/ExampleEntityConfiguration.cs.template +64 -0
  41. package/templates/project/ExampleService.cs.template +146 -0
  42. package/templates/project/ExtensionsDbContext.cs.template +41 -0
  43. package/templates/project/IExtensionsDbContext.cs.template +22 -0
  44. package/templates/project/Program.cs.template +47 -0
  45. package/templates/project/README.md +79 -0
  46. package/templates/ralph/README.md +10 -8
  47. package/templates/ralph/ralph.config.yaml +2 -2
  48. package/templates/skills/_shared.md +44 -44
  49. package/templates/skills/ai-prompt/SKILL.md +55 -55
  50. package/templates/skills/apex/SKILL.md +235 -0
  51. package/templates/skills/apex/steps/step-00-init.md +203 -0
  52. package/templates/skills/apex/steps/step-01-analyze.md +210 -0
  53. package/templates/skills/apex/steps/step-02-plan.md +217 -0
  54. package/templates/skills/apex/steps/step-03-execute.md +178 -0
  55. package/templates/skills/apex/steps/step-04-validate.md +217 -0
  56. package/templates/skills/apex/steps/step-05-examine.md +207 -0
  57. package/templates/skills/apex/steps/step-06-resolve.md +181 -0
  58. package/templates/skills/apex/steps/step-07-tests.md +206 -0
  59. package/templates/skills/apex/steps/step-08-run-tests.md +207 -0
  60. package/templates/skills/apex/templates/00-context.md +46 -0
  61. package/templates/skills/apex/templates/01-analyze.md +63 -0
  62. package/templates/skills/apex/templates/02-plan.md +63 -0
  63. package/templates/skills/apex/templates/03-execute.md +34 -0
  64. package/templates/skills/apex/templates/04-validate.md +61 -0
  65. package/templates/skills/apex/templates/05-examine.md +58 -0
  66. package/templates/skills/apex/templates/06-resolve.md +39 -0
  67. package/templates/skills/apex/templates/07-tests.md +56 -0
  68. package/templates/skills/apex/templates/08-run-tests.md +41 -0
  69. package/templates/skills/apex/templates/README.md +69 -0
  70. package/templates/skills/application/SKILL.md +50 -50
  71. package/templates/skills/application/templates-backend.md +25 -25
  72. package/templates/skills/application/templates-frontend.md +43 -43
  73. package/templates/skills/application/templates-i18n.md +29 -29
  74. package/templates/skills/application/templates-seed.md +77 -77
  75. package/templates/skills/business-analyse/SKILL.md +223 -0
  76. package/templates/skills/business-analyse/_shared.md +258 -0
  77. package/templates/skills/business-analyse/questionnaire/01-context.md +33 -0
  78. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +35 -0
  79. package/templates/skills/business-analyse/questionnaire/03-scope.md +35 -0
  80. package/templates/skills/business-analyse/questionnaire/04-data.md +36 -0
  81. package/templates/skills/business-analyse/questionnaire/05-integrations.md +36 -0
  82. package/templates/skills/business-analyse/questionnaire/06-security.md +40 -0
  83. package/templates/skills/business-analyse/questionnaire/07-ui.md +36 -0
  84. package/templates/skills/business-analyse/questionnaire/08-performance.md +35 -0
  85. package/templates/skills/business-analyse/questionnaire/09-constraints.md +35 -0
  86. package/templates/skills/business-analyse/questionnaire/10-documentation.md +35 -0
  87. package/templates/skills/business-analyse/questionnaire.md +177 -177
  88. package/templates/skills/business-analyse/react/components.md +340 -0
  89. package/templates/skills/business-analyse/react/i18n-template.md +245 -0
  90. package/templates/skills/business-analyse/react/schema.md +151 -0
  91. package/templates/skills/business-analyse/steps/step-00-init.md +293 -0
  92. package/templates/skills/business-analyse/steps/step-01-discover.md +267 -0
  93. package/templates/skills/business-analyse/steps/step-02-analyse.md +243 -0
  94. package/templates/skills/business-analyse/steps/step-03-specify.md +317 -0
  95. package/templates/skills/business-analyse/steps/step-04-validate.md +239 -0
  96. package/templates/skills/business-analyse/steps/step-05-handoff.md +336 -0
  97. package/templates/skills/business-analyse/steps/step-06-doc-html.md +261 -0
  98. package/templates/skills/business-analyse/templates/00-context.md +105 -0
  99. package/templates/skills/business-analyse/templates/frd-brd.md +97 -0
  100. package/templates/skills/business-analyse/templates/frd-discovery.md +78 -0
  101. package/templates/skills/business-analyse/templates/frd-handoff.md +118 -0
  102. package/templates/skills/business-analyse/templates/frd-spec.md +168 -0
  103. package/templates/skills/business-analyse/templates-frd.md +217 -217
  104. package/templates/skills/business-analyse/templates-react.md +26 -26
  105. package/templates/skills/controller/SKILL.md +141 -92
  106. package/templates/skills/controller/postman-templates.md +15 -15
  107. package/templates/skills/controller/steps/step-00-init.md +191 -0
  108. package/templates/skills/controller/steps/step-01-analyze.md +146 -0
  109. package/templates/skills/controller/steps/step-02-plan.md +176 -0
  110. package/templates/skills/controller/steps/step-03-generate.md +219 -0
  111. package/templates/skills/controller/steps/step-04-perms.md +219 -0
  112. package/templates/skills/controller/steps/step-05-validate.md +107 -0
  113. package/templates/skills/controller/templates.md +77 -77
  114. package/templates/skills/documentation/SKILL.md +79 -79
  115. package/templates/skills/feature-full/SKILL.md +38 -38
  116. package/templates/skills/gitflow/SKILL.md +277 -0
  117. package/templates/{commands → skills}/gitflow/_shared.md +20 -20
  118. package/templates/skills/gitflow/phases/abort.md +173 -0
  119. package/templates/skills/gitflow/phases/cleanup.md +226 -0
  120. package/templates/skills/gitflow/phases/status.md +178 -0
  121. package/templates/skills/gitflow/steps/step-commit.md +255 -0
  122. package/templates/skills/gitflow/steps/step-finish.md +255 -0
  123. package/templates/skills/gitflow/steps/step-init.md +209 -0
  124. package/templates/skills/gitflow/steps/step-merge.md +225 -0
  125. package/templates/skills/gitflow/steps/step-plan.md +208 -0
  126. package/templates/skills/gitflow/steps/step-pr.md +235 -0
  127. package/templates/skills/gitflow/steps/step-start.md +334 -0
  128. package/templates/skills/gitflow/steps/step-sync.md +200 -0
  129. package/templates/skills/gitflow/templates/config.json +53 -0
  130. package/templates/skills/notification/SKILL.md +51 -51
  131. package/templates/skills/ralph-loop/SKILL.md +228 -0
  132. package/templates/skills/ralph-loop/steps/step-00-init.md +201 -0
  133. package/templates/skills/ralph-loop/steps/step-01-task.md +169 -0
  134. package/templates/skills/ralph-loop/steps/step-02-execute.md +173 -0
  135. package/templates/skills/ralph-loop/steps/step-03-commit.md +170 -0
  136. package/templates/skills/ralph-loop/steps/step-04-check.md +162 -0
  137. package/templates/skills/ralph-loop/steps/step-05-report.md +181 -0
  138. package/templates/skills/review-code/SKILL.md +219 -0
  139. package/templates/skills/review-code/references/clean-code-principles.md +140 -0
  140. package/templates/skills/review-code/references/code-quality-metrics.md +174 -0
  141. package/templates/skills/review-code/references/feedback-patterns.md +149 -0
  142. package/templates/skills/review-code/references/security-checklist.md +127 -0
  143. package/templates/skills/ui-components/SKILL.md +54 -54
  144. package/templates/skills/workflow/SKILL.md +46 -46
  145. package/templates/commands/ai-prompt.md +0 -315
  146. package/templates/commands/apex/1-analyze.md +0 -100
  147. package/templates/commands/apex/2-plan.md +0 -145
  148. package/templates/commands/apex/3-execute.md +0 -171
  149. package/templates/commands/apex/4-examine.md +0 -116
  150. package/templates/commands/apex/5-tasks.md +0 -209
  151. package/templates/commands/apex.md +0 -76
  152. package/templates/commands/application/create.md +0 -362
  153. package/templates/commands/application/templates-backend.md +0 -463
  154. package/templates/commands/application/templates-frontend.md +0 -517
  155. package/templates/commands/application/templates-i18n.md +0 -478
  156. package/templates/commands/application/templates-seed.md +0 -362
  157. package/templates/commands/application.md +0 -303
  158. package/templates/commands/business-analyse/0-orchestrate.md +0 -156
  159. package/templates/commands/business-analyse/1-init.md +0 -99
  160. package/templates/commands/business-analyse/2-discover.md +0 -143
  161. package/templates/commands/business-analyse/3-analyse.md +0 -106
  162. package/templates/commands/business-analyse/4-specify.md +0 -133
  163. package/templates/commands/business-analyse/5-validate.md +0 -132
  164. package/templates/commands/business-analyse/6-handoff.md +0 -157
  165. package/templates/commands/business-analyse/7-doc-html.md +0 -103
  166. package/templates/commands/business-analyse/_shared.md +0 -176
  167. package/templates/commands/business-analyse/bug.md +0 -118
  168. package/templates/commands/business-analyse/change-request.md +0 -144
  169. package/templates/commands/business-analyse/hotfix.md +0 -116
  170. package/templates/commands/business-analyse.md +0 -121
  171. package/templates/commands/controller/create.md +0 -216
  172. package/templates/commands/controller/postman-templates.md +0 -528
  173. package/templates/commands/controller/templates.md +0 -600
  174. package/templates/commands/controller.md +0 -337
  175. package/templates/commands/create/agent.md +0 -138
  176. package/templates/commands/create/command.md +0 -166
  177. package/templates/commands/create/hook.md +0 -234
  178. package/templates/commands/create/plugin.md +0 -329
  179. package/templates/commands/create/project.md +0 -508
  180. package/templates/commands/create/skill.md +0 -199
  181. package/templates/commands/create.md +0 -220
  182. package/templates/commands/documentation/module.md +0 -202
  183. package/templates/commands/documentation/templates.md +0 -432
  184. package/templates/commands/documentation.md +0 -190
  185. package/templates/commands/epct.md +0 -69
  186. package/templates/commands/explain.md +0 -186
  187. package/templates/commands/feature-full.md +0 -267
  188. package/templates/commands/gitflow/1-init.md +0 -188
  189. package/templates/commands/gitflow/10-start.md +0 -190
  190. package/templates/commands/gitflow/11-finish.md +0 -382
  191. package/templates/commands/gitflow/12-cleanup.md +0 -103
  192. package/templates/commands/gitflow/13-sync.md +0 -216
  193. package/templates/commands/gitflow/14-rebase.md +0 -251
  194. package/templates/commands/gitflow/2-status.md +0 -122
  195. package/templates/commands/gitflow/3-commit.md +0 -209
  196. package/templates/commands/gitflow/4-plan.md +0 -174
  197. package/templates/commands/gitflow/5-exec.md +0 -202
  198. package/templates/commands/gitflow/6-abort.md +0 -121
  199. package/templates/commands/gitflow/7-pull-request.md +0 -176
  200. package/templates/commands/gitflow/8-review.md +0 -113
  201. package/templates/commands/gitflow/9-merge.md +0 -157
  202. package/templates/commands/gitflow.md +0 -128
  203. package/templates/commands/implement.md +0 -663
  204. package/templates/commands/init.md +0 -567
  205. package/templates/commands/mcp-integration.md +0 -330
  206. package/templates/commands/notification.md +0 -129
  207. package/templates/commands/oneshot.md +0 -57
  208. package/templates/commands/quickstart.md +0 -154
  209. package/templates/commands/ralph-loop/cancel-ralph.md +0 -18
  210. package/templates/commands/ralph-loop/help.md +0 -126
  211. package/templates/commands/ralph-loop/ralph-loop.md +0 -120
  212. package/templates/commands/review.md +0 -106
  213. package/templates/commands/workflow.md +0 -193
  214. package/templates/gitflow/config.json +0 -138
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: step-04-check
3
+ description: Check completion criteria and decide next action
4
+ next_step: steps/step-05-report.md OR steps/step-01-task.md
5
+ ---
6
+
7
+ # Step 4: Check Completion
8
+
9
+ ## YOUR TASK:
10
+
11
+ Check if all tasks are complete and decide whether to output completion promise or continue to next task.
12
+
13
+ ---
14
+
15
+ ## EXECUTION SEQUENCE:
16
+
17
+ ### 1. Read Current State
18
+
19
+ **Load prd.json:**
20
+
21
+ ```javascript
22
+ const prd = readJSON('.ralph/prd.json');
23
+ const tasksCompleted = prd.tasks.filter(t => t.passes).length;
24
+ const tasksTotal = prd.tasks.length;
25
+ const allComplete = tasksCompleted === tasksTotal;
26
+ ```
27
+
28
+ ### 2. Check Iteration Limit
29
+
30
+ **If {current_iteration} >= {max_iterations}:**
31
+
32
+ ```
33
+ ╔══════════════════════════════════════════════════════════════════╗
34
+ ║ ⚠️ MAX ITERATIONS REACHED ║
35
+ ╠══════════════════════════════════════════════════════════════════╣
36
+ ║ Iterations: {current_iteration} / {max_iterations} ║
37
+ ║ Tasks: {tasksCompleted} / {tasksTotal} complete ║
38
+ ╠══════════════════════════════════════════════════════════════════╣
39
+ ║ Ralph loop stopped due to iteration limit. ║
40
+ ║ Remaining tasks: ║
41
+ ║ {list of tasks with passes: false} ║
42
+ ╚══════════════════════════════════════════════════════════════════╝
43
+
44
+ -> Generating partial report...
45
+ ```
46
+
47
+ **Proceed to step-05-report.md**
48
+
49
+ ### 3. Check All Tasks Complete
50
+
51
+ **If allComplete = true:**
52
+
53
+ ```
54
+ ╔══════════════════════════════════════════════════════════════════╗
55
+ ║ ✅ ALL TASKS COMPLETE ║
56
+ ╠══════════════════════════════════════════════════════════════════╣
57
+ ║ Iterations: {current_iteration} ║
58
+ ║ Tasks: {tasksTotal} / {tasksTotal} complete ║
59
+ ╠══════════════════════════════════════════════════════════════════╣
60
+ ║ Output completion promise: ║
61
+ ║ <promise>{completion_promise}</promise> ║
62
+ ╚══════════════════════════════════════════════════════════════════╝
63
+
64
+ <promise>{completion_promise}</promise>
65
+ ```
66
+
67
+ **CRITICAL: Output the promise tag exactly as shown:**
68
+ ```
69
+ <promise>{completion_promise}</promise>
70
+ ```
71
+
72
+ **Proceed to step-05-report.md**
73
+
74
+ ### 4. More Tasks Remaining
75
+
76
+ **If allComplete = false AND iteration < max_iterations:**
77
+
78
+ ```
79
+ Progress: {tasksCompleted} / {tasksTotal} tasks
80
+
81
+ Next task:
82
+ [{next_task_id}] {next_task_description}
83
+
84
+ Continuing to next iteration...
85
+ ```
86
+
87
+ **Loop back to step-01-task.md**
88
+
89
+ ---
90
+
91
+ ## DECISION TREE:
92
+
93
+ ```
94
+ ┌─────────────────────┐
95
+ │ Check Completion │
96
+ └──────────┬──────────┘
97
+
98
+ ┌────────────────┼────────────────┐
99
+ │ │ │
100
+ ▼ ▼ ▼
101
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
102
+ │ Max Iters │ │ All Tasks │ │ Tasks │
103
+ │ Reached │ │ Complete │ │ Remaining │
104
+ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘
105
+ │ │ │
106
+ ▼ ▼ ▼
107
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
108
+ │ Partial │ │ Output │ │ Loop to │
109
+ │ Report │ │ Promise │ │ step-01 │
110
+ │ step-05 │ │ step-05 │ │ │
111
+ └──────────────┘ └──────────────┘ └──────────────┘
112
+ ```
113
+
114
+ ---
115
+
116
+ ## OUTPUT FORMAT:
117
+
118
+ **If continuing:**
119
+ ```
120
+ Completion Check:
121
+
122
+ | Field | Value |
123
+ |-------|-------|
124
+ | Iteration | {current_iteration} / {max_iterations} |
125
+ | Tasks | {tasksCompleted} / {tasksTotal} |
126
+ | Status | Continuing |
127
+ | Next | [{next_task_id}] {next_task_description} |
128
+
129
+ -> Loading next task...
130
+ ```
131
+
132
+ **If complete:**
133
+ ```
134
+ Completion Check:
135
+
136
+ | Field | Value |
137
+ |-------|-------|
138
+ | Iteration | {current_iteration} |
139
+ | Tasks | {tasksTotal} / {tasksTotal} |
140
+ | Status | COMPLETE |
141
+
142
+ <promise>{completion_promise}</promise>
143
+
144
+ -> Generating report...
145
+ ```
146
+
147
+ ---
148
+
149
+ ## CRITICAL RULE:
150
+
151
+ **NEVER output the completion promise unless:**
152
+ 1. ALL tasks have `passes: true`
153
+ 2. The statement is genuinely true
154
+
155
+ **False promises to escape the loop are FORBIDDEN.**
156
+
157
+ ---
158
+
159
+ ## NEXT STEP:
160
+
161
+ - If complete or max iterations: `./step-05-report.md`
162
+ - If tasks remaining: `./step-01-task.md`
@@ -0,0 +1,181 @@
1
+ ---
2
+ name: step-05-report
3
+ description: Generate final feature report
4
+ next_step: null
5
+ ---
6
+
7
+ # Step 5: Generate Report
8
+
9
+ ## YOUR TASK:
10
+
11
+ Generate a comprehensive feature report documenting what was accomplished.
12
+
13
+ ---
14
+
15
+ ## EXECUTION SEQUENCE:
16
+
17
+ ### 1. Gather Statistics
18
+
19
+ **Collect data from prd.json and progress.txt:**
20
+
21
+ ```javascript
22
+ const prd = readJSON('.ralph/prd.json');
23
+ const stats = {
24
+ feature: prd.feature,
25
+ started: prd.created,
26
+ completed: new Date().toISOString(),
27
+ iterations: prd.current_iteration,
28
+ maxIterations: prd.max_iterations,
29
+ tasksCompleted: prd.tasks.filter(t => t.passes).length,
30
+ tasksTotal: prd.tasks.length,
31
+ status: allComplete ? "COMPLETE" : "PARTIAL"
32
+ };
33
+ ```
34
+
35
+ ### 2. Collect File Changes
36
+
37
+ **Get files from git log:**
38
+
39
+ ```bash
40
+ git log --name-status --pretty=format:"%H" HEAD~{iterations}..HEAD
41
+ ```
42
+
43
+ **Categorize:**
44
+ - Files created (A)
45
+ - Files modified (M)
46
+ - Files deleted (D)
47
+
48
+ ### 3. Collect MCP Usage
49
+
50
+ **From verbose logs (if available):**
51
+
52
+ ```javascript
53
+ const mcpStats = {
54
+ validate_conventions: X,
55
+ check_migrations: Y,
56
+ scaffold_extension: Z,
57
+ context7_queries: W
58
+ };
59
+ ```
60
+
61
+ ### 4. Generate Report File
62
+
63
+ **Write to `.ralph/reports/{feature-slug}.md`:**
64
+
65
+ ```markdown
66
+ # Feature Report: {feature}
67
+
68
+ ## Summary
69
+ - **Started**: {started}
70
+ - **Completed**: {completed}
71
+ - **Duration**: {iterations} iterations
72
+ - **Status**: {status}
73
+
74
+ ## Task Progress
75
+
76
+ | # | Task | Status |
77
+ |---|------|--------|
78
+ | 1 | {task_1_description} | ✅ |
79
+ | 2 | {task_2_description} | ✅ |
80
+ | 3 | {task_3_description} | ❌ (if incomplete) |
81
+
82
+ ## MCP Usage Statistics
83
+
84
+ | Tool | Calls | Success | Failures |
85
+ |------|-------|---------|----------|
86
+ | validate_conventions | X | X | 0 |
87
+ | check_migrations | Y | Y | 0 |
88
+ | scaffold_extension | Z | Z | 0 |
89
+ | context7 query-docs | W | W | 0 |
90
+
91
+ ## Files Created
92
+
93
+ ```
94
+ {list of created files}
95
+ ```
96
+
97
+ ## Files Modified
98
+
99
+ ```
100
+ {list of modified files}
101
+ ```
102
+
103
+ ## Git Commits
104
+
105
+ ```
106
+ {commit_hash_1} feat(ralph): {message_1}
107
+ {commit_hash_2} feat(ralph): {message_2}
108
+ ```
109
+
110
+ ## Validations Performed
111
+
112
+ - [x] SmartStack conventions validated
113
+ - [x] EF Core migrations checked (if applicable)
114
+ - [x] No conflicts detected
115
+ - [x] Build passes
116
+ - [x] Tests pass (if applicable)
117
+
118
+ ## Key Learnings
119
+
120
+ {Extracted from progress.txt - key insights from each iteration}
121
+
122
+ ## Notes
123
+
124
+ {Any additional observations about the implementation}
125
+ ```
126
+
127
+ ### 5. Display Final Summary
128
+
129
+ ```
130
+ ╔══════════════════════════════════════════════════════════════════╗
131
+ ║ RALPH LOOP COMPLETE ║
132
+ ╠══════════════════════════════════════════════════════════════════╣
133
+ ║ Feature: {feature} ║
134
+ ║ Status: {status} ║
135
+ ║ Iterations: {iterations} ║
136
+ ║ Tasks: {tasksCompleted} / {tasksTotal} ║
137
+ ╠══════════════════════════════════════════════════════════════════╣
138
+ ║ Files Created: {created_count} ║
139
+ ║ Files Modified: {modified_count} ║
140
+ ║ Commits: {commit_count} ║
141
+ ╠══════════════════════════════════════════════════════════════════╣
142
+ ║ Report saved to: ║
143
+ ║ .ralph/reports/{feature-slug}.md ║
144
+ ╚══════════════════════════════════════════════════════════════════╝
145
+ ```
146
+
147
+ ### 6. Output Completion (if applicable)
148
+
149
+ **If all tasks complete and not already output:**
150
+
151
+ ```
152
+ <promise>{completion_promise}</promise>
153
+ ```
154
+
155
+ ---
156
+
157
+ ## CLEANUP OPTIONS:
158
+
159
+ **Suggest to user:**
160
+
161
+ ```
162
+ Next steps:
163
+ 1. Review report: .ralph/reports/{feature-slug}.md
164
+ 2. Run full test suite: dotnet test
165
+ 3. Create PR: /gitflow:7-pull-request
166
+ 4. Clean up Ralph files: rm -rf .ralph/
167
+ ```
168
+
169
+ ---
170
+
171
+ ## SUCCESS CRITERIA:
172
+
173
+ - Report generated in `.ralph/reports/`
174
+ - All statistics accurate
175
+ - File lists complete
176
+ - Learnings documented
177
+ - Final summary displayed
178
+
179
+ ## COMPLETION:
180
+
181
+ Ralph loop complete. No more steps.
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: review-code
3
+ description: This skill should be used when the user asks to "review code", "review this PR", "code review", "audit this code", or mentions reviewing pull requests, security checks, or code quality. Covers security (OWASP), clean code (SOLID), code smells, complexity metrics, and high-value feedback patterns. Focuses on impactful issues, not nitpicks.
4
+ ---
5
+
6
+ <objective>
7
+ Provide expert-level code review guidance that focuses on high-impact issues: security vulnerabilities, logic errors, maintainability problems, and architectural concerns. Skip nitpicks and style issues that should be automated.
8
+
9
+ Based on research from Google, Microsoft, OWASP, and academic studies on code review effectiveness.
10
+ </objective>
11
+
12
+ <quick_start>
13
+ <review_priority>
14
+ **Priority order**: Security > Correctness > Maintainability > Performance
15
+
16
+ **High-value feedback** (36-43% implementation rate):
17
+ - Bug fixes and logic errors
18
+ - Security vulnerabilities
19
+ - Readability/maintainability issues
20
+ - Missing error handling
21
+
22
+ **Skip these** (automate instead):
23
+ - Formatting/whitespace
24
+ - Simple naming conventions
25
+ - Linting violations
26
+ </review_priority>
27
+
28
+ <essential_checks>
29
+ 1. **Security**: Input validation, auth checks, secrets exposure
30
+ 2. **Logic**: Edge cases, error handling, null checks
31
+ 3. **Architecture**: Single responsibility, proper abstractions
32
+ 4. **Tests**: Coverage for new functionality
33
+ </essential_checks>
34
+ </quick_start>
35
+
36
+ <review_categories>
37
+ <category name="security" priority="critical">
38
+ **Must check in every review:**
39
+ - No hardcoded credentials (search: `password.*=.*['"]`, `api[_-]?key.*=`)
40
+ - Input validation on all user data
41
+ - Parameterized queries (no string concatenation for SQL)
42
+ - Authorization checks on every endpoint
43
+ - No `eval()`, `exec()`, dangerous functions
44
+
45
+ See [references/security-checklist.md](references/security-checklist.md) for OWASP Top 10 patterns.
46
+ </category>
47
+
48
+ <category name="logic" priority="critical">
49
+ **Verify correctness:**
50
+ - Business logic matches requirements
51
+ - Edge cases handled (null, empty, boundary values)
52
+ - Error handling present and appropriate
53
+ - Race conditions in async code
54
+ - Resource cleanup (connections, file handles)
55
+ </category>
56
+
57
+ <category name="clean_code" priority="high">
58
+ **Check for code smells:**
59
+ - Large functions (>50 lines) - violate Single Responsibility
60
+ - Deep nesting (>3 levels) - extract to functions
61
+ - Long parameter lists (>3 params) - use objects
62
+ - Duplicated code - extract to shared functions
63
+ - Magic numbers/strings - use named constants
64
+
65
+ See [references/clean-code-principles.md](references/clean-code-principles.md) for SOLID principles and code smells.
66
+ </category>
67
+
68
+ <category name="maintainability" priority="medium">
69
+ **Assess long-term health:**
70
+ - Cognitive complexity <15 per function
71
+ - Clear naming that reveals intent
72
+ - Appropriate abstractions (not over-engineered)
73
+ - Test coverage for critical paths
74
+ </category>
75
+ </review_categories>
76
+
77
+ <feedback_guidelines>
78
+ <valuable_feedback>
79
+ **Structure**: What + Why + How
80
+
81
+ ✓ "This function is 80 lines with 5 responsibilities. Consider extracting the validation logic (lines 20-45) into `validateUserInput()` for testability."
82
+
83
+ ✓ "SQL query uses string concatenation (line 34). Use parameterized queries to prevent injection: `db.query('SELECT * FROM users WHERE id = ?', [userId])`"
84
+
85
+ ✓ "Missing null check on `user.profile` (line 52). This will throw if user hasn't completed onboarding. Add: `if (!user.profile) return defaultProfile;`"
86
+ </valuable_feedback>
87
+
88
+ <wasteful_feedback>
89
+ ✗ "This could be cleaner" (vague)
90
+ ✗ "Rename this variable" (nitpick - use linter)
91
+ ✗ "Add a comment here" (if code is clear, no comment needed)
92
+ ✗ "I would do this differently" (subjective without reason)
93
+ </wasteful_feedback>
94
+
95
+ <priority_labels>
96
+ Use clear labels to distinguish severity:
97
+ - **[BLOCKING]**: Must fix before merge (security, bugs)
98
+ - **[SUGGESTION]**: Would improve code but not required
99
+ - **[NIT]**: Minor preference (mark clearly or skip entirely)
100
+
101
+ See [references/feedback-patterns.md](references/feedback-patterns.md) for communication strategies.
102
+ </priority_labels>
103
+ </feedback_guidelines>
104
+
105
+ <code_quality_metrics>
106
+ <metric name="cognitive_complexity">
107
+ - Target: <15 per function, <50 per module
108
+ - Each nesting level adds complexity
109
+ - Prefer early returns over deep nesting
110
+ </metric>
111
+
112
+ <metric name="function_size">
113
+ - Target: <50 lines, ideally <20
114
+ - Should fit on one screen
115
+ - One function = one responsibility
116
+ </metric>
117
+
118
+ <metric name="cyclomatic_complexity">
119
+ - Target: <10 per function
120
+ - Count: 1 + (if + while + for + case + catch + && + ||)
121
+ - High complexity = hard to test
122
+ </metric>
123
+
124
+ See [references/code-quality-metrics.md](references/code-quality-metrics.md) for detailed calculations.
125
+ </code_quality_metrics>
126
+
127
+ <anti_patterns>
128
+ <pattern name="nitpicking">
129
+ **Problem**: Excessive minor comments bury critical issues
130
+ **Impact**: Developers become defensive, stop reading feedback
131
+ **Solution**: Automate style with linters; focus humans on logic/security
132
+ </pattern>
133
+
134
+ <pattern name="vague_criticism">
135
+ **Problem**: "This is wrong" without explanation
136
+ **Impact**: Developer doesn't know how to fix; creates friction
137
+ **Solution**: Always include What + Why + How
138
+ </pattern>
139
+
140
+ <pattern name="blocking_on_preferences">
141
+ **Problem**: Blocking merge for subjective style preferences
142
+ **Impact**: Delays delivery; damages team trust
143
+ **Solution**: Reserve blocking for security/correctness only
144
+ </pattern>
145
+
146
+ <pattern name="reviewing_unchanged_code">
147
+ **Problem**: Commenting on code outside the PR diff
148
+ **Impact**: Scope creep; unfair to author
149
+ **Solution**: Focus only on changed lines; file separate issues for existing problems
150
+ </pattern>
151
+ </anti_patterns>
152
+
153
+ <react_nextjs_review>
154
+ ## React/Next.js Codebase Detection
155
+
156
+ **When reviewing a React or Next.js project**, launch an additional parallel agent for Vercel React best practices.
157
+
158
+ <detection>
159
+ **Detect React/Next.js codebase by checking:**
160
+ - `package.json` contains `"next"` or `"react"` dependencies
161
+ - Files with `.tsx`, `.jsx` extensions in changes
162
+ - `next.config.js` or `next.config.ts` exists
163
+ - `app/` or `pages/` directory structure (Next.js)
164
+ </detection>
165
+
166
+ <parallel_agent>
167
+ **If React/Next.js detected, launch parallel agent:**
168
+
169
+ ```yaml
170
+ agent:
171
+ type: code-reviewer
172
+ focus: "vercel-react-best-practices"
173
+ task: |
174
+ Review the recent code changes using Vercel React best practices.
175
+ Focus on:
176
+ - Eliminating waterfalls (async patterns, Promise.all)
177
+ - Bundle size optimization (dynamic imports, barrel files)
178
+ - Server-side performance (caching, serialization)
179
+ - Re-render optimization (memoization, state management)
180
+ - Rendering performance patterns
181
+
182
+ Use the /vercel-react-best-practices skill as reference.
183
+ Report findings with [BLOCKING], [SUGGESTION], or [NIT] labels.
184
+ ```
185
+
186
+ **Execution:**
187
+ 1. Check for React/Next.js in `package.json`
188
+ 2. If detected, use Task tool to launch parallel agent:
189
+ ```
190
+ Task tool with subagent_type="code-reviewer":
191
+ "Review recent changes against Vercel React best practices from /vercel-react-best-practices skill.
192
+ Focus on: async patterns, bundle optimization, server performance, re-renders.
193
+ Check changed files for violations of rules like async-parallel, bundle-barrel-imports,
194
+ server-cache-react, rerender-memo. Report with priority labels."
195
+ ```
196
+ 3. Merge findings into main review output
197
+ </parallel_agent>
198
+ </react_nextjs_review>
199
+
200
+ <success_criteria>
201
+ A good code review:
202
+ - Identifies security vulnerabilities (if any)
203
+ - Catches logic errors and edge cases
204
+ - Flags maintainability issues with specific fixes
205
+ - Uses priority labels ([BLOCKING] vs [SUGGESTION])
206
+ - Provides actionable feedback (What + Why + How)
207
+ - Avoids nitpicks on style/formatting
208
+ - Completes in reasonable time (<4 hours for small PRs)
209
+ - **[React/Next.js]** Includes Vercel best practices review when applicable
210
+ </success_criteria>
211
+
212
+ <reference_guides>
213
+ For detailed guidance and patterns:
214
+
215
+ - **`references/security-checklist.md`** - OWASP Top 10, authentication patterns, input validation, common vulnerabilities
216
+ - **`references/clean-code-principles.md`** - SOLID principles, naming conventions, function design, code smell detection
217
+ - **`references/feedback-patterns.md`** - Valuable vs wasteful feedback patterns, communication strategies, priority labeling
218
+ - **`references/code-quality-metrics.md`** - Complexity calculations, maintainability index, measurement techniques
219
+ </reference_guides>
@@ -0,0 +1,140 @@
1
+ <overview>
2
+ Clean code principles based on Robert Martin's Clean Code and industry research. SOLID principles, naming conventions, and code smell detection.
3
+ </overview>
4
+
5
+ <solid_principles>
6
+ | Principle | Rule | Violation Sign |
7
+ |-----------|------|----------------|
8
+ | **S**ingle Responsibility | One reason to change | Class/function does multiple things |
9
+ | **O**pen/Closed | Open for extension, closed for modification | Adding features requires changing existing code |
10
+ | **L**iskov Substitution | Subtypes must be substitutable | Subclass breaks when used as parent |
11
+ | **I**nterface Segregation | No forced dependencies | Implementing unused interface methods |
12
+ | **D**ependency Inversion | Depend on abstractions | Direct instantiation of dependencies |
13
+ </solid_principles>
14
+
15
+ <function_guidelines>
16
+ <size_and_scope>
17
+ Function size targets:
18
+
19
+ - Maximum 50 lines (ideally <20)
20
+ - Do ONE thing well
21
+ - Single level of abstraction
22
+ - Fit on one screen without scrolling
23
+ </size_and_scope>
24
+
25
+ <parameters>
26
+ Parameter limits:
27
+
28
+ - Maximum 3 parameters
29
+ - Avoid flag arguments (split into separate methods)
30
+ - Use objects for related parameters
31
+ </parameters>
32
+
33
+ <naming>
34
+ Function naming patterns:
35
+
36
+ - Verbs for functions: `getUserById()`, `calculateTotal()`
37
+ - Reveals intent without reading body
38
+ - No abbreviations: `getTransaction()` not `getTx()`
39
+ </naming>
40
+ </function_guidelines>
41
+
42
+ <naming_conventions>
43
+ General naming rules:
44
+
45
+ ✓ Descriptive, unambiguous names
46
+ ✓ Pronounceable and searchable
47
+ ✓ Class names: nouns (User, PaymentProcessor)
48
+ ✓ Method names: verbs (validate, calculate, fetch)
49
+ ✗ Single letter variables (except loop counters)
50
+ ✗ Hungarian notation (strName, intCount)
51
+ ✗ Abbreviations (usr, txn, cfg)
52
+ </naming_conventions>
53
+
54
+ <code_smells>
55
+ <critical_smells>
56
+ Flag these in review:
57
+
58
+ | Smell | Detection | Fix |
59
+ |-------|-----------|-----|
60
+ | **Duplicated Code** | Same logic in 2+ places | Extract to shared function |
61
+ | **Large Class/Method** | >50 lines, multiple responsibilities | Split by responsibility |
62
+ | **Long Parameter List** | >3 parameters | Use parameter object |
63
+ | **Feature Envy** | Method uses another class's data more | Move method to that class |
64
+ | **God Object** | One class controls everything | Split into focused classes |
65
+ </critical_smells>
66
+
67
+ <medium_smells>
68
+ Suggest these fixes:
69
+
70
+ | Smell | Detection | Fix |
71
+ |-------|-----------|-----|
72
+ | **Deep Nesting** | >3 levels of indentation | Guard clauses, early returns |
73
+ | **Magic Numbers** | Unexplained literals | Named constants |
74
+ | **Dead Code** | Commented-out or unreachable code | Delete it |
75
+ | **Shotgun Surgery** | Small change touches many files | Consolidate related code |
76
+ </medium_smells>
77
+ </code_smells>
78
+
79
+ <complexity_reduction>
80
+ <example_before>
81
+ Complex nested conditions:
82
+
83
+ ```javascript
84
+ function process(user) {
85
+ if (user) {
86
+ if (user.isActive) {
87
+ if (user.hasPermission) {
88
+ // actual logic here
89
+ }
90
+ }
91
+ }
92
+ }
93
+ ```
94
+ </example_before>
95
+
96
+ <example_after>
97
+ Simplified with guard clauses:
98
+
99
+ ```javascript
100
+ function process(user) {
101
+ if (!user) return;
102
+ if (!user.isActive) return;
103
+ if (!user.hasPermission) return;
104
+
105
+ // actual logic here
106
+ }
107
+ ```
108
+ </example_after>
109
+ </complexity_reduction>
110
+
111
+ <comments_best_practices>
112
+ <good_comments>
113
+ Valuable comments explain:
114
+
115
+ - Explain WHY (intent), not WHAT (code does that)
116
+ - Warn of consequences
117
+ - TODO with ticket number
118
+ </good_comments>
119
+
120
+ <bad_comments>
121
+ Avoid these comment types:
122
+
123
+ - Redundant (restates the code)
124
+ - Commented-out code (delete it)
125
+ - Closing brace comments (`} // end if`)
126
+ - Journal comments (use git history)
127
+ </bad_comments>
128
+ </comments_best_practices>
129
+
130
+ <boy_scout_rule>
131
+ > Leave code cleaner than you found it.
132
+
133
+ **Important**: In PRs, only clean code already being changed. Don't expand scope.
134
+ </boy_scout_rule>
135
+
136
+ <sources>
137
+ - Clean Code by Robert C. Martin
138
+ - [Google Engineering Practices](https://google.github.io/eng-practices/)
139
+ - [Microsoft Code Review Guide](https://microsoft.github.io/code-with-engineering-playbook/)
140
+ </sources>