@withmata/blueprints 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: audit
3
- description: Run a project health check against available blueprints (read-only analysis)
4
- allowed-tools: Read, Glob, Grep, Bash(git *), Bash(ls *)
3
+ description: Run a project health check against available blueprints (read-only analysis, with optional upgrade execution)
4
+ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
5
5
  ---
6
6
 
7
7
  # Project Audit
8
8
 
9
- Run a health check against available blueprints. Analyze this project's current state and recommend improvements, missing best practices, or blueprints that could replace hand-rolled infrastructure. This command is read-only — it does not modify any files.
9
+ Run a health check against available blueprints. Analyze this project's current state, check installed blueprints for available upgrades, and recommend improvements. The analysis phase is read-only — modifications only happen if the user explicitly approves upgrades in Step 6.
10
10
 
11
11
  ## Step 1: Read Available Blueprints
12
12
 
@@ -15,22 +15,18 @@ Load all available blueprint specs to understand what is possible:
15
15
  ```
16
16
  ~/.withmata/blueprints/blueprints/discovery/product-discovery/BLUEPRINT.md
17
17
  ~/.withmata/blueprints/blueprints/foundation/monorepo-turbo/BLUEPRINT.md
18
- ~/.withmata/blueprints/blueprints/features/auth-better-auth/BLUEPRINT.md
19
- ```
20
-
21
- Also scan for any additional feature blueprints:
22
-
23
- ```
24
18
  ~/.withmata/blueprints/blueprints/features/*/BLUEPRINT.md
25
19
  ```
26
20
 
27
21
  Only consider a blueprint "available" if its BLUEPRINT.md has `Status: Complete`. If not found, run `npx @withmata/blueprints` to install.
28
22
 
23
+ For each available blueprint, also read its template files (`files/**/*`) — you'll need these for upgrade comparison in Step 4.
24
+
29
25
  ## Step 2: Read Project Context
30
26
 
31
27
  Check if `.project-context.md` exists in this project root.
32
28
 
33
- - **If it exists**: read it fully. Note which stages are complete (Discovery, Foundation, Installed Blueprints) and what choices were made.
29
+ - **If it exists**: read it fully. Note which stages are complete (Discovery, Foundation, Installed Blueprints) and what choices were made. Pay attention to `installed_at` dates for each blueprint.
34
30
  - **If it does not exist**: note this — it means either no blueprints have been used, or the project predates the blueprint system.
35
31
 
36
32
  ## Step 3: Explore the Project
@@ -75,11 +71,13 @@ Regardless of whether project context exists, explore the actual project to unde
75
71
  - Tailwind version? Check `tailwindcss` version in package.json — v3 (JS config) vs v4 (CSS config)
76
72
  - Is there a shared UI package, or are components duplicated?
77
73
  - Component library? shadcn/ui, Radix, MUI, Chakra?
74
+ - Does `shared-styles.css` have the full design system (animations, sidebar tokens, chart tokens) or just the minimal foundation version?
78
75
 
79
76
  ### 3f. Environment & Validation
80
77
 
81
- - How are env vars handled? t3-env, raw `process.env`, dotenv only?
82
- - Is there input validation? Zod, Valibot, Yup, Joi?
78
+ - How are env vars handled? t3-env with client/server split, single env.ts, raw `process.env`, dotenv only?
79
+ - Is there `.env.example` with documentation?
80
+ - Is there build-time validation (env imported in `next.config.ts`)?
83
81
 
84
82
  ### 3g. Code Quality
85
83
 
@@ -96,9 +94,44 @@ For each blueprint listed under `## Installed Blueprints` in `.project-context.m
96
94
  - Check if each `required` dependency is also listed in Installed Blueprints
97
95
  - If a required dependency is missing, include it in the report as a recommendation
98
96
 
99
- Example finding: "auth-better-auth is installed but its required dependency db-drizzle-postgres is not. Auth created a minimal db structure that lacks the full schema-group patterns. Run `/scaffold-db` to add the complete db patterns — it will merge without overwriting auth files."
97
+ ## Step 4: Check Installed Blueprints for Upgrades
98
+
99
+ **Note on system migrations:** System-level migrations (consolidating maintenance folders, renaming legacy fields, upgrading env patterns) are handled by `/scaffold-foundation`'s upgrade mode (Step 1.6a). The audit doesn't define its own migrations — it detects that foundation has upgrades available, which includes any pending migrations. When the user approves, the audit delegates to scaffold-foundation which runs the migrations as part of its upgrade flow.
100
+
101
+ For each blueprint listed in `.project-context.md` under `## Installed Blueprints`, compare the current blueprint templates against what's installed in the project.
102
+
103
+ ### 4a. For each installed blueprint:
104
+
105
+ 1. Read the `files_created` or `files_modified` list from project context
106
+ 2. Read the `installed_at` date
107
+ 3. For each file in the blueprint's File Manifest:
108
+ - Read the current template file from `~/.withmata/blueprints/`
109
+ - Resolve placeholders (`{{SCOPE}}`, `{{APP_NAME}}`, etc.) using project context values
110
+ - Read the corresponding file in the project
111
+ - Compare them and categorize:
112
+ - **Template updated** — the blueprint template has changed, the project file matches the OLD template (upgrade available)
113
+ - **New file** — file exists in the current blueprint but not in the project (added since install)
114
+ - **Unchanged** — template matches project file (no action needed)
115
+ - **User-modified** — project file differs from both old and new templates (user customized it — flag for careful merge)
116
+
117
+ 4. Check for new dependencies in the blueprint's `package.json` templates that aren't in the project's `package.json`
118
+
119
+ ### 4b. Compile upgrade details
100
120
 
101
- ## Step 4: Generate the Audit Report
121
+ For each blueprint with available upgrades, prepare a detailed summary:
122
+
123
+ - Blueprint name and install date
124
+ - Each file with changes: what specifically changed and why it matters
125
+ - New dependencies that would be added
126
+ - Whether files are blueprint-owned (safe to replace) or user-modified (needs merge)
127
+
128
+ ### 4c. Check for foundation-level upgrades
129
+
130
+ If foundation is installed, also check:
131
+ - Are there new feature blueprints available that weren't installed? (e.g., env-t3, tailwind-v4, ui-shared-components)
132
+ - Are there structural improvements in the foundation templates?
133
+
134
+ ## Step 5: Generate the Audit Report
102
135
 
103
136
  Present findings as a structured report. Be concrete and specific — reference actual files and patterns found.
104
137
 
@@ -116,57 +149,183 @@ Present findings as a structured report. Be concrete and specific — reference
116
149
  | Foundation / Structure | [done / partial / needs work] | [Brief note] |
117
150
  | Authentication | [blueprint / hand-rolled / third-party / none] | [Brief note] |
118
151
  | Database | [Drizzle / Prisma / other / none] | [Brief note] |
119
- | Styling | [Tailwind v4 / v3 / other] | [Brief note] |
152
+ | Styling | [Tailwind v4 full / v4 minimal / v3 / other] | [Brief note] |
153
+ | UI Package | [blueprint / hand-rolled / none] | [Brief note] |
154
+ | Environment Variables | [t3-env split / t3-env single / raw process.env / none] | [Brief note] |
120
155
  | Code Quality | [good / needs attention] | [Brief note] |
121
156
 
122
- ### Recommendations
157
+ ### Blueprint Upgrades Available
158
+
159
+ For each installed blueprint with updates, show detailed information. Use plain language — explain what the change means for the project, not just what files changed:
160
+
161
+ ```
162
+ ┌─────────────────────────────────────────────────────
163
+ │ env-t3 (installed 2026-03-15)
164
+
165
+ │ What's improved:
166
+
167
+ │ • Better empty value handling
168
+ │ Your environment validation now catches a common
169
+ │ mistake: setting a variable to an empty string
170
+ │ (like DATABASE_URL=) which previously passed
171
+ │ validation but caused crashes at runtime.
172
+ │ File: src/env/server.ts
173
+
174
+ │ • Clearer documentation for teammates
175
+ │ The .env.example file now has section headers and
176
+ │ explains what each variable is for, with example
177
+ │ values for local development and production.
178
+ │ File: .env.example
179
+
180
+ │ To apply: /scaffold-env
181
+ └─────────────────────────────────────────────────────
182
+
183
+ ┌─────────────────────────────────────────────────────
184
+ │ tailwind-v4 (installed 2026-03-15)
185
+
186
+ │ What's improved:
187
+
188
+ │ • Ready for dashboards and data pages
189
+ │ New color tokens for charts and sidebar navigation
190
+ │ that work in both light and dark mode. If you build
191
+ │ any analytics pages or admin dashboards, the styling
192
+ │ is ready to go.
193
+ │ File: config/tailwind-config/shared-styles.css
194
+
195
+ │ • Cleaner scrollable areas
196
+ │ Added a utility to hide scrollbars while keeping
197
+ │ scroll functionality — useful for custom menus,
198
+ │ sidebars, and overflow containers.
199
+ │ New dependency: tailwind-scrollbar-hide
200
+
201
+ │ To apply: /scaffold-tailwind
202
+ └─────────────────────────────────────────────────────
203
+ ```
204
+
205
+ If no upgrades are available for any installed blueprint, say: "All installed blueprints are up to date — you're running the latest patterns."
206
+
207
+ ### Recommended Blueprints (Not Yet Installed)
208
+
209
+ For each available blueprint that's NOT installed and would benefit this project. Explain the value in terms a non-developer can understand — focus on what it enables for the product, not just the technical implementation:
123
210
 
124
- For each recommendation:
211
+ ```
212
+ ┌─────────────────────────────────────────────────────
213
+ │ Shared UI Component Library
214
+ │ Blueprint: ui-shared-components
215
+
216
+ │ What this gives you:
217
+ │ A central place for all your buttons, forms, cards,
218
+ │ and other interface elements. When you update a
219
+ │ component here, every app in your project gets the
220
+ │ update automatically. No more copy-pasting UI code
221
+ │ between apps and watching them drift apart.
222
+
223
+ │ Includes a tool (shadcn) for quickly adding
224
+ │ professionally designed, accessible components —
225
+ │ just run one command to add a button, dialog,
226
+ │ dropdown, or any of 40+ ready-made components.
227
+
228
+ │ Ready to install: Yes
229
+ │ Requires: Tailwind design system (installed ✓)
230
+
231
+ │ To install: /scaffold-ui
232
+ └─────────────────────────────────────────────────────
233
+ ```
234
+
235
+ ### Other Recommendations
236
+
237
+ For non-blueprint recommendations (code quality, structural improvements):
125
238
 
126
239
  1. **[Priority: High/Medium/Low] [Category] — [One-line summary]**
127
240
  - **What we found:** [Specific observation referencing actual files]
128
- - **Why it matters:** [Impact on the project — explain for non-technical users too]
241
+ - **Why it matters:** [Impact — explain for non-technical users too]
129
242
  - **Action:** [Exact command or step to fix it]
130
243
 
131
- ---
132
-
133
244
  ### Recommendation Priority Guidelines
134
245
 
135
246
  **High priority** — things that block progress or create real risk:
136
247
  - No auth system and the product needs user accounts
137
248
  - No monorepo structure in a multi-workspace project
138
- - Hand-rolled auth with security gaps (plain text passwords, no CSRF, no rate limiting)
139
- - Missing environment variable validation
249
+ - Hand-rolled auth with security gaps
250
+ - Missing environment variable validation (raw `process.env` usage)
140
251
 
141
252
  **Medium priority** — things that improve quality and maintainability:
142
253
  - A blueprint could replace hand-rolled infrastructure
143
- - Missing product documentation for a project still figuring out its direction
254
+ - Missing product documentation
144
255
  - Inconsistent patterns across workspaces
145
256
  - Tailwind v3 when v4 is available
146
- - ESLint + Prettier when Biome could replace both
257
+ - Single `env.ts` instead of client/server split
147
258
 
148
259
  **Low priority** — nice-to-haves:
149
- - Blueprints in development that are not yet available (mention them as "coming soon")
150
260
  - Style preferences that do not affect functionality
151
261
  - Optimizations for mature projects
152
262
 
153
- ## Step 5: Provide Actionable Next Steps
263
+ ---
264
+
265
+ ## Step 6: Offer Actionable Upgrades
266
+
267
+ After presenting the report, offer to apply changes. This is the transition from read-only analysis to execution.
268
+
269
+ ### Present the action plan:
270
+
271
+ ```
272
+ ──────────────────────────────────────────────
273
+ Action Plan
154
274
 
155
- End the report with a clear list of what to do, in recommended order:
275
+ Blueprint upgrades (improvements to what you have):
276
+ 1. foundation — system cleanup + template updates
277
+ 2. env-t3 — better empty value handling, clearer docs
278
+ 3. tailwind-v4 — dashboard tokens, scrollbar utility
156
279
 
157
- ### Next Steps
280
+ New capabilities (not yet installed):
281
+ 4. ui-shared-components — shared component library with shadcn
158
282
 
283
+ Which would you like to apply? (numbers, "all", or "skip")
284
+ ──────────────────────────────────────────────
159
285
  ```
160
- # Run these in order — each one is independent, stop whenever you want
161
286
 
162
- 1. [command] # [what it does and why]
163
- 2. [command] # [what it does and why]
164
- ...
287
+ Foundation upgrades always run first when selected — they include system migrations (like consolidating maintenance folders) that other upgrades may depend on.
288
+
289
+ ### On user response:
290
+
291
+ - **"all"** — run everything in dependency order: foundation first, then other upgrades, then new installs last
292
+ - **Specific numbers** — run only the selected ones, still in the correct order
293
+ - **"skip"** — end the audit without making changes
294
+
295
+ ### Execution order:
296
+
297
+ 1. **Foundation upgrades first** — includes system migrations that clean up legacy patterns
298
+ 2. **Other blueprint upgrades** — in dependency order (env, tailwind, db, auth)
299
+ 3. **New blueprint installs** — in dependency order (tailwind before UI, db before auth)
300
+
301
+ For each approved action:
302
+ 1. Announce what's happening in plain language: "Upgrading your environment variable setup..."
303
+ 2. For system migrations: execute the migration directly (consolidate files, rename fields)
304
+ 3. For blueprint upgrades/installs: follow that scaffold skill's upgrade mode (Step 1.6)
305
+ 4. Report result: "Done — updated 2 files, your env setup now catches empty values"
306
+ 5. Move to next
307
+
308
+ ### After all upgrades:
309
+
310
+ Present a final summary:
311
+
165
312
  ```
313
+ ──────────────────────────────────────────────
314
+ What was done
166
315
 
167
- For blueprint commands, use the slash command format: `/discover`, `/scaffold-foundation`, `/scaffold-auth`
316
+ Blueprint upgrades:
317
+ ✓ foundation — consolidated maintenance rules,
318
+ cleaned up legacy patterns
319
+ ✓ env-t3 — updated server.ts, .env.example
320
+ ✓ tailwind-v4 — updated shared-styles.css, added
321
+ tailwind-scrollbar-hide
168
322
 
169
- For non-blueprint improvements, include the actual shell commands or instructions.
323
+ Skipped:
324
+ ○ ui-shared-components — not selected
325
+
326
+ Next: run pnpm install to pick up new dependencies.
327
+ ──────────────────────────────────────────────
328
+ ```
170
329
 
171
330
  ## Tone Guidelines
172
331
 
@@ -174,12 +333,13 @@ For non-blueprint improvements, include the actual shell commands or instruction
174
333
  - **Be warm and accessible.** The user may be non-technical. Explain WHY something matters, not just what to do.
175
334
  - **Be specific.** "Your auth looks hand-rolled" is not helpful. "I found JWT signing in `lib/auth.ts` without CSRF protection — the auth blueprint handles this with Better Auth's built-in security" is helpful.
176
335
  - **Separate facts from opinions.** "You are using ESLint + Prettier" is a fact. "Biome could replace both with simpler config" is a recommendation — label it as such.
177
- - **Do not overwhelm.** Lead with the 3-5 most impactful recommendations. If there are many findings, prioritize.
336
+ - **Do not overwhelm.** Lead with the most impactful findings. If everything is up to date and nothing is missing, keep the report short.
178
337
  - **Celebrate what is done well.** If something follows best practices, acknowledge it briefly.
179
338
 
180
339
  ## Important Notes
181
340
 
182
- - This command is **read-only**. It does not modify any files it only reads and reports.
183
- - Only recommend blueprints with `Status: Complete`. Mention planned blueprints (tailwind-v4, ui-shared-components) as "coming soon" if relevant, but do not suggest running commands for them.
341
+ - Steps 1–5 are read-only analysis. Step 6 is the only step that modifies files, and only with user approval.
342
+ - Only recommend blueprints with `Status: Complete`.
184
343
  - If the project is empty or brand new, keep the report short: "This is a fresh project. Here is where to start." and suggest `/discover` or `/scaffold-foundation`.
185
- - If everything looks good, say so: "This project is in great shape. No immediate recommendations."
344
+ - If everything is up to date and no recommendations apply: "This project is in great shape. All blueprints are current, no upgrades available."
345
+ - When executing upgrades in Step 6, defer to each scaffold skill's own upgrade mode logic. The audit skill orchestrates but doesn't duplicate the upgrade implementation.
@@ -220,7 +220,7 @@ List anything that can't be automated (aggregated from all stages).
220
220
  Suggest next steps in terms of product progress, not just technical tasks. Reference specific commands:
221
221
 
222
222
  - "The product thesis identified [pillar] as a core pillar — `/scaffold-auth` wires in the user accounts and access control to support that."
223
- - "Other feature blueprints coming soon: UI components, database, Tailwind theming."
223
+ - "Run `/audit` to see all available blueprints and what would benefit your project."
224
224
  - "Start building the core product experience — the [archetype]'s primary workflow."
225
225
 
226
226
  ---
@@ -33,7 +33,48 @@ Check if `.project-context.md` exists in the target project root:
33
33
  When project context provides clear answers, skip the corresponding questions in Step 3. For example:
34
34
  - Context says `server_framework: hono` -> do not ask about server framework
35
35
  - Context says `npm_scope: "@acme"` -> use `@acme` for package references
36
- - Context has `auth-better-auth` in Installed Blueprints -> warn about existing install
36
+ - Context has `auth-better-auth` in Installed Blueprints -> switch to upgrade mode (Step 1.6)
37
+
38
+ ## Step 1.6: Upgrade Mode
39
+
40
+ If `auth-better-auth` is found in `.project-context.md` under `## Installed Blueprints`, switch to upgrade mode.
41
+
42
+ 1. **Read installed state** — from project context, get `files_created`, `choices` (plugins, providers, framework), and `installed_at`
43
+ 2. **Compare templates against installed files** — auth files are heavily customized, so be extra conservative:
44
+ - **Blueprint-owned (safe to update):**
45
+ - Auth client setup (`auth-client.ts`) — compare client plugin configuration pattern
46
+ - Client schemas (`schema/auth.ts`, `schema/organization.ts`) — compare Zod validation patterns
47
+ - Client types (`types/organization.ts`) — compare type definitions
48
+ - **Partially user-owned (merge carefully):**
49
+ - Server auth config (`auth.ts`) — compare plugin setup, but users add custom plugins. Merge new patterns, don't replace.
50
+ - Middleware (`middleware.ts`, `route-protection.ts`) — users customize routes. Only update structural patterns.
51
+ - Env vars — merge into env schema files if env-t3 is installed (add new auth vars, keep existing ones).
52
+ - **User-owned (never touch):**
53
+ - Auth database schema (`auth-schema.ts`) — auto-generated by Better Auth
54
+ - Drizzle config for auth — user-maintained schema file list
55
+ - Custom hooks, context providers with user business logic
56
+ 3. **Present findings:**
57
+ ```
58
+ auth-better-auth was installed on <date>. Checking for updates...
59
+
60
+ Updated templates:
61
+ ☐ auth-client.ts — updated client plugin configuration
62
+ ☐ schema/auth.ts — updated Zod validation
63
+
64
+ Merge candidates (will preserve your customizations):
65
+ ☐ server auth.ts — new plugin option available
66
+ ☐ middleware.ts — updated middleware pattern
67
+
68
+ User-owned (never touched):
69
+ ✓ auth-schema.ts, drizzle config, custom hooks
70
+
71
+ Apply updates?
72
+ ```
73
+ 4. **Apply selectively** — for merge candidates, show the user what's new and let them decide. For auth config, highlight new plugin options or security improvements.
74
+ 5. **Update project context** — update `installed_at` date
75
+ 6. **Skip to Output Summary**
76
+
77
+ **Important:** Auth is the most user-customized blueprint. Most files will have been modified. Upgrade mode should focus on: new plugin options, security improvements, updated patterns. Never replace files wholesale — always merge or show diffs.
37
78
 
38
79
  ## Step 1.7: Check Blueprint Dependencies
39
80
 
@@ -204,6 +245,7 @@ Append an entry to `.project-context.md` under `## Installed Blueprints`:
204
245
  ```yaml
205
246
  ### auth-better-auth
206
247
  blueprint: auth-better-auth
248
+ installed_at: <date>
207
249
  choices:
208
250
  database: <user's choice>
209
251
  auth_db_isolation: <separate|shared>
@@ -228,17 +270,21 @@ Also append any significant architectural decisions to the `## Architecture Deci
228
270
 
229
271
  ### Create Maintenance Skill
230
272
 
231
- Create a project-level maintenance skill for the auth blueprint:
273
+ Append to the shared project-level maintenance skill at `<project>/.claude/skills/project-maintenance/SKILL.md`.
232
274
 
233
- **File:** `<project>/.claude/skills/auth-maintenance/SKILL.md`
275
+ If the file does not exist, create it with frontmatter:
234
276
 
235
277
  ```yaml
236
278
  ---
237
- name: auth-maintenance
238
- description: Maintenance rules for Better Auth. Invoke when modifying auth config, providers, session settings, or auth schema.
279
+ name: project-maintenance
280
+ description: Maintenance rules for all installed blueprints. Invoke when modifying schemas, env vars, auth config, workspace configs, UI components, or Tailwind tokens.
239
281
  user-invocable: false
240
282
  ---
283
+ ```
284
+
285
+ Then append:
241
286
 
287
+ ```markdown
242
288
  ### auth-better-auth maintenance
243
289
  - After modifying Better Auth server config, plugins, or providers: run `pnpm auth:generate && pnpm auth:migrate`
244
290
  - After updating `better-auth` package: run `pnpm auth:generate`, check for schema changes, migrate if needed
@@ -248,6 +294,8 @@ user-invocable: false
248
294
  - Never edit the auto-generated auth schema directly — modify the Better Auth config and regenerate
249
295
  ```
250
296
 
297
+ If a `### auth-better-auth maintenance` section already exists in the file, skip — do not duplicate.
298
+
251
299
  ## Step 6: Output Summary
252
300
 
253
301
  After scaffolding, provide the user with a clear summary:
@@ -32,9 +32,44 @@ Check if `.project-context.md` exists in the target project root:
32
32
 
33
33
  When project context provides clear answers, skip the corresponding questions in Step 3. For example:
34
34
  - Context says `npm_scope: "@acme"` -> use `@acme` for package references
35
- - Context has `db-drizzle-postgres` in Installed Blueprints -> warn about existing install
35
+ - Context has `db-drizzle-postgres` in Installed Blueprints -> switch to upgrade mode (Step 1.6)
36
36
  - Context has `auth-better-auth` installed -> `packages/db/` likely exists already
37
37
 
38
+ ## Step 1.6: Upgrade Mode
39
+
40
+ If `db-drizzle-postgres` is found in `.project-context.md` under `## Installed Blueprints`, switch to upgrade mode.
41
+
42
+ 1. **Read installed state** — from project context, get `files_created`, `choices` (schema group, connection helper), and `installed_at`
43
+ 2. **Compare templates against installed files** — only compare blueprint-owned files, NOT user schema files:
44
+ - `packages/db/package.json` — compare exports pattern, scripts, dependencies. Look for new scripts, updated dep versions.
45
+ - `packages/db/tsconfig.json` — compare TypeScript config.
46
+ - `packages/db/.env.example` — compare env documentation.
47
+ - `drizzle/<group>/drizzle.config.ts` — compare config pattern (but NOT the schema file list — that's user-maintained).
48
+ - `src/<group>/client.ts` — compare connection helper pattern (if included).
49
+ - `src/scripts/seed.ts` — compare seed script pattern.
50
+ 3. **Present findings:**
51
+ ```
52
+ db-drizzle-postgres was installed on <date>. Checking for updates...
53
+
54
+ Updated templates:
55
+ ☐ packages/db/package.json — new scripts or updated dependencies
56
+ ☐ drizzle/<group>/drizzle.config.ts — updated config pattern
57
+
58
+ Unchanged:
59
+ ✓ packages/db/tsconfig.json — no changes
60
+
61
+ User-owned (never touched):
62
+ ✓ src/<group>/*.ts — your schema files
63
+ ✓ drizzle/<group>/*.sql — your migrations
64
+
65
+ Apply updates?
66
+ ```
67
+ 4. **Apply selectively** — merge new scripts/deps into `package.json` without overwriting existing ones. For `drizzle.config.ts`, only update structural patterns — never modify the user's schema file list.
68
+ 5. **Update project context** — update `installed_at` date
69
+ 6. **Skip to Step 6 (Output Summary)**
70
+
71
+ **Important:** Schema files (`src/<group>/*.ts`), migration files (`drizzle/<group>/*.sql`), barrel exports (`index.ts`), and the `.env` file are all user-owned. Upgrade mode must never touch these.
72
+
38
73
  ## Step 2: Understand the Target Project
39
74
 
40
75
  Before making any changes, explore the target project to understand:
@@ -166,6 +201,7 @@ Append an entry to `.project-context.md` under `## Installed Blueprints`:
166
201
  ```yaml
167
202
  ### db-drizzle-postgres
168
203
  blueprint: db-drizzle-postgres
204
+ installed_at: <date>
169
205
  choices:
170
206
  schema_group: <group name>
171
207
  include_example: <true|false>
@@ -195,17 +231,21 @@ If `.project-context.md` does not exist, create it with the standard header and
195
231
 
196
232
  ### Create Maintenance Skill
197
233
 
198
- Create a project-level maintenance skill for the database blueprint:
234
+ Append to the shared project-level maintenance skill at `<project>/.claude/skills/project-maintenance/SKILL.md`.
199
235
 
200
- **File:** `<project>/.claude/skills/db-maintenance/SKILL.md`
236
+ If the file does not exist, create it with frontmatter:
201
237
 
202
238
  ```yaml
203
239
  ---
204
- name: db-maintenance
205
- description: Maintenance rules for Drizzle + PostgreSQL database. Invoke when modifying schemas, adding entities, or running migrations.
240
+ name: project-maintenance
241
+ description: Maintenance rules for all installed blueprints. Invoke when modifying schemas, env vars, auth config, workspace configs, UI components, or Tailwind tokens.
206
242
  user-invocable: false
207
243
  ---
244
+ ```
208
245
 
246
+ Then append:
247
+
248
+ ```markdown
209
249
  ### db-drizzle-postgres maintenance
210
250
  - After creating a new schema file: add it to `drizzle/<group>/drizzle.config.ts` schema array AND the group's `index.ts` barrel export
211
251
  - After any schema change: run `pnpm <group>:generate && pnpm <group>:migrate`
@@ -214,6 +254,8 @@ user-invocable: false
214
254
  - Never use glob patterns in drizzle.config.ts schema — always list files explicitly, excluding index.ts
215
255
  ```
216
256
 
257
+ If a `### db-drizzle-postgres maintenance` section already exists in the file, skip — do not duplicate.
258
+
217
259
  ## Step 6: Output Summary
218
260
 
219
261
  After scaffolding, provide the user with a clear summary:
@@ -32,7 +32,43 @@ Check if `.project-context.md` exists in the target project root:
32
32
 
33
33
  When project context provides clear answers, skip the corresponding questions in Step 3. For example:
34
34
  - Context has `auth-better-auth` installed -> pre-populate auth env vars
35
- - Context has `env-t3` in Installed Blueprints -> warn about existing install
35
+ - Context has `env-t3` in Installed Blueprints -> switch to upgrade mode (Step 1.6)
36
+
37
+ ## Step 1.6: Upgrade Mode
38
+
39
+ If `env-t3` is found in `.project-context.md` under `## Installed Blueprints`, switch to upgrade mode instead of a fresh install.
40
+
41
+ 1. **Read installed state** — from project context, get the `files_created` list and `choices` (env locations, apps configured)
42
+ 2. **Compare templates against installed files** — for each file in the blueprint's File Manifest:
43
+ - Read the current template from `~/.withmata/blueprints/blueprints/features/env-t3/files/`
44
+ - Resolve `{{APP_NAME}}` using project context
45
+ - Read the corresponding file in the project
46
+ - Categorize:
47
+ - **Updated** — template has changed (new Zod patterns, new structure)
48
+ - **New** — file exists in current blueprint but not in the project (e.g., new backend env template)
49
+ - **Unchanged** — template matches installed file (skip)
50
+ - **User-modified** — file differs from both the old and new templates (user added their own env vars — this is expected and normal for env files)
51
+ 3. **Present findings:**
52
+ ```
53
+ env-t3 was installed on <date>. Checking for updates...
54
+
55
+ Updated templates:
56
+ ☐ src/env/server.ts — updated Zod patterns
57
+ ☐ .env.example — new documentation sections
58
+
59
+ New files available:
60
+ ☐ apis/server/src/env.ts — backend env validation (not set up previously)
61
+
62
+ User-customized (will merge, not replace):
63
+ ✓ src/env/client.ts — you've added custom vars (keeping yours)
64
+
65
+ Apply updates?
66
+ ```
67
+ 4. **Apply selectively** — for user-modified env files (which is most of them), merge new structural patterns while preserving user-added variables. Never delete user env vars.
68
+ 5. **Update project context** — update `installed_at` date
69
+ 6. **Skip to Step 6 (Output Summary)**
70
+
71
+ **Important:** Env files are almost always user-modified (users add their own variables). Upgrade mode for env should focus on structural changes (new `// CONFIGURE:` sections, updated Zod patterns, new `emptyStringAsUndefined` options) rather than replacing the whole file.
36
72
 
37
73
  ## Step 2: Understand the Target Project
38
74
 
@@ -140,6 +176,7 @@ Append an entry to `.project-context.md` under `## Installed Blueprints`:
140
176
  ```yaml
141
177
  ### env-t3
142
178
  blueprint: env-t3
179
+ installed_at: <date>
143
180
  choices:
144
181
  nextjs_env_location: src/env/
145
182
  backend_env_location: src/env.ts
@@ -156,17 +193,21 @@ If `.project-context.md` does not exist, create it with the standard header and
156
193
 
157
194
  ### Create Maintenance Skill
158
195
 
159
- Create a project-level maintenance skill for the env blueprint:
196
+ Append to the shared project-level maintenance skill at `<project>/.claude/skills/project-maintenance/SKILL.md`.
160
197
 
161
- **File:** `<project>/.claude/skills/env-maintenance/SKILL.md`
198
+ If the file does not exist, create it with frontmatter:
162
199
 
163
200
  ```yaml
164
201
  ---
165
- name: env-maintenance
166
- description: Maintenance rules for T3 Env validated environment variables. Invoke when adding, removing, or modifying environment variables.
202
+ name: project-maintenance
203
+ description: Maintenance rules for all installed blueprints. Invoke when modifying schemas, env vars, auth config, workspace configs, UI components, or Tailwind tokens.
167
204
  user-invocable: false
168
205
  ---
206
+ ```
169
207
 
208
+ Then append:
209
+
210
+ ```markdown
170
211
  ### env-t3 maintenance
171
212
  - After adding a new env var: add it to the env schema file (client.ts or server.ts), `.env.example`, and `.env.local`
172
213
  - NEXT_PUBLIC_* vars go in env/client.ts with explicit runtimeEnv mapping; server vars go in env/server.ts
@@ -175,6 +216,8 @@ user-invocable: false
175
216
  - Keep .env.example documented with section headers and local/production hints
176
217
  ```
177
218
 
219
+ If a `### env-t3 maintenance` section already exists in the file, skip — do not duplicate.
220
+
178
221
  ## Step 6: Output Summary
179
222
 
180
223
  After scaffolding, provide the user with a clear summary:
@@ -36,19 +36,53 @@ If not found, run `npx @withmata/blueprints` to install.
36
36
 
37
37
  The BLUEPRINT.md files contain the full architecture documentation, naming conventions, folder conventions, and file manifests. Follow them precisely.
38
38
 
39
- ## Step 2: Read Project Context
39
+ ## Step 1.5: Read Project Context
40
40
 
41
41
  Check if `.project-context.md` exists in the target project root:
42
42
 
43
43
  - **If it has a Discovery section**: use the product name to derive the npm scope (e.g., "Acme Dashboard" -> `@acme`). Use technical constraints to inform any decisions.
44
44
 
45
- - **If it has a Foundation section already**: **switch to upgrade mode** (see Step 2b below).
45
+ - **If it has a Foundation section already**: switch to upgrade mode (Step 1.6).
46
46
 
47
47
  - **If no context file exists**: that is fine. Ask the user directly for the product name and npm scope. Proceed with install mode.
48
48
 
49
- ### Step 2b: Upgrade Mode Detection
49
+ ## Step 1.6: Upgrade Mode
50
50
 
51
- When foundation is already installed, compare what's currently in the project against what the blueprints now offer. Check for:
51
+ When foundation is already installed, run migrations first, then check for template updates and missing features.
52
+
53
+ ### 1.6a: System Migrations
54
+
55
+ Check for legacy patterns from older blueprint versions and offer to migrate them. Run these checks in order:
56
+
57
+ **Migration: Separate maintenance skills → consolidated `project-maintenance/`**
58
+
59
+ Scan `.claude/skills/` in the project for individual maintenance skill directories:
60
+ - `auth-maintenance/`
61
+ - `db-maintenance/`
62
+ - `env-maintenance/`
63
+ - `tailwind-maintenance/`
64
+ - `ui-maintenance/`
65
+ - `monorepo-maintenance/`
66
+
67
+ If any are found:
68
+ 1. Read each `SKILL.md` to extract the maintenance rules (the `### {name} maintenance` sections)
69
+ 2. Create (or update) `.claude/skills/project-maintenance/SKILL.md` with the consolidated frontmatter and all extracted sections
70
+ 3. Remove the old individual directories
71
+ 4. Report: "Migrated {n} separate maintenance skills into one `project-maintenance/SKILL.md`"
72
+
73
+ **Migration: `foundation_completed` → `installed_at`**
74
+
75
+ Check `.project-context.md` for `foundation_completed:` under `## Foundation`. If found, rename the field to `installed_at:`.
76
+
77
+ **Future migrations go here.** Each migration should:
78
+ - Check for the legacy pattern
79
+ - Only run if the legacy pattern is detected (idempotent)
80
+ - Report what was changed
81
+ - Be safe to run multiple times (no-op if already migrated)
82
+
83
+ ### 1.6b: Template Updates and Missing Features
84
+
85
+ After migrations, compare what's currently in the project against what the blueprints now offer:
52
86
 
53
87
  1. **Foundation file updates** — Compare each foundation template file against the installed version. Flag files where the blueprint template has changed (e.g., updated `turbo.json` task structure, new fields in `package.json`).
54
88
 
@@ -61,6 +95,10 @@ When foundation is already installed, compare what's currently in the project ag
61
95
  ```
62
96
  Foundation was installed on <date>. Here's what's available:
63
97
 
98
+ Migrations applied:
99
+ ✓ Consolidated 4 maintenance skills into project-maintenance/SKILL.md
100
+ ✓ Renamed foundation_completed → installed_at in project context
101
+
64
102
  Updates to existing files:
65
103
  ☐ turbo.json — new task caching strategy
66
104
  ☐ apps/web/next.config.ts — updated config pattern
@@ -76,11 +114,11 @@ When foundation is already installed, compare what's currently in the project ag
76
114
 
77
115
  4. Apply only what the user selects. For each selected feature, follow its blueprint's integration steps (adapted to the existing project). Skip configuration questions where the answer is already in `.project-context.md`.
78
116
 
79
- 5. Update `.project-context.md` with the newly installed features and update `foundation_completed` date.
117
+ 5. Update `.project-context.md` with the newly installed features and update `installed_at` date.
80
118
 
81
119
  After upgrade mode completes, skip to Step 7 (Summarize).
82
120
 
83
- ## Step 3: Understand Current State
121
+ ## Step 2: Understand Current State
84
122
 
85
123
  *(Install mode only — skipped in upgrade mode)*
86
124
 
@@ -239,7 +277,7 @@ linter: biome
239
277
  styling: tailwind-v4
240
278
  env_validation: t3-env + zod
241
279
  module_resolution: node subpath imports (#prefix)
242
- foundation_completed: <date>
280
+ installed_at: <date>
243
281
  ```
244
282
 
245
283
  Then append `## Installed Blueprints` with entries for every feature that was applied:
@@ -253,19 +291,25 @@ Then append `## Installed Blueprints` with entries for every feature that was ap
253
291
 
254
292
  **Verify the file exists and is well-formed before proceeding to Step 7.** If it's missing or empty, that is a bug — fix it before summarizing.
255
293
 
256
- ### Create Maintenance Skills
294
+ ### Create Maintenance Skill
295
+
296
+ All blueprints share a single project-level maintenance skill. Create or append to:
257
297
 
258
- Create the foundation maintenance skill:
298
+ **File:** `<project>/.claude/skills/project-maintenance/SKILL.md`
259
299
 
260
- **File:** `<project>/.claude/skills/monorepo-maintenance/SKILL.md`
300
+ If the file does not exist, create it with the frontmatter header:
261
301
 
262
302
  ```yaml
263
303
  ---
264
- name: monorepo-maintenance
265
- description: Maintenance rules for the Turborepo monorepo foundation. Invoke when modifying workspace configs, shared packages, or Turbo tasks.
304
+ name: project-maintenance
305
+ description: Maintenance rules for all installed blueprints. Invoke when modifying schemas, env vars, auth config, workspace configs, UI components, or Tailwind tokens.
266
306
  user-invocable: false
267
307
  ---
308
+ ```
268
309
 
310
+ Then append sections for each blueprint applied in this run. Foundation always adds:
311
+
312
+ ```markdown
269
313
  ### Monorepo maintenance
270
314
  - After every code change: format with Biome (`pnpm biome check --write .`) before considering work complete
271
315
  - After adding new workspace packages: verify `pnpm-workspace.yaml` patterns match, run `pnpm install`
@@ -273,11 +317,32 @@ user-invocable: false
273
317
  - After changing `turbo.json`: verify task ordering with `pnpm turbo run <task> --dry`
274
318
  - After adding workspace dependencies: run `pnpm install` to create workspace links
275
319
  - Keep `turbo.json` tasks with `cache: false` for any task with side effects (migrations, code generation)
320
+
321
+ ### env-t3 maintenance
322
+ - After adding a new env var: add it to the env schema file (client.ts or server.ts), `.env.example`, and `.env.local`
323
+ - NEXT_PUBLIC_* vars go in env/client.ts with explicit runtimeEnv mapping; server vars go in env/server.ts
324
+ - After removing an env var: remove from schema, .env.example, and .env.local
325
+ - Never access process.env directly — always use the typed env objects (clientEnv, serverEnv, or env)
326
+ - Keep .env.example documented with section headers and local/production hints
276
327
  ```
277
328
 
278
- Also create maintenance skills:
279
- - Always create `env-maintenance/SKILL.md` (see scaffold-env skill for template)
280
- - If frontend UI: create both `tailwind-maintenance/SKILL.md` and `ui-maintenance/SKILL.md` (see scaffold-tailwind and scaffold-ui skills for templates)
329
+ If frontend UI was applied, also append:
330
+
331
+ ```markdown
332
+ ### tailwind-v4 maintenance
333
+ - After adding a new color: add CSS variable to both :root and .dark selectors in shared-styles.css, then map in @theme inline
334
+ - After adding a new app: import the tailwind-config package in the app's globals.css
335
+ - After upgrading Tailwind: check for @import, @theme, or @custom-variant breaking changes
336
+ - Never use tailwind.config.js — all configuration is CSS-based in shared-styles.css
337
+ - Colors use OKLCH color space — do not use hex or RGB
338
+
339
+ ### ui-shared-components maintenance
340
+ - Add shadcn components via `pnpm dlx shadcn@latest add <name>` from packages/ui/
341
+ - Use cn() for all className composition — never concatenate class strings manually
342
+ - Internal imports use #prefix (#components/ui/button); cross-package imports use @scope/ui/components/ui/button
343
+ - After adding a new export directory: add to both exports and imports in packages/ui/package.json
344
+ - After adding a new consuming app: add @import and @source directive to the app's globals.css
345
+ ```
281
346
 
282
347
  ## Step 7: Summarize
283
348
 
@@ -29,6 +29,29 @@ Check if `.project-context.md` exists in the target project root:
29
29
  - Use this to determine if `config/tailwind-config/` exists
30
30
 
31
31
  - **If it does not exist**: proceed normally — explore the project manually
32
+ - **If `tailwind-v4` is in Installed Blueprints**: switch to upgrade mode (Step 1.6)
33
+
34
+ ## Step 1.6: Upgrade Mode
35
+
36
+ If `tailwind-v4` is found in `.project-context.md` under `## Installed Blueprints`, switch to upgrade mode.
37
+
38
+ 1. **Read installed state** — from project context, get `files_modified`, `choices`, and `installed_at`
39
+ 2. **Compare templates against installed files:**
40
+ - `config/tailwind-config/shared-styles.css` — compare against current blueprint template. Look for new imports (`@import`), new tokens in `@theme inline`, new CSS variables in `:root` and `.dark`, new base layer rules.
41
+ - `config/tailwind-config/package.json` — compare dependencies. Look for new or updated packages.
42
+ 3. **Present findings:**
43
+ ```
44
+ tailwind-v4 was installed on <date>. Checking for updates...
45
+
46
+ Updated files:
47
+ ☐ shared-styles.css — new tokens added (e.g., new sidebar variants, chart colors)
48
+ ☐ package.json — new dependency: <package>
49
+
50
+ Apply updates?
51
+ ```
52
+ 4. **Apply selectively** — `shared-styles.css` is a blueprint-owned file (users customize colors but the structure is ours). For color value changes, ask before overwriting. For new token additions (new `--color-*` vars), safe to append.
53
+ 5. **Update project context** — update `installed_at` date
54
+ 6. **Skip to Step 6 (Output Summary)**
32
55
 
33
56
  ## Step 2: Understand the Target Project
34
57
 
@@ -111,6 +134,7 @@ Append an entry to `.project-context.md` under `## Installed Blueprints`:
111
134
  ```yaml
112
135
  ### tailwind-v4
113
136
  blueprint: tailwind-v4
137
+ installed_at: <date>
114
138
  choices:
115
139
  include_sidebar_tokens: <true|false>
116
140
  include_chart_tokens: <true|false>
@@ -127,17 +151,21 @@ packages_added:
127
151
 
128
152
  ### Create Maintenance Skill
129
153
 
130
- Create a project-level maintenance skill:
154
+ Append to the shared project-level maintenance skill at `<project>/.claude/skills/project-maintenance/SKILL.md`.
131
155
 
132
- **File:** `<project>/.claude/skills/tailwind-maintenance/SKILL.md`
156
+ If the file does not exist, create it with frontmatter:
133
157
 
134
158
  ```yaml
135
159
  ---
136
- name: tailwind-maintenance
137
- description: Maintenance rules for Tailwind v4 design system. Invoke when modifying theme tokens, colors, or adding new apps.
160
+ name: project-maintenance
161
+ description: Maintenance rules for all installed blueprints. Invoke when modifying schemas, env vars, auth config, workspace configs, UI components, or Tailwind tokens.
138
162
  user-invocable: false
139
163
  ---
164
+ ```
140
165
 
166
+ Then append:
167
+
168
+ ```markdown
141
169
  ### tailwind-v4 maintenance
142
170
  - After adding a new color: add CSS variable to both :root and .dark selectors in shared-styles.css, then map in @theme inline
143
171
  - After adding a new app: import the tailwind-config package in the app's globals.css
@@ -146,6 +174,8 @@ user-invocable: false
146
174
  - Colors use OKLCH color space — do not use hex or RGB
147
175
  ```
148
176
 
177
+ If a `### tailwind-v4 maintenance` section already exists in the file, skip — do not duplicate.
178
+
149
179
  ## Step 6: Output Summary
150
180
 
151
181
  ### Packages Added
@@ -32,6 +32,41 @@ Check if `.project-context.md` exists in the target project root:
32
32
 
33
33
  When project context provides clear answers, skip the corresponding questions in Step 3.
34
34
 
35
+ If `ui-shared-components` is in Installed Blueprints, switch to upgrade mode (Step 1.6).
36
+
37
+ ## Step 1.6: Upgrade Mode
38
+
39
+ If `ui-shared-components` is found in `.project-context.md` under `## Installed Blueprints`, switch to upgrade mode.
40
+
41
+ 1. **Read installed state** — from project context, get `files_created`, `choices`, and `installed_at`
42
+ 2. **Compare templates against installed files:**
43
+ - `packages/ui/package.json` — compare exports, imports, dependencies. Look for new export patterns, updated deps.
44
+ - `packages/ui/components.json` — compare shadcn config. Look for updated aliases or style changes.
45
+ - `packages/ui/utils/cn.ts` — compare utility implementation.
46
+ - `packages/ui/utils/cva.ts` — compare CVA re-export.
47
+ - `packages/ui/styles/globals.css` — compare style imports.
48
+ - `packages/ui/tsconfig.json` — compare TypeScript config.
49
+ - Check consuming app `globals.css` — verify `@import` and `@source` directives are present and correct.
50
+ 3. **Present findings:**
51
+ ```
52
+ ui-shared-components was installed on <date>. Checking for updates...
53
+
54
+ Updated files:
55
+ ☐ packages/ui/package.json — new export patterns or dependencies
56
+ ☐ packages/ui/components.json — updated shadcn configuration
57
+
58
+ New files:
59
+ ☐ packages/ui/utils/cva.ts — new utility (didn't exist in previous version)
60
+
61
+ Unchanged:
62
+ ✓ packages/ui/utils/cn.ts — no changes
63
+
64
+ Apply updates?
65
+ ```
66
+ 4. **Apply selectively** — `package.json` exports and `components.json` are blueprint-owned. `components/ui/` files are user-owned (shadcn-generated) — never touch those.
67
+ 5. **Update project context** — update `installed_at` date
68
+ 6. **Skip to Step 6 (Output Summary)**
69
+
35
70
  ## Step 2: Understand the Target Project
36
71
 
37
72
  ### 2a. Detect Project Type
@@ -128,6 +163,7 @@ Append an entry to `.project-context.md` under `## Installed Blueprints`:
128
163
  ```yaml
129
164
  ### ui-shared-components
130
165
  blueprint: ui-shared-components
166
+ installed_at: <date>
131
167
  choices:
132
168
  shadcn_style: <style>
133
169
  icon_library: <library>
@@ -142,17 +178,21 @@ packages_added:
142
178
 
143
179
  ### Create Maintenance Skill
144
180
 
145
- Create a project-level maintenance skill:
181
+ Append to the shared project-level maintenance skill at `<project>/.claude/skills/project-maintenance/SKILL.md`.
146
182
 
147
- **File:** `<project>/.claude/skills/ui-maintenance/SKILL.md`
183
+ If the file does not exist, create it with frontmatter:
148
184
 
149
185
  ```yaml
150
186
  ---
151
- name: ui-maintenance
152
- description: Maintenance rules for shared UI component library. Invoke when adding components, icons, or modifying the UI package.
187
+ name: project-maintenance
188
+ description: Maintenance rules for all installed blueprints. Invoke when modifying schemas, env vars, auth config, workspace configs, UI components, or Tailwind tokens.
153
189
  user-invocable: false
154
190
  ---
191
+ ```
155
192
 
193
+ Then append:
194
+
195
+ ```markdown
156
196
  ### ui-shared-components maintenance
157
197
  - Add shadcn components via `pnpm dlx shadcn@latest add <name>` from packages/ui/
158
198
  - Use cn() for all className composition — never concatenate class strings manually
@@ -161,6 +201,8 @@ user-invocable: false
161
201
  - After adding a new consuming app: add @import and @source directive to the app's globals.css
162
202
  ```
163
203
 
204
+ If a `### ui-shared-components maintenance` section already exists in the file, skip — do not duplicate.
205
+
164
206
  ## Step 6: Output Summary
165
207
 
166
208
  ### Packages to Install
package/ENGINEERING.md CHANGED
@@ -43,5 +43,5 @@ These preferences apply to ALL blueprints in this repo and to any project scaffo
43
43
  - **Project context:** Every blueprint appends to `.project-context.md` in the target project root — tool-agnostic location readable by any AI coding tool
44
44
  - **Skills live in `.claude/skills/<name>/SKILL.md`** — single source of truth. Installed globally to `~/.claude/skills/`, `~/.config/opencode/skills/`, `~/.cursor/skills/` via the CLI. OpenCode and Cursor also read `~/.claude/skills/` as a cross-tool fallback.
45
45
  - **Rules/preferences are in `ENGINEERING.md`** — tool-specific files (`CLAUDE.md`, `AGENTS.md`, `.cursor/rules/engineering.mdc`) point to it
46
- - **Available skills:** `/new-project`, `/discover`, `/scaffold-foundation`, `/scaffold-auth`, `/scaffold-db`, `/audit`, plus `blueprint-catalog` (background, auto-invoked)
46
+ - **Available skills:** `/new-project`, `/discover`, `/scaffold-foundation`, `/scaffold-env`, `/scaffold-tailwind`, `/scaffold-ui`, `/scaffold-auth`, `/scaffold-db`, `/audit`, plus `blueprint-catalog` (background, auto-invoked)
47
47
  - **BLUEPRINT.md required** in every blueprint directory. Placeholder blueprints must still have a BLUEPRINT.md documenting intended scope.
@@ -1,5 +1,9 @@
1
1
  # Auth Blueprint — Better Auth + Drizzle
2
2
 
3
+ ## Tier
4
+
5
+ Feature
6
+
3
7
  ## Problem
4
8
 
5
9
  Full authentication and authorization for a TypeScript monorepo: multi-provider social login, email/password with verification, password reset, organization-based multi-tenancy with role-based permissions (owner/admin/member), invitation system, and session management with cookie-based route protection.
@@ -551,6 +551,7 @@ Appends to `.project-context.md` under `## Installed Blueprints`:
551
551
  ```yaml
552
552
  ### db-drizzle-postgres
553
553
  blueprint: db-drizzle-postgres
554
+ installed_at: <date>
554
555
  choices:
555
556
  schema_group: {{GROUP}}
556
557
  include_example: true|false
@@ -297,6 +297,7 @@ Appends to `.project-context.md` under `## Installed Blueprints`:
297
297
  ```yaml
298
298
  ### env-t3
299
299
  blueprint: env-t3
300
+ installed_at: <date>
300
301
  choices:
301
302
  nextjs_env_location: src/env/
302
303
  backend_env_location: src/env.ts
@@ -252,6 +252,7 @@ Appends to `.project-context.md` under `## Installed Blueprints`:
252
252
  ```yaml
253
253
  ### tailwind-v4
254
254
  blueprint: tailwind-v4
255
+ installed_at: <date>
255
256
  choices:
256
257
  include_sidebar_tokens: true
257
258
  include_chart_tokens: true
@@ -338,6 +338,7 @@ Appends to `.project-context.md` under `## Installed Blueprints`:
338
338
  ```yaml
339
339
  ### ui-shared-components
340
340
  blueprint: ui-shared-components
341
+ installed_at: <date>
341
342
  choices:
342
343
  shadcn_style: new-york
343
344
  icon_library: lucide
@@ -372,7 +372,7 @@ linter: biome
372
372
  styling: tailwind-v4
373
373
  env_validation: t3-env + zod
374
374
  module_resolution: node subpath imports (#prefix)
375
- foundation_completed: <date>
375
+ installed_at: <date>
376
376
  ```
377
377
 
378
378
 
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import pc3 from "picocolors";
6
6
 
7
7
  // src/constants.ts
8
8
  var API_URL = process.env["WITHMATA_API_URL"] || "https://blueprints.withmata.dev";
9
- var VERSION = "0.3.3";
9
+ var VERSION = "0.3.4";
10
10
 
11
11
  // src/steps/auth.ts
12
12
  import { log } from "@clack/prompts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withmata/blueprints",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Set up AI-powered project blueprints for Claude Code, OpenCode, and Cursor",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,270 +0,0 @@
1
- ---
2
- name: new-blueprint
3
- description: Add a new blueprint to the withmata blueprints repository
4
- ---
5
-
6
- # Add a New Blueprint
7
-
8
- Guide the user through adding a new blueprint to this repo. This command ensures every blueprint follows the established conventions and is fully wired up.
9
-
10
- ## Step 1: Understand the Conventions
11
-
12
- Read these files to understand the system you're adding to:
13
-
14
- ```
15
- ENGINEERING.md # Engineering preferences
16
- README.md # System overview and blueprint anatomy
17
- CHANGELOG.md # To update when done
18
- ```
19
-
20
- Also scan existing complete blueprints to understand the quality bar:
21
-
22
- ```
23
- blueprints/features/auth-better-auth/BLUEPRINT.md # Best example of a feature blueprint
24
- blueprints/foundation/monorepo-turbo/BLUEPRINT.md # Best example of a foundation blueprint
25
- blueprints/discovery/product-discovery/BLUEPRINT.md # Best example of a discovery blueprint
26
- ```
27
-
28
- ## Step 2: Gather Information
29
-
30
- Ask the user:
31
-
32
- 1. **"What pattern are you extracting?"** — What does it do? (e.g., "shared database layer with Drizzle", "Stripe billing integration", "email service with Resend")
33
-
34
- 2. **"Which tier?"** — Discovery (produces docs), Foundation (project skeleton), or Feature (plugs into existing project)? Most new blueprints are Features.
35
-
36
- 3. **"Is there an existing project to extract from?"** — If yes, get the path. If no, we're building from scratch — which is fine but harder.
37
-
38
- 4. **"What should it be called?"** — Suggest a name following the convention: `{domain}-{tool}` for features (e.g., `auth-better-auth`, `db-drizzle-postgres`, `billing-stripe`, `email-resend`). Foundation and discovery blueprints use `{purpose}-{tool}` (e.g., `monorepo-turbo`, `product-discovery`).
39
-
40
- ## Step 3: Extract or Build
41
-
42
- ### If extracting from an existing project:
43
-
44
- Read the relevant code in the source project. Understand:
45
- - What files are involved
46
- - How they connect to each other
47
- - What's project-specific vs what's the reusable pattern
48
- - What dependencies are needed
49
- - What environment variables are required
50
- - How it integrates with the monorepo (workspace deps, turbo tasks, root scripts)
51
-
52
- Then create the blueprint:
53
-
54
- 1. Create the directory: `blueprints/{tier}/{name}/`
55
- 2. Create `files/` with the extracted code — generalize project-specific values:
56
- - Replace npm scopes with `{{SCOPE}}`
57
- - Replace app names with `{{APP_NAME}}`
58
- - Replace project-specific emails, URLs, etc. with `{{PLACEHOLDER}}` and `// CONFIGURE:` comments
59
- - Remove any business logic that's not part of the pattern
60
- 3. Create `BLUEPRINT.md` following the structure below
61
-
62
- ### If building from scratch:
63
-
64
- 1. Create the directory: `blueprints/{tier}/{name}/`
65
- 2. Build the code files in `files/`, following the conventions in ENGINEERING.md
66
- 3. Create `BLUEPRINT.md` following the structure below
67
-
68
- ## Step 4: Write the BLUEPRINT.md
69
-
70
- This is the most important file. It's what makes AI-assisted scaffolding intelligent rather than mechanical. Follow this structure:
71
-
72
- ### Required sections (all tiers):
73
-
74
- ```markdown
75
- # [Name] Blueprint — [Short Description]
76
-
77
- ## Tier
78
- [Discovery | Foundation | Feature]
79
-
80
- ## Status
81
- [Complete | In Progress | Planned]
82
-
83
- ## Problem
84
- [What problem does this blueprint solve? Be specific about the pain point.]
85
- ```
86
-
87
- ### Additional sections for Feature blueprints:
88
-
89
- ```markdown
90
- ## Blueprint Dependencies
91
-
92
- [Does this blueprint require or recommend other blueprints be installed first?
93
- List them in a table with columns: Blueprint, Type (required/recommended), Why.
94
- If required, include a subsection explaining fallback behavior if the dependency is absent.
95
- If no dependencies, write "None."]
96
-
97
- ## Single-Repo Adaptation
98
-
99
- [How does file placement, imports, and scripts differ for standalone (non-monorepo) apps?
100
- Include a path mapping table (monorepo vs single-repo) and a single-repo scripts example.
101
- Document what core patterns stay the same regardless of project type.]
102
-
103
- ## Architecture
104
-
105
- ### Core Pattern
106
- [How does this work at a high level?]
107
-
108
- ### Key Decisions
109
- [For each major decision, document WHAT you chose and WHY. This is what lets the AI coding tool adapt intelligently.]
110
-
111
- - **[Decision 1]** (recommended/required) — [Explanation of what and why. Include alternatives if relevant.]
112
- - **[Decision 2]** (optional) — [Explanation]
113
-
114
- ## Hard Requirements vs Recommended Defaults
115
-
116
- **Hard requirements:**
117
- - [Things that can't change]
118
-
119
- **Recommended defaults — ask during scaffolding:**
120
-
121
- | Choice | Recommended | Alternatives |
122
- |---|---|---|
123
- | [Choice 1] | [Default] | [Options] |
124
-
125
- ## Dependencies
126
-
127
- ### npm packages
128
-
129
- **Server:**
130
- | Package | Version | Purpose |
131
- |---|---|---|
132
- | [pkg] | [version] | [why] |
133
-
134
- **Client:**
135
- | Package | Version | Purpose |
136
- |---|---|---|
137
-
138
- ### Environment Variables
139
-
140
- | Variable | Where | Description |
141
- |---|---|---|
142
- | [VAR] | [Server/Client] | [What it's for] |
143
-
144
- ## Monorepo Wiring
145
-
146
- [How does this integrate across workspaces? Package exports, workspace deps, turbo tasks, root scripts. This section is critical — it's the hardest part to figure out from scratch.]
147
-
148
- ## File Manifest
149
-
150
- | File | Purpose | Target Location |
151
- |---|---|---|
152
- | [file path in files/] | [what it does] | [where it goes in target project] |
153
-
154
- ## Integration Steps
155
-
156
- [Ordered phases for scaffolding. Group related steps.]
157
-
158
- ### Phase 1: [Name]
159
- 1. [Step]
160
- 2. [Step]
161
-
162
- ### Phase 2: [Name]
163
- ...
164
-
165
- ## Maintenance Hooks
166
-
167
- [What needs to happen after changes to keep this working?]
168
-
169
- ### Condensed Rules for project rules file
170
-
171
- ```markdown
172
- ### [name] maintenance
173
- - [rule 1]
174
- - [rule 2]
175
- ```
176
-
177
- ## References
178
-
179
- - [Links to docs, repos, etc.]
180
- ```
181
-
182
- ### Additional sections for Discovery blueprints:
183
-
184
- ```markdown
185
- ## Output
186
- [What documents are generated and where]
187
-
188
- ## Process
189
- [The conversational flow — phases, frameworks, quality gates]
190
- ```
191
-
192
- ### Additional sections for Foundation blueprints:
193
-
194
- ```markdown
195
- ## Output
196
- [What project structure is generated — show the directory tree]
197
-
198
- ## Architecture
199
- [Key structural decisions: why this tool, why this config, why this convention]
200
-
201
- ## Expects from Discovery
202
- [What info it reads from the discovery context, if anything]
203
- ```
204
-
205
- ### Quality checklist for BLUEPRINT.md:
206
-
207
- Before considering the BLUEPRINT.md done, verify:
208
-
209
- - [ ] Every architectural decision explains WHY, not just WHAT
210
- - [ ] Configurable vs opinionated choices are clearly separated
211
- - [ ] Blueprint Dependencies section is present (even if "None")
212
- - [ ] Single-Repo Adaptation section documents path mapping and script differences
213
- - [ ] File manifest covers every file in files/ with both monorepo and single-repo target locations
214
- - [ ] Integration steps are ordered and phased, with conditional monorepo/single-repo phases
215
- - [ ] Dependencies list specific versions
216
- - [ ] Environment variables are documented with descriptions
217
- - [ ] Monorepo wiring is documented (this is always the hardest part)
218
- - [ ] Maintenance hooks define trigger-action pairs
219
- - [ ] Code files use `{{SCOPE}}`, `{{APP_NAME}}`, and `// CONFIGURE:` markers
220
- - [ ] References link to official docs
221
-
222
- ## Step 5: Create the Scaffold Skill
223
-
224
- Create the skill as `.claude/skills/scaffold-{name}/SKILL.md`. Follow the pattern from existing skills (read `.claude/skills/scaffold-auth/SKILL.md` as the model). Add YAML frontmatter with `name` and `description` fields.
225
-
226
- Every scaffold skill must:
227
-
228
- 1. **Read the blueprint** — BLUEPRINT.md and all files
229
- 2. **Read project context** — `.project-context.md` for existing state
230
- 3. **Explore the target project** — understand current structure
231
- 4. **Ask clarifying questions** — based on the blueprint's configurable options
232
- 5. **Adapt and scaffold** — replace placeholders, adapt to project structure
233
- 6. **Update project context** — append to `.project-context.md`
234
- 7. **Create maintenance skill** — as the final step, create a project-level maintenance skill at `<project>/.claude/skills/{name}-maintenance/SKILL.md` with `user-invocable: false` containing the blueprint's maintenance hooks
235
- 8. **Summarize** — packages to install, env vars to set, manual steps remaining
236
-
237
- The skill should reference the BLUEPRINT.md as the source of truth for methodology and not duplicate its content.
238
-
239
- ## Step 6: Update the Repo
240
-
241
- After the blueprint and skill are created:
242
-
243
- 1. **Update README.md** — Add the new blueprint to the appropriate table (Complete or Planned) in the "Available blueprints" section. Add a scaffold command entry to the "Available commands" table.
244
-
245
- 2. **Update CHANGELOG.md** — Add an entry under [Unreleased] → Added describing the new blueprint.
246
-
247
- 3. **Update the directory structure** in README.md if it's shown there.
248
-
249
- 4. **Check for a planned blueprint placeholder** — If `blueprints/features/{name}/BLUEPRINT.md` already existed as a planned placeholder, replace it entirely with the full BLUEPRINT.md. Don't try to preserve the placeholder content.
250
-
251
- 5. **Ensure the new scaffold skill exists at `.claude/skills/scaffold-{name}/SKILL.md`.**
252
-
253
- ## Step 7: Verify
254
-
255
- Before considering the blueprint done:
256
-
257
- 1. Read back the BLUEPRINT.md and verify it meets the quality checklist from Step 4
258
- 2. Read the scaffold skill and verify it follows the pattern from Step 5
259
- 3. Verify all files in files/ use proper placeholders (no hardcoded scopes or app names)
260
- 4. Verify README.md and CHANGELOG.md are updated
261
- 5. Show the user a summary of everything that was created
262
-
263
- ## Tips for Good Blueprints
264
-
265
- - **Extract from real projects** — Blueprints that come from battle-tested code are always better than theoretical ones.
266
- - **Document the WHY** — The code is the easy part. The decisions and reasoning are what make AI-assisted scaffolding intelligent.
267
- - **Keep it focused** — One blueprint, one problem. If you're tempted to add "and also X", that's probably a separate blueprint.
268
- - **Include the monorepo wiring** — Package exports, workspace dependencies, turbo tasks, root scripts. This is always the part people get wrong, and it's where the blueprint adds the most value.
269
- - **Think about maintenance** — What breaks silently if you forget to run something? Those are your maintenance hooks.
270
- - **Use existing blueprints as your quality bar** — Read auth-better-auth before writing yours. Match that level of detail.