@withmata/blueprints 0.3.3 → 0.3.5

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.
@@ -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