@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,15 +1,29 @@
1
1
  ---
2
2
  name: stacks-office-hours
3
- description: Use for structured product brainstorming about Stacks features — two modes (startup diagnostic for new ideas, builder generative for existing features). Produces design documents, never code. Invoke with /stacks-office-hours.
3
+ description: Use for structured product brainstorming about Stacks features - two modes, a startup diagnostic for new ideas and a builder generative mode for existing features. Produces design documents, never code. Invoke with /stacks-office-hours.
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-office-hours — Product Brainstorming
9
+ # /stacks-office-hours - Product Brainstorming
10
10
 
11
11
  You are a product thinking partner for the Stacks ecosystem. You produce **design documents and strategic analysis**, never code.
12
12
 
13
+ ## How to run it
14
+
15
+ Call the Skill tool with `stacks-grilling` and run the questions below through
16
+ it: ask the whole frontier in one round, number each question, give your
17
+ recommended answer, and wait. That skill also carries the rule that matters most
18
+ here, which is that finding **facts** is your job and only the **decisions**
19
+ belong to the user. Do not ask what `config/`, `app/Models/` or `buddy list`
20
+ would have told you.
21
+
22
+ Where a term comes up that the project has not settled, call the Skill tool with
23
+ `stacks-domain-modeling` and settle it there and then. In a Stacks app the name
24
+ becomes the model, the table, the route and the event, so it is cheaper to get
25
+ right now.
26
+
13
27
  ## Determine Mode
14
28
 
15
29
  - **New idea** → Startup Mode (diagnostic)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-orm
3
- description: Use when working with the Stacks ORM — defining models with defineModel(), model relationships (hasOne, hasMany, belongsTo, belongsToMany, morphOne, hasManyThrough), attributes, traits, factories, computed properties, query building, transactions, or the 50+ built-in models. Covers @stacksjs/orm, storage/framework/orm/, and storage/framework/defaults/app/Models/.
3
+ description: Use when working with the Stacks ORM - defining models with defineModel(), model relationships (hasOne, hasMany, belongsTo, belongsToMany, morphOne, hasManyThrough), attributes, traits, factories, computed properties, query building, transactions, or the 50+ built-in models. Covers @stacksjs/orm, storage/framework/orm/, and storage/framework/defaults/app/Models/.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript, SQLite >= 3.47.2
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-path
3
- description: Use when working with file paths in Stacks — 100+ framework-aware path builder functions for every directory in the project (actions, app, config, database, models, routes, storage, etc.), plus Node.js path utilities (join, resolve, basename, dirname, etc.). Covers @stacksjs/path.
3
+ description: Use when working with file paths in Stacks - 100+ framework-aware path builder functions for every directory in the project (actions, app, config, database, models, routes, storage, etc.), plus Node.js path utilities (join, resolve, basename, dirname, etc.). Covers @stacksjs/path.
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-payments
3
- description: Use when implementing payment processing in Stacks — Stripe charges, subscriptions, checkout sessions, customer management, payment methods, invoices, coupons, promo codes, products, prices, webhooks, or the Payment facade. Covers @stacksjs/payments and config/payment.ts.
3
+ description: Use when implementing payment processing in Stacks - Stripe charges, subscriptions, checkout sessions, customer management, payment methods, invoices, coupons, promo codes, products, prices, webhooks, or the Payment facade. Covers @stacksjs/payments and config/payment.ts.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -25,6 +25,7 @@ Full Stripe integration via the Payment facade. Uses Stripe API version `2026-01
25
25
  - All billable modules (`manageCharge`, `manageCustomer`, `manageSubscription`, etc.)
26
26
  - `stripe` -- raw Stripe SDK instance
27
27
  - `Stripe` -- re-exported Stripe types namespace
28
+ - `stacksIdempotencyKey`, `freshIdempotencyKey` -- see Idempotency below
28
29
 
29
30
  ## Payment Facade
30
31
 
@@ -347,6 +348,39 @@ authenticated user. Subscription and payment-method reads are provider-backed
347
348
  and may be unavailable when the application User override is not billable.
348
349
  Render that as an explicit unavailable state, not sample plans or fake cards.
349
350
 
351
+ ## Idempotency
352
+
353
+ Stripe calls that **create or attach** a resource are not idempotent by default.
354
+ The classic failure: `createStripeCustomer(user)` succeeds at Stripe, the
355
+ follow-up `user.update({ stripe_id })` fails, the next request sees no
356
+ `stripe_id` and creates a second Stripe customer with no link to the local user.
357
+
358
+ Pass an idempotency key on every create, attach or update call. Stripe caches
359
+ the response under that key for 24 hours, so a retry returns the original object
360
+ instead of making a new one.
361
+
362
+ ```typescript
363
+ import { stacksIdempotencyKey } from '@stacksjs/payments'
364
+
365
+ await stripe.customers.create(params, {
366
+ idempotencyKey: stacksIdempotencyKey('customer.create', user.id),
367
+ })
368
+ ```
369
+
370
+ Keys are built as `stacks:<scope>:<parts...>:v1`, hashed when they would exceed
371
+ Stripe's 255-character limit, and deterministic: the same inputs always produce
372
+ the same key, which is the whole point.
373
+
374
+ - **`stacksIdempotencyKey(scope, ...parts)`** is the one to reach for. `scope` is
375
+ a stable operation name and never user input; `parts` scope it within the
376
+ user's lifetime.
377
+ - **`freshIdempotencyKey(scope, ...parts)`** appends randomness, so it does *not*
378
+ deduplicate. Use it only when a repeat call is genuinely a new operation (a
379
+ second, deliberate charge of the same amount), never as a way to get past a
380
+ cached response.
381
+ - Bump the `v1` suffix in `idempotency.ts` when an operation's parameters change
382
+ in a way that should not collide with a cached response.
383
+
350
384
  ## config/payment.ts
351
385
 
352
386
  ```typescript
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: stacks-plan-review
3
- description: Use for architecture review of Stacks changes — scope review (CEO-level), data flow analysis, dependency analysis, test matrices, and implementation plans. Invoke with /stacks-plan-review.
3
+ description: Use for architecture review of Stacks changes - scope review, data flow analysis, dependency and interface analysis, test matrices, and an implementation plan sliced into tracer bullets. Invoke with /stacks-plan-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-plan-review — Architecture Review & Planning
9
+ # /stacks-plan-review - Architecture Review & Planning
10
10
 
11
11
  You analyze proposed changes at two levels: scope review (are we building the right thing?) and engineering review (are we building it right?).
12
12
 
@@ -14,9 +14,21 @@ You analyze proposed changes at two levels: scope review (are we building the ri
14
14
 
15
15
  If `/stacks-office-hours` produced a design document, read it. Don't ask the user to re-explain.
16
16
 
17
+ ## Vocabulary
18
+
19
+ Call the Skill tool with `stacks-codebase-design` before Step 3. Every interface
20
+ and seam judgement below uses its terms exactly (**module**, **interface**,
21
+ **depth**, **seam**, **adapter**, **leverage**, **locality**) and its principles:
22
+ the deletion test, the interface is the test surface, and one adapter means a
23
+ hypothetical seam while two mean a real one. Do not drift into "component",
24
+ "service" or "boundary".
25
+
26
+ Where the plan is still soft enough that questions outnumber answers, run
27
+ `stacks-grilling` first and come back with the decision tree settled.
28
+
17
29
  ## Step 1: Scope Review
18
30
 
19
- ### Expansion Analysis — Is this doing too much
31
+ ### Expansion Analysis - Is this doing too much
20
32
 
21
33
  ```
22
34
  | Addition | Core to goal? | Can ship separately? | Risk if included |
@@ -24,7 +36,7 @@ If `/stacks-office-hours` produced a design document, read it. Don't ask the use
24
36
  | [item] | [yes/no] | [yes/no] | [risk] |
25
37
  ```
26
38
 
27
- ### Reduction Analysis — Is this doing too little
39
+ ### Reduction Analysis - Is this doing too little
28
40
 
29
41
  ```
30
42
  | Missing piece | Needed for v1? | Cost of deferring |
@@ -120,7 +132,14 @@ P0: Must have before merge. P1: Should have. P2: Nice to have.
120
132
  1. [specific rollback step]
121
133
  ```
122
134
 
123
- Each phase should be independently mergeable. Run `bun test` at each checkpoint.
135
+ Each phase should be independently mergeable, which is the same bar
136
+ `stacks-new-feature` sets for a **tracer bullet**: a narrow but complete path
137
+ through model, migration, action, route and test. Hand the phases to that skill
138
+ to slice and build, and give each one its blocking edges here so the frontier is
139
+ obvious. A change whose blast radius makes a vertical slice impossible is a
140
+ **wide refactor**, and it is sequenced expand, migrate, contract instead.
141
+
142
+ Run `./buddy typecheck` and `bun test` at each checkpoint.
124
143
 
125
144
  ## Output
126
145
 
@@ -149,4 +168,6 @@ Each phase should be independently mergeable. Run `bun test` at each checkpoint.
149
168
 
150
169
  ## Downstream
151
170
 
152
- > **Plan complete.** After implementation, run `/stacks-review` for code review, `/stacks-security-audit` for security, or `/stacks-browse` for QA.
171
+ > **Plan complete.** Build it with `/stacks-new-feature`, driving `/stacks-tdd`
172
+ > inside each slice. Then `/stacks-review` for the two-axis review,
173
+ > `/stacks-security-audit` for security, or `/stacks-browse` for QA.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-plugins
3
- description: Use when working with the Stacks preload chain and Bun plugins — the env plugin, the framework preloader, how auto-imports get injected into globalThis, why a command does or does not see framework globals, the bun-plugin-stx static-serve plugin, or writing a Bun plugin. Covers bunfig.toml preload and storage/framework/defaults/resources/plugins/preloader.ts.
3
+ description: Use when working with the Stacks preload chain and Bun plugins - the env plugin, the framework preloader, how auto-imports get injected into globalThis, why a command does or does not see framework globals, the bun-plugin-stx static-serve plugin, or writing a Bun plugin. Covers bunfig.toml preload and storage/framework/defaults/resources/plugins/preloader.ts.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -0,0 +1,103 @@
1
+ # Logic prototype
2
+
3
+ A single, self-contained HTML file that lets anyone drive a state model by
4
+ clicking buttons. Use this when the question is about **business logic, state
5
+ transitions, or data shape**: the kind of thing that looks reasonable on paper
6
+ and only feels wrong once you push it through real cases.
7
+
8
+ Because it is one file with nothing to install, you can hand it to a
9
+ non-developer (a designer, a PM, a domain expert) and let them feel the model for
10
+ themselves. So it speaks their language, not the code's.
11
+
12
+ If the question is "what should this look like", this is the wrong branch. Use
13
+ [UI.md](UI.md).
14
+
15
+ ## Process
16
+
17
+ ### 1. State the question
18
+
19
+ Before writing code, write down what state model you are prototyping and what
20
+ question you are asking of it. One paragraph, at the top of the demo, in a
21
+ visible intro rather than a comment. A prototype that answers the wrong question
22
+ is pure waste.
23
+
24
+ ### 2. Isolate the logic in a portable module
25
+
26
+ Put the logic that answers the question in a single `<script>` block, written as
27
+ a small pure module that could be lifted out and dropped into the real codebase.
28
+ The page around it is throwaway. This module is not.
29
+
30
+ Pick the shape that fits the question:
31
+
32
+ - **A pure reducer**, `(state, action) => state`. Good when actions are discrete
33
+ events and state is a single value.
34
+ - **A state machine** with explicit states and transitions. Good when "which
35
+ actions are even legal right now" is part of the question.
36
+ - **A small set of pure functions** over a plain data type. Good when there is no
37
+ implicit current state, just transformations.
38
+ - **A module with a clear method surface**, when the logic genuinely owns ongoing
39
+ internal state.
40
+
41
+ Keep it pure: no DOM, no `document`, no button handlers reaching inside it. The
42
+ page calls into it, nothing flows the other way. That is what makes the answer
43
+ liftable: once the question is settled, the validated reducer or machine moves
44
+ into an action, a job or a model on its own.
45
+
46
+ ### 3. Build the shareable HTML file
47
+
48
+ One file, plain HTML, CSS and JS. No framework, no bundler, no server,
49
+ everything inline so it opens by double-click and survives being emailed around.
50
+ This is the one place in a Stacks project where hand-written vanilla JS is
51
+ correct, because the artifact has to run with nothing installed. It is not stx
52
+ and it never ships.
53
+
54
+ Write it for a non-developer. Every label is in **domain language**, not code.
55
+ Use the terms from `CONTEXT.md` if the project has one.
56
+
57
+ Lay it out top to bottom:
58
+
59
+ 1. **Title and one-line explanation** of what the demo lets you explore, which is
60
+ the question from step 1.
61
+ 2. **Current state**, rendered as a readable labelled panel rather than a raw
62
+ JSON dump, re-rendered after every click so the change is visible.
63
+ 3. **Free-play buttons**, one per action, always available, so anyone can poke at
64
+ the model in any order.
65
+ 4. **Guided walkthroughs**: a set of scenarios, one per tab. Each tab holds a
66
+ short plain-language description of the situation and what to watch for, and
67
+ under it the ordered buttons to press. Each step is a real button: clicking it
68
+ performs that action and moves to the next. Starting a walkthrough resets to a
69
+ known initial state so the scenario runs the same way every time.
70
+
71
+ Choose scenarios that demonstrate the awkward cases: the happy path, a tricky
72
+ edge, and an attempt at something that should be illegal.
73
+
74
+ Keep it clean but restrained. Clean typography, generous spacing, one accent
75
+ colour, no animation. Nothing that competes with the state and the buttons.
76
+
77
+ ### 4. Hand it over
78
+
79
+ Send the file or open it. The interesting moments are "wait, that should not be
80
+ possible" and "huh, I assumed X would be different". Those are bugs in the
81
+ *idea*, which is the whole point. If they want new actions or another scenario,
82
+ add them. Prototypes evolve.
83
+
84
+ ### 5. Capture the answer and the prototype
85
+
86
+ Once the question is answered, capture the answer, then capture the prototype the
87
+ way [SKILL.md](SKILL.md) describes. The validated reducer, machine or function
88
+ set lifts into the real module. The HTML shell rides along to the
89
+ `prototype/<name>` branch, where being one self-contained file keeps it trivially
90
+ re-runnable.
91
+
92
+ ## Anti-patterns
93
+
94
+ - **Adding tests.** A prototype that needs tests is no longer a prototype.
95
+ - **Wiring it to the real database.** In-memory state, unless the question is
96
+ specifically about persistence.
97
+ - **Generalising.** No "what if we wanted to support X later". One question.
98
+ - **Blurring the logic and the page together.** If the pure module touches the
99
+ DOM, it is no longer liftable.
100
+ - **Reaching for a framework, bundler or server.** One file the recipient
101
+ double-clicks. A dev server defeats "shareable".
102
+ - **Shipping the HTML shell.** The page is optimised for being clicked through by
103
+ hand. The module behind it is the part worth keeping.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: stacks-prototype
3
+ description: Use when a design question needs a runnable answer rather than an argument - does this state model hold up, what should this page look like, is this API shape right. Builds throwaway code that answers one question, either a single shareable HTML demo or several stx view variants.
4
+ license: MIT
5
+ compatibility: Bun >= 1.3.0, TypeScript
6
+ allowed-tools: Read Edit Write Bash Grep Glob
7
+ ---
8
+
9
+ # Prototype
10
+
11
+ A prototype is **throwaway code that answers a question**. The question decides
12
+ the shape.
13
+
14
+ Credit: adapted from Matt Pocock's `prototype` skill (MIT),
15
+ <https://github.com/mattpocock/skills>.
16
+
17
+ ## Pick a branch
18
+
19
+ Identify which question is being answered, from the user's prompt, the
20
+ surrounding code, or by asking if the user is around:
21
+
22
+ - **"Does this logic or state model feel right?"** goes to [LOGIC.md](LOGIC.md).
23
+ A single shareable HTML file, free-play buttons plus tabbed guided
24
+ walkthroughs, that pushes the state machine through cases that are hard to
25
+ reason about on paper and that a non-developer can drive.
26
+ - **"What should this look like?"** goes to [UI.md](UI.md). Several radically
27
+ different stx variants of one view, switchable in the browser.
28
+
29
+ The two branches produce very different artifacts, so getting this wrong wastes
30
+ the whole prototype. If the question is genuinely ambiguous and the user is not
31
+ reachable, default by where the code lives (a model, action or job means logic, a
32
+ view or component means UI) and state the assumption at the top of the prototype.
33
+
34
+ ## Rules that apply to both
35
+
36
+ 1. **Throwaway from day one, and marked as such.** Put the prototype next to
37
+ what it is prototyping for, so context is obvious, and name it so a casual
38
+ reader can see it is not production.
39
+ 2. **Trivial to run.** A UI prototype starts from `buddy dev`. A logic demo is a
40
+ single HTML file the user double-clicks. No thinking required to start it.
41
+ 3. **No persistence by default.** State lives in memory. Persistence is the thing
42
+ the prototype is *checking*, not something it should depend on. If the
43
+ question genuinely involves the database, point it at the testing SQLite file
44
+ or a clearly named scratch one.
45
+ 4. **Skip the polish.** No tests, no error handling beyond what makes it
46
+ runnable, no abstractions. The point is to learn something fast.
47
+ 5. **Surface the state.** After every action, or on every variant switch, render
48
+ the full relevant state so the user can see what changed.
49
+ 6. **Capture it when done.** Fold the validated decision into the real code, then
50
+ keep the prototype itself as a **primary source**: commit it to a
51
+ `prototype/<name>` branch, out of `main`, and leave a pointer to that branch
52
+ on the issue. Capture the answer too, the verdict and the question it settled.
53
+ `main` keeps only the validated decision.
54
+
55
+ ## What a prototype is not
56
+
57
+ Not a spike you promote. The code was written under prototype constraints, so
58
+ rewrite it properly when you fold it in. Not a design deliverable either: for
59
+ production UI quality, `stacks-design-taste` and the aesthetic skills own that
60
+ bar, and this skill only answers "which direction".
61
+
62
+ ## Downstream
63
+
64
+ > Answer in hand? Take it into `/stacks-plan-review` or `/stacks-new-feature`.
65
+ > If the winning variant is the one you will build, `/stacks-design-taste` sets
66
+ > the bar for the real implementation.
@@ -0,0 +1,112 @@
1
+ # UI prototype
2
+
3
+ Generate **several radically different variants** of one view and let the user
4
+ flip between them in the browser, pick one (or steal bits from each), and throw
5
+ the rest away.
6
+
7
+ If the question is about logic or state rather than what something looks like,
8
+ this is the wrong branch. Use [LOGIC.md](LOGIC.md).
9
+
10
+ ## When this is the right shape
11
+
12
+ - "What should this page look like?"
13
+ - "I want to see a few options for this dashboard before committing."
14
+ - "Try a different layout for the settings screen."
15
+ - Any time the user would otherwise spend a day picking between three vague
16
+ mockups in their head.
17
+
18
+ ## Judge it against the real app
19
+
20
+ A variant is much easier to judge when it is **butting up against the rest of the
21
+ app**: real layout, real data, real density. A throwaway page on its own is a
22
+ vacuum where every variant looks fine. So prefer, in order:
23
+
24
+ 1. **Variants inside the existing view.** The route already exists and its data
25
+ already loads. Only the rendered subtree swaps. Pick this whenever there is a
26
+ plausible host page, including for something new that would naturally live
27
+ inside one (a new section of a dashboard, a new card on a settings screen).
28
+ 2. **Throwaway views**, only when the thing genuinely has no existing page to
29
+ live inside.
30
+
31
+ ## Process
32
+
33
+ ### 1. State the question and pick N
34
+
35
+ Default to **3** variants. Past 5 they stop being radically different and start
36
+ being noise, so cap there. Write the plan in one line at the top of the host
37
+ view:
38
+
39
+ > Three variants of the settings page, switchable from the prototype bar, on the
40
+ > existing settings view.
41
+
42
+ ### 2. Generate radically different variants
43
+
44
+ Draft each variant as an stx component under
45
+ `resources/components/prototype/<name>/VariantA.stx` (and B, C). Hold each one
46
+ to:
47
+
48
+ - The page's purpose and the data it actually has.
49
+ - Crosswind utilities, Iconify classes for icons, and signals or composables in
50
+ `<script>` blocks. The project's frontend rules do not relax for a prototype:
51
+ no `var`, no `document.*`, no `window.*`, no animation library, no em-dash in
52
+ any visible copy.
53
+ - A clear component name and a one-line description of the idea behind it.
54
+
55
+ Variants must be **structurally different**: different layout, different
56
+ information hierarchy, different primary affordance. Not different colours. Three
57
+ slightly tweaked card grids is wallpaper, not a prototype. If two drafts come out
58
+ too similar, redo one under an explicit constraint ("no card grid").
59
+
60
+ ### 3. Wire them together
61
+
62
+ Two mechanics, and both are fine. Pick by how the host view already gets its
63
+ state:
64
+
65
+ - **One view per variant.** Add `resources/views/prototype/<name>/a.stx`,
66
+ `b.stx`, `c.stx`, each rendering one variant inside the real layout. Views are
67
+ file-routed, so these are reachable immediately, though a newly nested
68
+ directory usually needs a `buddy dev` restart before it stops 404ing.
69
+ - **One view, switched on a signal**, when the host view already reads request
70
+ state. Render `@if` on the variant and default to A.
71
+
72
+ Either way the variants sit inside the real layout and the real data, which is
73
+ the point.
74
+
75
+ ### 4. Build the floating switcher
76
+
77
+ One shared stx partial under `resources/partials/`, included by each prototype
78
+ view:
79
+
80
+ - Links or buttons to the previous and next variant, wrapping around.
81
+ - The current variant key and its name, for instance `B (sidebar layout)`.
82
+ - Fixed to the bottom centre, high contrast, visually distinct from the page so
83
+ it is obviously not part of the design being judged.
84
+ - Rendered only outside production. Gate it on the app environment so a stray
85
+ merge cannot ship the bar to users.
86
+
87
+ ### 5. Hand it over
88
+
89
+ Give the user the URLs. The interesting feedback is almost always "I want the
90
+ header from B with the sidebar from C", which is the design they actually want.
91
+
92
+ ### 6. Capture the answer and clean up
93
+
94
+ Once a variant wins, capture the answer (which one and why), then capture the
95
+ prototype the way [SKILL.md](SKILL.md) describes:
96
+
97
+ - Fold the winner into the real view, rewritten to production standard against
98
+ `stacks-design-taste`.
99
+ - Move the losing variants, the prototype views and the switcher partial onto the
100
+ `prototype/<name>` branch. They rot fast in `main` and confuse the next reader.
101
+ - Run `./buddy lint:fix` and remove the prototype directory from `main`.
102
+
103
+ ## Anti-patterns
104
+
105
+ - **Variants that differ only in colour or copy.** That is a tweak. Real variants
106
+ disagree about structure.
107
+ - **Sharing too much between variants.** A shared layout defeats the point. Each
108
+ variant should be free to throw the layout out.
109
+ - **Wiring variants to real mutations.** Read-only is fine. The question is what
110
+ it should look like, not whether the backend works.
111
+ - **Promoting the prototype straight to production.** Rewrite it when you fold it
112
+ in.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-push
3
- description: Use when implementing push notifications in Stacks — sending via Expo Push Service or Firebase Cloud Messaging (FCM legacy and v1 APIs), configuring push drivers, batch sending, multicast, topic subscriptions, push notification payloads, token validation, or receipt checking. Covers @stacksjs/push.
3
+ description: Use when implementing push notifications in Stacks - sending via Expo Push Service or Firebase Cloud Messaging (FCM legacy and v1 APIs), configuring push drivers, batch sending, multicast, topic subscriptions, push notification payloads, token validation, or receipt checking. Covers @stacksjs/push.
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-query-builder
3
- description: Use when building database queries in a Stacks application — constructing SQL queries, using the fluent query API, or configuring the query builder. Covers @stacksjs/query-builder which wraps bun-query-builder, and config/query-builder.ts.
3
+ description: Use when building database queries in a Stacks application - constructing SQL queries, using the fluent query API, or configuring the query builder. Covers @stacksjs/query-builder which wraps bun-query-builder, and config/query-builder.ts.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript, SQLite >= 3.47.2
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-queue
3
- description: Use when working with job queues in a Stacks application — creating jobs, dispatching, workers, batches, failed jobs, queue events, health checks, testing, Redis/database/sync drivers, rate limiting, or scheduled jobs. Covers @stacksjs/queue, config/queue.ts, and app/Jobs/.
3
+ description: Use when working with job queues in a Stacks application - creating jobs, dispatching, workers, batches, failed jobs, queue events, health checks, testing, Redis/database/sync drivers, rate limiting, or scheduled jobs. Covers @stacksjs/queue, config/queue.ts, and app/Jobs/.
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-realtime
3
- description: Use when implementing real-time features in Stacks — WebSocket broadcasting, public/private/presence channels, emit to users, the Channel class, broadcast discovery, server lifecycle, or realtime configuration. Covers @stacksjs/realtime and config/realtime.ts.
3
+ description: Use when implementing real-time features in Stacks - WebSocket broadcasting, public/private/presence channels, emit to users, the Channel class, broadcast discovery, server lifecycle, or realtime configuration. Covers @stacksjs/realtime and config/realtime.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-registry
3
- description: Use when working with the Stacks extension registry — framework extension metadata, package discovery, or the registry system. Covers @stacksjs/registry.
3
+ description: Use when working with the Stacks extension registry - framework extension metadata, package discovery, or the registry system. Covers @stacksjs/registry.
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-repl
3
- description: Use when working with the Stacks REPL — interactive TypeScript sessions, tinker sessions, debugging, or exploring the framework interactively. Covers @stacksjs/repl and @stacksjs/tinker.
3
+ description: Use when working with the Stacks REPL - interactive TypeScript sessions, tinker sessions, debugging, or exploring the framework interactively. Covers @stacksjs/repl and @stacksjs/tinker.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob