@stacksjs/defaults 0.72.102 → 0.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/ai/AGENTS.md +25 -4
  2. package/ai/README.md +26 -4
  3. package/ai/skills/stacks-actions/SKILL.md +1 -1
  4. package/ai/skills/stacks-ai/SKILL.md +1 -1
  5. package/ai/skills/stacks-alias/SKILL.md +1 -1
  6. package/ai/skills/stacks-analytics/SKILL.md +1 -1
  7. package/ai/skills/stacks-api/SKILL.md +1 -1
  8. package/ai/skills/stacks-arrays/SKILL.md +1 -1
  9. package/ai/skills/stacks-auto-imports/SKILL.md +1 -1
  10. package/ai/skills/stacks-browse/SKILL.md +1 -1
  11. package/ai/skills/stacks-browser/SKILL.md +1 -1
  12. package/ai/skills/stacks-buddy/SKILL.md +1 -1
  13. package/ai/skills/stacks-build/SKILL.md +79 -5
  14. package/ai/skills/stacks-cache/SKILL.md +1 -1
  15. package/ai/skills/stacks-calendar/SKILL.md +1 -1
  16. package/ai/skills/stacks-chat/SKILL.md +1 -1
  17. package/ai/skills/stacks-cli/SKILL.md +1 -1
  18. package/ai/skills/stacks-cloud/SKILL.md +1 -1
  19. package/ai/skills/stacks-cms/SKILL.md +1 -1
  20. package/ai/skills/stacks-codebase-design/DEEPENING.md +79 -0
  21. package/ai/skills/stacks-codebase-design/DESIGN-IT-TWICE.md +72 -0
  22. package/ai/skills/stacks-codebase-design/SKILL.md +180 -0
  23. package/ai/skills/stacks-collections/SKILL.md +1 -1
  24. package/ai/skills/stacks-commerce/SKILL.md +141 -35
  25. package/ai/skills/stacks-composables/SKILL.md +1 -1
  26. package/ai/skills/stacks-config/SKILL.md +1 -1
  27. package/ai/skills/stacks-configuration/SKILL.md +1 -1
  28. package/ai/skills/stacks-cron/SKILL.md +1 -1
  29. package/ai/skills/stacks-crosswind/SKILL.md +1 -1
  30. package/ai/skills/stacks-database/SKILL.md +1 -1
  31. package/ai/skills/stacks-datetime/SKILL.md +1 -1
  32. package/ai/skills/stacks-dependencies/SKILL.md +1 -1
  33. package/ai/skills/stacks-deploy/SKILL.md +1 -1
  34. package/ai/skills/stacks-desktop/SKILL.md +1 -1
  35. package/ai/skills/stacks-development/SKILL.md +1 -1
  36. package/ai/skills/stacks-dns/SKILL.md +1 -1
  37. package/ai/skills/stacks-docs/SKILL.md +1 -1
  38. package/ai/skills/stacks-domain-modeling/FORMATS.md +123 -0
  39. package/ai/skills/stacks-domain-modeling/SKILL.md +109 -0
  40. package/ai/skills/stacks-enums/SKILL.md +1 -1
  41. package/ai/skills/stacks-error-handling/SKILL.md +1 -1
  42. package/ai/skills/stacks-events/SKILL.md +1 -1
  43. package/ai/skills/stacks-faker/SKILL.md +1 -1
  44. package/ai/skills/stacks-flow/PHASE-BOUNDARIES.md +91 -0
  45. package/ai/skills/stacks-flow/SKILL.md +117 -0
  46. package/ai/skills/stacks-git/SKILL.md +37 -9
  47. package/ai/skills/stacks-grilling/SKILL.md +85 -0
  48. package/ai/skills/stacks-guard/SKILL.md +86 -11
  49. package/ai/skills/stacks-guard/scripts/block-destructive.sh +67 -0
  50. package/ai/skills/stacks-handoff/SKILL.md +70 -0
  51. package/ai/skills/stacks-health/SKILL.md +1 -1
  52. package/ai/skills/stacks-http/SKILL.md +1 -1
  53. package/ai/skills/stacks-i18n/SKILL.md +1 -1
  54. package/ai/skills/stacks-investigate/SKILL.md +234 -106
  55. package/ai/skills/stacks-investigate/scripts/hitl-loop.template.sh +47 -0
  56. package/ai/skills/stacks-jobs/SKILL.md +1 -1
  57. package/ai/skills/stacks-listeners/SKILL.md +1 -1
  58. package/ai/skills/stacks-logging/SKILL.md +1 -1
  59. package/ai/skills/stacks-mail/SKILL.md +1 -1
  60. package/ai/skills/stacks-middleware/SKILL.md +1 -1
  61. package/ai/skills/stacks-migrations/SKILL.md +1 -1
  62. package/ai/skills/stacks-models/SKILL.md +1 -1
  63. package/ai/skills/stacks-new-feature/SKILL.md +65 -5
  64. package/ai/skills/stacks-notifications/SKILL.md +1 -1
  65. package/ai/skills/stacks-objects/SKILL.md +1 -1
  66. package/ai/skills/stacks-office-hours/SKILL.md +16 -2
  67. package/ai/skills/stacks-orm/SKILL.md +1 -1
  68. package/ai/skills/stacks-path/SKILL.md +1 -1
  69. package/ai/skills/stacks-payments/SKILL.md +35 -1
  70. package/ai/skills/stacks-plan-review/SKILL.md +27 -6
  71. package/ai/skills/stacks-plugins/SKILL.md +1 -1
  72. package/ai/skills/stacks-prototype/LOGIC.md +103 -0
  73. package/ai/skills/stacks-prototype/SKILL.md +66 -0
  74. package/ai/skills/stacks-prototype/UI.md +112 -0
  75. package/ai/skills/stacks-push/SKILL.md +1 -1
  76. package/ai/skills/stacks-query-builder/SKILL.md +1 -1
  77. package/ai/skills/stacks-queue/SKILL.md +1 -1
  78. package/ai/skills/stacks-realtime/SKILL.md +1 -1
  79. package/ai/skills/stacks-registry/SKILL.md +1 -1
  80. package/ai/skills/stacks-repl/SKILL.md +1 -1
  81. package/ai/skills/stacks-retro/SKILL.md +121 -75
  82. package/ai/skills/stacks-review/SKILL.md +182 -74
  83. package/ai/skills/stacks-router/SKILL.md +1 -1
  84. package/ai/skills/stacks-routes/SKILL.md +1 -1
  85. package/ai/skills/stacks-scaffolding/SKILL.md +1 -1
  86. package/ai/skills/stacks-scheduler/SKILL.md +1 -1
  87. package/ai/skills/stacks-search-engine/SKILL.md +1 -1
  88. package/ai/skills/stacks-security/SKILL.md +1 -1
  89. package/ai/skills/stacks-security-audit/SKILL.md +1 -1
  90. package/ai/skills/stacks-server/SKILL.md +1 -1
  91. package/ai/skills/stacks-shell/SKILL.md +1 -1
  92. package/ai/skills/stacks-slug/SKILL.md +1 -1
  93. package/ai/skills/stacks-sms/SKILL.md +1 -1
  94. package/ai/skills/stacks-socials/SKILL.md +1 -1
  95. package/ai/skills/stacks-storage/SKILL.md +1 -1
  96. package/ai/skills/stacks-strings/SKILL.md +1 -1
  97. package/ai/skills/stacks-stx/SKILL.md +1 -1
  98. package/ai/skills/stacks-tdd/EXAMPLES.md +136 -0
  99. package/ai/skills/stacks-tdd/SKILL.md +125 -0
  100. package/ai/skills/stacks-testing/SKILL.md +13 -3
  101. package/ai/skills/stacks-tunnel/SKILL.md +1 -1
  102. package/ai/skills/stacks-types/SKILL.md +1 -1
  103. package/ai/skills/stacks-ui/SKILL.md +1 -1
  104. package/ai/skills/stacks-utils/SKILL.md +1 -1
  105. package/ai/skills/stacks-validation/SKILL.md +1 -1
  106. package/ai/skills/stacks-whois/SKILL.md +1 -1
  107. package/ai/skills/stacks-wizard/SKILL.md +127 -0
  108. package/ai/skills/stacks-wizard/scripts/template.sh +208 -0
  109. package/ai/skills/stacks-writing-for-agents/MECHANICS.md +125 -0
  110. package/ai/skills/stacks-writing-for-agents/SKILL.md +218 -0
  111. package/app/Actions/Auth/GenerateTwoFactorSecretAction.ts +12 -2
  112. package/app/Actions/Commerce/Shipping/{DriverDestroyAction.ts → CourierDestroyAction.ts} +6 -6
  113. package/app/Actions/Commerce/Shipping/{DriverIndexAction.ts → CourierIndexAction.ts} +3 -3
  114. package/app/Actions/Commerce/Shipping/CourierPingStoreAction.ts +61 -0
  115. package/app/Actions/Commerce/Shipping/{DriverShowAction.ts → CourierShowAction.ts} +5 -5
  116. package/app/Actions/Commerce/Shipping/{DriverStoreAction.ts → CourierStoreAction.ts} +4 -4
  117. package/app/Actions/Commerce/Shipping/{DriverUpdateAction.ts → CourierUpdateAction.ts} +6 -6
  118. package/app/Actions/Commerce/Shipping/DeliveryRouteStartAction.ts +38 -0
  119. package/app/Actions/Commerce/Shipping/DeliveryStopCompleteAction.ts +40 -0
  120. package/app/Actions/Commerce/Shipping/DeliveryStopFailAction.ts +44 -0
  121. package/app/Actions/Commerce/Shipping/DeliveryStopStartAction.ts +39 -0
  122. package/app/Actions/Commerce/Shipping/courier-session.ts +75 -0
  123. package/app/Actions/Commerce/commerce-action.test.ts +5 -5
  124. package/app/Actions/Dashboard/Commerce/CommerceDeliveryAction.ts +5 -5
  125. package/app/Actions/Dashboard/Commerce/CourierIndexAction.ts +24 -0
  126. package/app/Actions/Dashboard/Commerce/DeliveryRouteIndexAction.ts +7 -7
  127. package/app/Actions/Dashboard/Commerce/commerce-delivery.test.ts +11 -11
  128. package/app/Actions/Dashboard/Commerce/commerce-delivery.ts +29 -29
  129. package/app/Actions/Dashboard/Commerce/{driver-records.test.ts → courier-records.test.ts} +9 -9
  130. package/app/Actions/Dashboard/Commerce/{driver-records.ts → courier-records.ts} +14 -14
  131. package/app/Actions/Dashboard/Commerce/delivery-route-records.test.ts +13 -13
  132. package/app/Actions/Dashboard/Commerce/delivery-route-records.ts +25 -25
  133. package/app/Models/User.ts +1 -1
  134. package/app/Models/commerce/{Driver.ts → Courier.ts} +7 -7
  135. package/app/Models/commerce/{DriverPing.ts → CourierPing.ts} +7 -7
  136. package/app/Models/commerce/DeliveryRoute.ts +6 -6
  137. package/app/Models/commerce/DeliveryStop.ts +31 -8
  138. package/bootstrap.ts +7 -0
  139. package/functions/commerce/shippings/couriers.ts +19 -0
  140. package/ide/vscode/package.json +1 -1
  141. package/package.json +4 -3
  142. package/resources/components/Dashboard/Commerce/Delivery/{DriverDeleteDialog.stx → CourierDeleteDialog.stx} +5 -5
  143. package/resources/components/Dashboard/Commerce/Delivery/{DriverDialog.stx → CourierDialog.stx} +10 -10
  144. package/resources/components/Dashboard/Commerce/Delivery/{DriversDashboard.stx → CouriersDashboard.stx} +43 -43
  145. package/resources/components/Dashboard/Commerce/Delivery/{DriversTable.stx → CouriersTable.stx} +21 -21
  146. package/resources/components/Dashboard/Commerce/Delivery/DeliveryOverviewDashboard.stx +18 -18
  147. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDeleteDialog.stx +2 -2
  148. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +22 -22
  149. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesDashboard.stx +24 -24
  150. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +8 -8
  151. package/resources/components/Dashboard/Commerce/Delivery/TabNavigation.stx +1 -1
  152. package/resources/functions/dashboard/data.ts +1 -1
  153. package/resources/functions/dashboard/sidebar.ts +2 -2
  154. package/routes/dashboard-api.ts +6 -6
  155. package/routes/dashboard.ts +7 -7
  156. package/routes/delivery.ts +24 -0
  157. package/types/defaults.ts +3 -3
  158. package/views/dashboard/.discovered-models.json +18 -18
  159. package/views/dashboard/AUDIT.md +1 -1
  160. package/views/dashboard/commerce/delivery/{drivers.stx → couriers.stx} +2 -2
  161. package/views/dashboard/composables/useChart.ts +16 -2
  162. package/views/dashboard/layouts/default.stx +1 -1
  163. package/app/Actions/Dashboard/Commerce/DriverIndexAction.ts +0 -24
  164. package/functions/commerce/shippings/drivers.ts +0 -19
@@ -1,122 +1,168 @@
1
1
  ---
2
2
  name: stacks-retro
3
- description: Use for git-based session retrospectives — session detection, commit categorization, focus scores, streak counting, and behavioral observations. Invoke with /stacks-retro.
3
+ description: Use for a retrospective on Stacks work - proposing concrete improvements to the agent's environment (navigation pointers, automated checks, AGENTS.md, skills, tool economy) from what actually went wrong, backed by git-derived session data. Invoke with /stacks-retro.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
7
7
  ---
8
8
 
9
- # /stacks-retro — Session Retrospective
10
-
11
- Generate a retrospective analysis of recent development work based on git history.
12
-
13
- ## Step 1: Session Detection
14
-
15
- Detect sessions using a **45-minute gap threshold** between commits.
9
+ # /stacks-retro - session retrospective
10
+
11
+ A retrospective here is not a report card. You are proposing improvements to the
12
+ **environment** the next session runs in, so that the mistakes this session made
13
+ become impossible or cheap to catch. Pass 1 finds the improvements. Pass 2 backs
14
+ them with data from git.
15
+
16
+ Call the Skill tool with `stacks-writing-for-agents` before proposing any change
17
+ to a document. Half the candidates below are edits to files agents read, and a
18
+ retro that adds sediment to `AGENTS.md` has made things worse.
19
+
20
+ Credit: the environment-improvement framing is adapted from Matt Pocock's `retro`
21
+ skill (MIT), <https://github.com/mattpocock/skills>.
22
+
23
+ ## Pass 1: environment improvements
24
+
25
+ ### Read the primary sources
26
+
27
+ Read the session the user names, defaulting to the current one. Where the session
28
+ is not in context, reconstruct it from the diff, the commits, and any session
29
+ logs on this machine. Work from what actually happened, not from a summary.
30
+
31
+ ### Look for candidates in these categories
32
+
33
+ - **Navigation.** How easy was it to find the right file? Are there hidden
34
+ dependencies between files? Would a **navigation pointer** in `AGENTS.md`, or a
35
+ `Key paths` block in the relevant skill, have shortened it? *Use when* the
36
+ session spent a long time hunting for one piece of information.
37
+ - **Automated checks.** Could a check have caught this mistake? `pickier` rules,
38
+ a type, a test, a contract test in `tests/unit/`, a `buddy` command that
39
+ validates a registry. *Use when* the agent made a mistake a machine could have
40
+ caught. This is the strongest category, because a check does not depend on
41
+ anyone reading anything.
42
+ - **Coding standards.** Should the review get a new rule to enforce, or should an
43
+ existing one be removed or clarified? *Use when* `/stacks-review` missed
44
+ something it should have caught.
45
+ - **AGENTS.md.** Are there steering instructions that belong in a check or a
46
+ skill instead? Is anything in it a **no-op**, an instruction the model already
47
+ obeys by default? *Use when* the file is large and unwieldy, in the repo or in
48
+ the user's global scope.
49
+ - **Skills.** Did the agent guess at an API a skill documents? Then the skill's
50
+ **description** is the bug, not its body: the pointer did not fire. Did the
51
+ agent read a skill and still get it wrong? Then the body is the bug. Did the
52
+ work touch a subsystem with no skill? That is a new one under `app/Skills/`.
53
+ - **Tool economy.** Did the agent make expensive calls that could be streamlined?
54
+ Is a custom command or MCP server particularly token-inefficient? *Use when*
55
+ one call dominated the session.
56
+ - **Information access.** Could the agent have been given more? Teeing
57
+ `buddy dev` output to a file it can read, `storage/logs/stacks.log`, read-only
58
+ access to a dashboard or a third-party console. *Use when* a crucial fact was
59
+ simply not reachable.
60
+ - **Generated artifacts going stale.** Did the session trip over
61
+ `storage/framework/types/*.d.ts`, an auto-import manifest, or a migration that
62
+ no longer matched its model? The fix is usually a check that regenerates and
63
+ diffs in CI, not a line asking someone to remember.
64
+
65
+ ### Present them
66
+
67
+ In order of severity, each as: what happened, which category, the specific change
68
+ to make, and where it goes. Be concrete. "Add a note about migrations" is not a
69
+ candidate. "Add a contract test in `tests/unit/` that fails when
70
+ `database/types.d.ts` is missing a table any migration creates" is.
71
+
72
+ Ask before writing any of them.
73
+
74
+ ## Pass 2: the data
75
+
76
+ Back the observations with git rather than impressions.
77
+
78
+ ### Session detection
79
+
80
+ Detect sessions with a **45-minute gap threshold** between commits.
16
81
 
17
82
  ```bash
18
83
  git log --all --format="%H|%ai|%an|%s" --since="7 days ago"
19
84
  ```
20
85
 
21
- Adjust `--since` if user specifies a range ("today", "this week", etc.).
86
+ Adjust `--since` for the range the user asked for. Default to 7 days.
22
87
 
23
- ## Step 2: Commit Categorization
88
+ ### Commit categorization
24
89
 
25
90
  | Category | Indicators | Icon |
26
- |----------|-----------|------|
91
+ |---|---|---|
27
92
  | Feature | `feat:`, new files, new exports | 🟢 |
28
- | Fix | `fix:`, corrective changes | 🔴 |
29
- | Refactor | `refactor:`, structural changes | 🔵 |
93
+ | Fix | `fix:` | 🔴 |
94
+ | Refactor | `refactor:` | 🔵 |
30
95
  | Test | `test:`, test file changes | 🟡 |
31
96
  | Docs | `docs:`, README changes | 📝 |
32
97
  | Chore | `chore:`, deps, config, CI | ⚙️ |
33
98
  | Style | `style:`, formatting, lint | 🎨 |
34
99
 
35
- Parse `gitlint`-style conventional commit prefixes. Stacks uses these scopes: `core`, `auth`, `database`, `router`, `buddy`, `ui`, `build`, etc.
100
+ Parse the conventional-commit prefixes and the scopes from `config/git.ts`.
36
101
 
37
- ## Step 3: Session Analysis
102
+ ### Focus
38
103
 
39
- ### Focus Score (0-100)
40
104
  ```
41
- focus_score = (commits_in_primary_area / total_commits) × 100
105
+ focus = (commits in the primary area / total commits) × 100
42
106
  ```
43
107
 
44
- Primary area = most-touched `storage/framework/core/*/` package or top-level directory.
45
-
46
- - **80-100**: Deep focus
47
- - **50-79**: Moderate focus
48
- - **0-49**: Scattered
108
+ The primary area is the most-touched `storage/framework/core/*/` package or
109
+ top-level directory. 80+ is deep focus, 50 to 79 is moderate, below 50 is
110
+ scattered.
49
111
 
50
112
  ```
51
- ### Session [N]: [start] → [end] ([duration])
52
- **Focus**: [score]/100 — [assessment]
53
- **Primary area**: [package/directory]
113
+ ### Session [N]: [start] to [end] ([duration])
114
+ **Focus**: [score]/100
115
+ **Primary area**: [package or directory]
54
116
  **Commits**: [count]
55
117
 
56
118
  | Time | Category | Message | Files |
57
- |------|----------|---------|-------|
58
-
59
- **Observation**: [one behavioral insight]
119
+ |---|---|---|---|
60
120
  ```
61
121
 
62
- ## Step 4: Streaks
122
+ ### Signals worth reading
63
123
 
64
- ```bash
65
- git log --all --format="%ad" --date=short | sort -u
66
- ```
124
+ A pattern in the data is only interesting when it points at a Pass 1 candidate:
67
125
 
68
- ```
69
- ## Streaks
70
- 🔥 Current streak: [N] days
71
- 📈 Longest streak: [N] days ([range])
72
- 📅 Active days: [N] / [total]
73
- ```
74
-
75
- ## Step 5: Per-Contributor Metrics (if multiple)
76
-
77
- ```
78
- | Contributor | Commits | Primary Focus | Top Category | Avg Focus |
79
- |-------------|---------|---------------|--------------|-----------|
80
- ```
81
-
82
- ## Step 6: Behavioral Observations
83
-
84
- 2-4 observations backed by data:
85
-
86
- - "You wrote 12 fix commits after the auth refactor — consider adding tests before next refactor session."
87
- - "Focus score drops in afternoon sessions. Morning sessions average 85."
88
- - "No test commits this week despite 8 feature commits. Test debt accumulating."
89
- - "3/4 sessions started with chore commits. Consider batching into a maintenance session."
126
+ - A run of `fix:` commits after one `refactor:` is a missing check or a missing
127
+ test at that seam.
128
+ - Feature commits with no test commits is accumulating debt with a name and a
129
+ location.
130
+ - Repeated chore commits at the start of every session is a setup step that wants
131
+ automating.
132
+ - A low focus score across a week where each session is individually focused is
133
+ usually a navigation problem, not a discipline one.
90
134
 
91
135
  ## Output
92
136
 
93
137
  ```
94
- # Retrospective: [date range]
138
+ # Retrospective: [range]
95
139
 
96
- ## Overview
97
- - **Period**: [range]
98
- - **Sessions**: [count]
99
- - **Total commits**: [count]
140
+ ## Improvements
141
+ [candidates, most severe first, each with its category and the exact change]
100
142
 
101
- ## Category Breakdown
102
- [icons and counts]
143
+ ## Data
144
+ - Period, sessions, commits
145
+ - Category breakdown
146
+ - Sessions and focus
147
+ - Signals
103
148
 
104
- ## Sessions
105
- [session details]
106
-
107
- ## Streaks
108
- [streak data]
109
-
110
- ## Observations
111
- [behavioral insights]
112
-
113
- ## Suggested Focus for Next Session
149
+ ## Next session
114
150
  [one specific suggestion]
115
151
  ```
116
152
 
117
153
  ## Rules
118
154
 
119
- - **Data-driven only.** Every observation backed by commits/metrics.
120
- - **No judgment on work hours.** Don't comment on when someone works.
121
- - **Default to 7 days** if no range specified.
122
- - **Handle messy history gracefully.** Squash/merge/rebase can distort sessions.
155
+ - **Every observation is backed by a commit, a diff or a log line.** No vibes.
156
+ - **Propose environment changes, not personal ones.** No comment on when someone
157
+ works or how fast.
158
+ - **Prefer a check to a sentence.** A rule nobody reads is a rule that does not
159
+ exist.
160
+ - **Deleting counts.** A no-op line removed from `AGENTS.md` is as good a
161
+ candidate as a new one added.
162
+ - **Handle messy history gracefully.** Squash, merge and rebase distort session
163
+ boundaries. Say so rather than inventing precision.
164
+
165
+ ## Downstream
166
+
167
+ > Candidate accepted? `/stacks-writing-for-agents` for anything that lands in a
168
+ > document, `/stacks-tdd` for anything that lands as a test.
@@ -1,135 +1,243 @@
1
1
  ---
2
2
  name: stacks-review
3
- description: Use when reviewing code changes in the Stacks project — two-pass code review with critical issue detection, test coverage audit, and auto-fix workflow. Invoke with /stacks-review.
3
+ description: Use when reviewing code changes in a Stacks project - a PR, a branch, staged work, or the diff since a fixed point. Reviews on two axes, Standards (does it follow this repo's rules and avoid the smell baseline) and Spec (does it do what was asked), plus a test coverage audit and an auto-fix pass. Invoke with /stacks-review.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
7
7
  ---
8
8
 
9
- # /stacks-review — Code Review
9
+ # /stacks-review - code review
10
10
 
11
- You are performing a structured two-pass code review for the Stacks framework. Be direct, specific, and opinionated. Every finding must reference a specific file and line number.
11
+ Two-axis review of a diff. Be direct, specific and opinionated. Every finding
12
+ references a file and a line.
12
13
 
13
- ## Determine Scope
14
+ - **Standards**: does the code follow this repo's rules, and is it free of the
15
+ smell baseline below?
16
+ - **Spec**: does the code faithfully implement what the originating issue, spec
17
+ or conversation asked for?
14
18
 
15
- 1. If the user provides a PR number or branch, review the diff against the base branch
16
- 2. If no scope is given, review staged changes (`git diff --cached`). If nothing staged, review unstaged (`git diff`)
17
- 3. If no changes at all, ask what to review
19
+ A change can pass one axis and fail the other. Code that follows every rule and
20
+ implements the wrong thing passes Standards and fails Spec. Code that does
21
+ exactly what the issue asked while breaking the project's conventions does the
22
+ reverse. Reporting them separately stops one axis from masking the other, so
23
+ **do not merge or rerank across axes**.
18
24
 
19
- Read changed files in full to understand context around the changes.
25
+ Credit: the two-axis structure and the Fowler smell baseline are adapted from
26
+ Matt Pocock's `code-review` skill (MIT), <https://github.com/mattpocock/skills>.
20
27
 
21
- ## Pass 1: Critical Issues
28
+ ## 1. Pin the scope
22
29
 
23
- Scan for issues that **must be fixed before merge**. Only flag with confidence 8/10+:
30
+ 1. If the user gives a PR number, branch, tag or commit, that is the fixed point.
31
+ Diff with `git diff <fixed-point>...HEAD` (three dots, so the comparison is
32
+ against the merge base) and list the commits with
33
+ `git log <fixed-point>..HEAD --oneline`.
34
+ 2. If no scope is given, review staged changes (`git diff --cached`). If nothing
35
+ is staged, review unstaged (`git diff`).
36
+ 3. If there are no changes at all, ask what to review.
24
37
 
25
- ### Security
26
- - SQL injection, XSS, command injection, path traversal
27
- - Hardcoded secrets, API keys, tokens (check `config/services.ts`)
28
- - Missing auth/authorization checks on API routes
29
- - Unsafe deserialization or eval usage
30
- - Improper input validation at system boundaries
38
+ Confirm the ref resolves (`git rev-parse <fixed-point>`) and the diff is
39
+ non-empty before going further. A bad ref should fail here, not inside two
40
+ parallel sub-agents.
31
41
 
32
- ### Correctness
33
- - Race conditions, missing `await` on async calls
34
- - Off-by-one errors, null/undefined access without guards
35
- - Resource leaks (unclosed database connections, missing `db.close()`)
36
- - Incorrect error handling (swallowed errors, wrong error types)
37
- - Logic errors in ORM model definitions or migration files
42
+ Read the changed files in full. A diff without its surrounding context produces
43
+ confident nonsense.
38
44
 
39
- ### Stacks-Specific
40
- - Incorrect model attribute definitions (wrong validator types, missing `factory` for seeder)
41
- - Broken route definitions (missing middleware, wrong action paths)
42
- - Misconfigured `config/*.ts` files
43
- - Breaking changes to `@stacksjs/*` package exports
44
- - Migration files that won't work on SQLite (check preprocessing quirks)
45
+ ## 2. Identify the spec source
45
46
 
46
- For each critical finding:
47
+ Look for what the change was supposed to do, in this order:
48
+
49
+ 1. Issue references in the commit messages (`#123`, `Closes #45`), fetched with
50
+ `gh issue view`.
51
+ 2. A path the user passed as an argument.
52
+ 3. A spec or plan under `docs/`, `.scratch/`, or a design document from
53
+ `/stacks-office-hours` or `/stacks-plan-review`.
54
+ 4. The conversation itself, if the work happened in this session.
55
+
56
+ If nothing is found, ask. If the user says there is no spec, the Spec axis
57
+ reports "no spec available" and you review Standards only.
58
+
59
+ ## 3. Run both axes
60
+
61
+ Both axes run as **parallel sub-agents** so they do not pollute each other's
62
+ context, then this skill aggregates. Give each the diff command, the commit list,
63
+ and its own brief.
64
+
65
+ ### Standards axis
66
+
67
+ Sources, in order of authority:
68
+
69
+ 1. `AGENTS.md` at the repo root. It is the project's own rules and it **wins over
70
+ everything below**.
71
+ 2. The relevant `stacks-*` skill for whatever the diff touches. A model change is
72
+ reviewed against `stacks-models`, a route change against `stacks-router`.
73
+ 3. The smell baseline below, which applies even where nothing is documented.
74
+
75
+ Skip anything tooling already enforces. `pickier` catches formatting and lint,
76
+ `tsgo` catches types, so a finding that repeats them is noise.
77
+
78
+ #### Critical findings
79
+
80
+ Must be fixed before merge. Only flag at confidence 8/10 or higher.
81
+
82
+ **Security**: SQL injection, XSS, command injection, path traversal. Hardcoded
83
+ secrets, keys or tokens (check `config/services.ts` and anything env-shaped).
84
+ Missing auth or authorization on a route. Unsafe deserialization or `eval`.
85
+ Missing validation at a system boundary.
86
+
87
+ **Correctness**: races and missing `await`. Off-by-one. Null or undefined access
88
+ with no guard. Resource leaks, including unclosed database connections. Swallowed
89
+ errors and wrong error types. Logic errors in model definitions or migrations.
90
+
91
+ **Stacks-specific**:
92
+
93
+ - Model attributes with the wrong validator type, or a fillable attribute with no
94
+ `factory` where `useSeeder` is on.
95
+ - A model change with no regenerated migration, or a generated migration nobody
96
+ read.
97
+ - Routes pointing at an action path that does not resolve, or missing the
98
+ middleware their siblings carry.
99
+ - A registry that silently drops the entry: `app/Routes.ts`, `app/Events.ts`,
100
+ `app/Middleware.ts`, `app/Listener.ts`, `app/Scheduler.ts`. These fail by doing
101
+ nothing.
102
+ - Breaking changes to a `@stacksjs/*` package's public exports, and relative type
103
+ imports that escape the package, which degrade consumers to `any`.
104
+ - Migrations that will not run on SQLite.
105
+ - Vanilla JS in an stx template (`var`, `document.*`, `window.*`), a hand-rolled
106
+ SVG icon path, a new icon or animation dependency.
107
+ - An em-dash in any user-visible string.
47
108
 
48
109
  ```
49
110
  🔴 CRITICAL: [title]
50
111
  File: [path]:[line]
51
112
  Issue: [specific description]
52
- Impact: [what can go wrong]
53
- Fix: [concrete fix, not "consider doing X"]
113
+ Impact: [what goes wrong]
114
+ Fix: [the concrete fix]
54
115
  ```
55
116
 
56
- ## Pass 2: Informational
57
-
58
- Scan for non-blocking issues:
59
-
60
- - Run `bunx --bun pickier` compliance (don't flag what pickier catches)
61
- - TypeScript best practices (avoid `any`, prefer discriminated unions, use `satisfies`)
62
- - Naming clarity (misleading variable/function names)
63
- - Missing error context (errors that lose stack traces)
64
- - Test gaps (changed logic without corresponding test changes)
65
- - Dead code introduced by the change
66
- - Performance concerns (N+1 queries in ORM, unnecessary re-renders)
67
- - Conventional commit compliance for the PR title (`gitlint` standards)
68
-
69
- For each:
117
+ #### Smell baseline
118
+
119
+ A fixed set of Fowler code smells (*Refactoring*, ch.3) that applies even when a
120
+ repo documents nothing. Two rules bind it: **the repo overrides**, so where
121
+ `AGENTS.md` or a `stacks-*` skill endorses something the baseline would flag,
122
+ suppress it. And each smell is **always a judgement call**, a labelled heuristic
123
+ ("possible feature envy"), never a hard violation.
124
+
125
+ Each reads *what it is* then *how to fix*. Match against the diff:
126
+
127
+ - **Mysterious name**: a function, variable or type whose name does not reveal
128
+ what it does. Rename it, and if no honest name comes, the design is murky.
129
+ - **Duplicated code**: the same logic shape in more than one hunk or file.
130
+ Extract the shape and call it from both. In this framework, the fifth
131
+ near-identical action usually wants to be a trait.
132
+ - **Feature envy**: a method reaching into another object's data more than its
133
+ own. Move it onto the data it envies.
134
+ - **Data clumps**: the same few fields travelling together, a type wanting to be
135
+ born. Bundle them.
136
+ - **Primitive obsession**: a string or number standing in for a domain concept.
137
+ Give the concept its own small type, and its own name in `CONTEXT.md`.
138
+ - **Repeated switches**: the same cascade on the same type recurring across the
139
+ change. Replace with polymorphism, a driver, or one shared map.
140
+ - **Shotgun surgery**: one logical change forcing scattered edits across many
141
+ files. Gather what changes together.
142
+ - **Divergent change**: one file edited for several unrelated reasons. Split so
143
+ each module changes for one reason.
144
+ - **Speculative generality**: abstraction, params or hooks added for needs the
145
+ spec does not have. Delete it. One adapter is a hypothetical seam.
146
+ - **Message chains**: long `a.b().c().d()` navigation the caller should not
147
+ depend on. Hide the walk behind one method.
148
+ - **Middle man**: a class or function that mostly delegates onward. Call the real
149
+ target.
150
+ - **Refused bequest**: a subclass that ignores most of what it inherits. Use
151
+ composition.
70
152
 
71
153
  ```
72
154
  🟡 INFO: [title]
73
155
  File: [path]:[line]
74
- Note: [observation]
156
+ Note: [observation, and which smell if it is one]
75
157
  Suggestion: [improvement]
76
158
  ```
77
159
 
78
- ## Test Coverage Audit
160
+ Also flag here: `any` where a discriminated union or `satisfies` would do,
161
+ misleading names, errors that lose their stack, dead code introduced by the
162
+ change, N+1 queries through a relationship, and a PR title that fails the
163
+ conventional-commit rules in `config/commit.ts`.
164
+
165
+ ### Spec axis
79
166
 
80
- 1. Identify all changed functions/methods
81
- 2. Search for existing tests (`bun test` files)
82
- 3. List untested paths
167
+ Report:
168
+
169
+ - Requirements the spec asked for that are **missing or partial**.
170
+ - Behaviour in the diff that **was not asked for**, which is scope creep.
171
+ - Requirements that look implemented but where the implementation looks **wrong**.
172
+
173
+ Quote the spec line for each finding. Keep it under 400 words.
174
+
175
+ ## 4. Test coverage audit
176
+
177
+ 1. Identify every changed function, action, model attribute and route.
178
+ 2. Search `tests/` for existing coverage.
179
+ 3. List the untested paths.
83
180
 
84
181
  ```
85
- ## Test Coverage
182
+ ## Test coverage
86
183
 
87
- | Changed Function | Test File | Covered? |
88
- |-----------------|-----------|----------|
89
- | [function] | [test file or "none"] | ✅ / ❌ |
184
+ | Changed | Test file | Covered? |
185
+ |---|---|---|
186
+ | [function or route] | [path or "none"] | ✅ / ❌ |
90
187
 
91
188
  Missing coverage:
92
189
  - [untested path or edge case]
93
190
  ```
94
191
 
95
- ## Auto-Fix Workflow
192
+ Judge the tests you find, not just their existence. A test that mocks an internal
193
+ collaborator or recomputes its own expected value is worse than no test, because
194
+ it reports green. `stacks-tdd` has the anti-pattern list.
96
195
 
97
- After presenting findings, ask:
196
+ ## 5. Auto-fix
98
197
 
99
- > "Want me to fix the mechanical issues? (formatting, imports, simple type fixes)"
198
+ After presenting the findings, ask:
100
199
 
101
- If yes, fix ONLY mechanical issues. After fixing, run `bunx --bun pickier . --fix`.
200
+ > Want me to fix the mechanical issues? Formatting, imports, simple type fixes.
102
201
 
103
- Do NOT auto-fix: architectural decisions, logic changes, anything with multiple valid approaches.
202
+ If yes, fix **only** mechanical issues, then run `./buddy lint:fix` and
203
+ `./buddy typecheck`. Never auto-fix architectural decisions, logic changes, or
204
+ anything with several valid approaches.
104
205
 
105
- ## Output Format
206
+ ## Output
106
207
 
107
208
  ```
108
- # Code Review: [brief description]
209
+ # Code review: [brief description]
109
210
 
110
- ## Pass 1: Critical Issues
111
- [findings or "No critical issues found."]
211
+ ## Standards
212
+ [critical findings, then informational]
112
213
 
113
- ## Pass 2: Informational
114
- [findings]
214
+ ## Spec
215
+ [findings, or "no spec available"]
115
216
 
116
- ## Test Coverage
217
+ ## Test coverage
117
218
  [table]
118
219
 
119
220
  ## Summary
120
- - Critical: [count]
121
- - Informational: [count]
221
+ - Standards: [count], worst: [issue]
222
+ - Spec: [count], worst: [issue]
122
223
  - Test gaps: [count]
123
224
  ```
124
225
 
226
+ The summary names the worst issue **within each axis**. Do not pick a single
227
+ winner across axes, because that is the reranking the separation exists to
228
+ prevent.
229
+
125
230
  ## Rules
126
231
 
127
- - Never say "consider" or "you might want to" — it's a problem or it isn't
128
- - Every finding must have a concrete fix
129
- - Don't flag style issues that `pickier` would catch
130
- - Don't review generated files, lock files, or `storage/framework/types/` auto-generated types
131
- - For Stacks monorepo changes, check cross-package impacts — a change in `core/` might affect 15+ downstream packages
232
+ - Never say "consider" or "you might want to". It is a problem or it is not.
233
+ - Every finding carries a concrete fix.
234
+ - Do not flag what `pickier` or `tsgo` already catches.
235
+ - Do not review generated files, lock files, `storage/framework/types/*.d.ts`, or
236
+ anything under a `dist/`.
237
+ - For monorepo changes, check cross-package impact. A change in
238
+ `storage/framework/core/` can reach 15+ downstream packages.
132
239
 
133
240
  ## Downstream
134
241
 
135
- > **Review complete.** Run `/stacks-browse` to QA in the browser, or `/stacks-retro` to reflect on this session.
242
+ > **Review complete.** Run `/stacks-browse` to QA in the browser, or
243
+ > `/stacks-retro` to turn the findings into environment improvements.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-router
3
- description: Use when working with routing in a Stacks application — defining routes, HTTP methods, route groups, middleware, named routes, URL generation, request enhancement (Laravel-style input/query/file helpers), response helpers, error responses, route model binding, or rate limiting. Covers @stacksjs/router, routes/, and app/Routes.ts.
3
+ description: Use when working with routing in a Stacks application - defining routes, HTTP methods, route groups, middleware, named routes, URL generation, request enhancement (Laravel-style input/query/file helpers), response helpers, error responses, route model binding, or rate limiting. Covers @stacksjs/router, routes/, and app/Routes.ts.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-routes
3
- description: Use when defining or organizing route files in a Stacks application — creating route files in routes/, registering them in app/Routes.ts, using route prefixes and middleware groups, or the default API routes structure. For the router API itself (request helpers, response helpers, middleware classes), see stacks-router.
3
+ description: Use when defining or organizing route files in a Stacks application - creating route files in routes/, registering them in app/Routes.ts, using route prefixes and middleware groups, or the default API routes structure. For the router API itself (request helpers, response helpers, middleware classes), see stacks-router.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-scaffolding
3
- description: Use when generating new code with Stacks — buddy make commands, project scaffolding, component/page/store/layout generation, or project templates. Covers buddy make:* commands and STX scaffolding utilities.
3
+ description: Use when generating new code with Stacks - buddy make commands, project scaffolding, component/page/store/layout generation, or project templates. Covers buddy make:* commands and STX scaffolding utilities.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-scheduler
3
- description: Use when scheduling tasks in a Stacks application — defining scheduled tasks, cron-like scheduling, or task automation. Covers @stacksjs/scheduler, @stacksjs/cron, and app/Scheduler.ts.
3
+ description: Use when scheduling tasks in a Stacks application - defining scheduled tasks, cron-like scheduling, or task automation. Covers @stacksjs/scheduler, @stacksjs/cron, and app/Scheduler.ts.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-search-engine
3
- description: Use when implementing search in Stacks — full-text search with Meilisearch or Algolia backends, document indexing, search settings management, the useSearch model trait for automatic indexing, or search driver configuration. Covers @stacksjs/search-engine and config/search-engine.ts.
3
+ description: Use when implementing search in Stacks - full-text search with Meilisearch or Algolia backends, document indexing, search settings management, the useSearch model trait for automatic indexing, or search driver configuration. Covers @stacksjs/search-engine and config/search-engine.ts.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-security
3
- description: Use when implementing security in Stacks — password hashing (bcrypt/argon2), app key generation, AES encryption/decryption, hash verification, rehashing detection, or security configuration (firewall, rate limiting, IP allowlists). Covers @stacksjs/security and config/security.ts.
3
+ description: Use when implementing security in Stacks - password hashing (bcrypt/argon2), app key generation, AES encryption/decryption, hash verification, rehashing detection, or security configuration (firewall, rate limiting, IP allowlists). Covers @stacksjs/security and config/security.ts.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-security-audit
3
- description: Use when performing security analysis on a Stacks application — OWASP Top 10, STRIDE threat modeling, attack surface mapping, dependency audit. Requires concrete exploit scenarios. Invoke with /stacks-security-audit.
3
+ description: Use when performing security analysis on a Stacks application - OWASP Top 10, STRIDE threat modeling, attack surface mapping, dependency audit. Requires concrete exploit scenarios. Invoke with /stacks-security-audit.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-server
3
- description: Use when working with the Stacks development or production server — server configuration, server middleware, or server startup. Covers @stacksjs/server and storage/framework/server/.
3
+ description: Use when working with the Stacks development or production server - server configuration, server middleware, or server startup. Covers @stacksjs/server and storage/framework/server/.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-shell
3
- description: Use when executing shell commands in a Stacks application — running system commands, process management, or using the shell operator. Covers @stacksjs/shell which wraps Bun's native $ operator.
3
+ description: Use when executing shell commands in a Stacks application - running system commands, process management, or using the shell operator. Covers @stacksjs/shell which wraps Bun's native $ operator.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob