@withmata/blueprints 0.2.0 → 0.3.2

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 (46) hide show
  1. package/{.opencode/commands/audit.md → .claude/skills/audit/SKILL.md} +8 -6
  2. package/.claude/skills/blueprint-catalog/SKILL.md +63 -0
  3. package/.claude/{commands/discover.md → skills/discover/SKILL.md} +8 -3
  4. package/{.cursor/commands/new-blueprint.md → .claude/skills/new-blueprint/SKILL.md} +13 -8
  5. package/{.cursor/commands/new-project.md → .claude/skills/new-project/SKILL.md} +11 -6
  6. package/.claude/{commands/scaffold-auth.md → skills/scaffold-auth/SKILL.md} +24 -23
  7. package/{.cursor/commands/scaffold-db.md → .claude/skills/scaffold-db/SKILL.md} +17 -16
  8. package/.claude/skills/scaffold-env/SKILL.md +222 -0
  9. package/.claude/{commands/scaffold-foundation.md → skills/scaffold-foundation/SKILL.md} +17 -16
  10. package/.claude/skills/scaffold-tailwind/SKILL.md +177 -0
  11. package/.claude/skills/scaffold-ui/SKILL.md +206 -0
  12. package/ENGINEERING.md +2 -2
  13. package/blueprints/features/env-t3/BLUEPRINT.md +332 -0
  14. package/blueprints/features/env-t3/files/nextjs/.env.example +17 -0
  15. package/blueprints/features/env-t3/files/nextjs/.env.local +0 -0
  16. package/blueprints/features/env-t3/files/nextjs/env/client.ts +13 -0
  17. package/blueprints/features/env-t3/files/nextjs/env/server.ts +12 -0
  18. package/blueprints/features/env-t3/files/server/.env.example +14 -0
  19. package/blueprints/features/env-t3/files/server/.env.local +0 -0
  20. package/blueprints/features/env-t3/files/server/env.ts +17 -0
  21. package/blueprints/features/tailwind-v4/BLUEPRINT.md +262 -12
  22. package/blueprints/features/tailwind-v4/files/tailwind-config/package.json +20 -0
  23. package/blueprints/features/tailwind-v4/files/tailwind-config/shared-styles.css +131 -0
  24. package/blueprints/features/ui-shared-components/BLUEPRINT.md +350 -13
  25. package/blueprints/features/ui-shared-components/files/ui/components.json +21 -0
  26. package/blueprints/features/ui-shared-components/files/ui/package.json +42 -0
  27. package/blueprints/features/ui-shared-components/files/ui/styles/globals.css +2 -0
  28. package/blueprints/features/ui-shared-components/files/ui/tsconfig.json +9 -0
  29. package/blueprints/features/ui-shared-components/files/ui/utils/cn.ts +6 -0
  30. package/blueprints/features/ui-shared-components/files/ui/utils/cva.ts +4 -0
  31. package/dist/index.js +210 -166
  32. package/package.json +6 -7
  33. package/.claude/commands/audit.md +0 -179
  34. package/.claude/commands/new-blueprint.md +0 -265
  35. package/.claude/commands/new-project.md +0 -230
  36. package/.claude/commands/scaffold-db.md +0 -270
  37. package/.cursor/commands/audit.md +0 -179
  38. package/.cursor/commands/discover.md +0 -92
  39. package/.cursor/commands/scaffold-auth.md +0 -310
  40. package/.cursor/commands/scaffold-foundation.md +0 -158
  41. package/.opencode/commands/discover.md +0 -96
  42. package/.opencode/commands/new-blueprint.md +0 -269
  43. package/.opencode/commands/new-project.md +0 -234
  44. package/.opencode/commands/scaffold-auth.md +0 -314
  45. package/.opencode/commands/scaffold-db.md +0 -274
  46. package/.opencode/commands/scaffold-foundation.md +0 -162
@@ -1,310 +0,0 @@
1
- # Scaffold Auth Blueprint
2
-
3
- Scaffold the `auth-better-auth` blueprint into the current project. Read the full blueprint first, then adapt it to this project's stack.
4
-
5
- ## Step 1: Read the Blueprint
6
-
7
- Read the full BLUEPRINT.md and all code files from the auth blueprint:
8
-
9
- ```
10
- blueprints/features/auth-better-auth/BLUEPRINT.md
11
- blueprints/features/auth-better-auth/files/**/*
12
- ```
13
-
14
- If these files are not in the current project, look for them at `~/Documents/WithMata/my-blueprints/blueprints/features/auth-better-auth/`. If still not found, ask the user for the path to their blueprints repo.
15
-
16
- ## Step 1.5: Read Project Context
17
-
18
- Check if `.project-context.md` exists in the target project root:
19
-
20
- - **If it exists**: read it to understand:
21
- - Product name and scope (from Discovery)
22
- - npm scope, workspace layout, server framework (from Foundation)
23
- - What other blueprints are already installed (from Installed Blueprints)
24
- - Use this information to pre-fill configuration questions in Step 3 and adapt file paths in Step 4
25
-
26
- - **If it does not exist**: proceed normally — explore the project manually (Step 2) and ask all configuration questions (Step 3)
27
-
28
- When project context provides clear answers, skip the corresponding questions in Step 3. For example:
29
- - Context says `server_framework: hono` -> do not ask about server framework
30
- - Context says `npm_scope: "@acme"` -> use `@acme` for package references
31
- - Context has `auth-better-auth` in Installed Blueprints -> warn about existing install
32
-
33
- ## Step 1.7: Check Blueprint Dependencies
34
-
35
- Read the Blueprint Dependencies section from `auth-better-auth/BLUEPRINT.md`.
36
-
37
- For `features/db-drizzle-postgres` (required):
38
- - Check `.project-context.md` for `db-drizzle-postgres` under `## Installed Blueprints`
39
- - If installed: proceed normally
40
- - If NOT installed, check filesystem:
41
- - Monorepo: does `packages/db/` exist?
42
- - Single-repo: does `src/db/` exist?
43
- - If db directory exists (but not in project context): note it, proceed normally — the scaffold command already handles merging
44
- - If neither installed nor directory exists:
45
- - Ask: "Auth requires a database package. The db-drizzle-postgres blueprint establishes the schema-group pattern that auth builds on. Install it first? (Y/n)"
46
- - If yes: run `/scaffold-db` first, then continue with auth
47
- - If no: warn about missing patterns, proceed with creating a minimal db structure for auth only
48
-
49
- For `foundation/monorepo-turbo` (recommended):
50
- - If not present: mention once: "Tip: The monorepo-turbo foundation blueprint provides workspace structure that auth integrates with. Consider running `/scaffold-foundation` first."
51
- - Continue without blocking.
52
-
53
- ## Step 2: Understand the Target Project
54
-
55
- Before making any changes, explore the target project to understand:
56
-
57
- ### 2a. Detect Project Type
58
-
59
- Check `.project-context.md` for `project_type`. If not present, detect:
60
-
61
- - **Monorepo indicators**: `pnpm-workspace.yaml`, `turbo.json`, `nx.json`, `lerna.json`, or `"workspaces"` in root `package.json`
62
- - **Single-repo indicators**: Single `package.json` at root, `src/` directory, no workspace config
63
-
64
- Confirm with user: "This looks like a [monorepo|single-repo] project. Is that right?"
65
-
66
- Record the project type in `.project-context.md` if not already there.
67
-
68
- ### 2b. Explore Structure
69
-
70
- **If monorepo:**
71
- 1. What workspaces exist? Where do apps, APIs, and packages live?
72
- 2. Is there a Hono server, Express server, or is it Next.js-only? Where are API routes?
73
- 3. Is Drizzle already set up? Is there a shared DB package?
74
- 4. Is this Next.js? What version? Is there an existing middleware.ts?
75
-
76
- **If single-repo:**
77
- 1. What framework is this? (Next.js, Node/Express, Hono, Bun?)
78
- 2. Does `src/db/` or `lib/db/` exist?
79
- 3. What import convention is used? (`@/` paths, `#` subpath imports, relative?)
80
- 4. Is there an existing `middleware.ts`?
81
-
82
- **Both:**
83
- 5. Existing auth to replace or integrate with?
84
- 6. UI library? Styling approach?
85
- 7. Package manager?
86
- 8. Validation — Zod, t3-env?
87
- 9. Data fetching — SWR, TanStack Query?
88
-
89
- Skip exploration for anything already documented in `.project-context.md`.
90
-
91
- ## Step 3: Ask Clarifying Questions
92
-
93
- Before scaffolding, ask the user about their preferences. Use the blueprint's "Hard Requirements vs Recommended Defaults" table. Specifically ask:
94
-
95
- 1. **Organization plugin** — "Do you need multi-tenant organizations (teams/workspaces with member management and invitations), or is this a single-tenant app?"
96
-
97
- 2. **Database setup** — "Should auth use a separate database, or share the existing app database?" (Recommend separate if no strong preference.)
98
-
99
- 3. **Social providers** — "Which social login providers do you want? Google is included by default. Any others (GitHub, Discord, etc.)?"
100
-
101
- 4. **Email provider** — "The blueprint uses Resend for transactional emails (verification, password reset, invitations). Do you want to use Resend, or a different provider?"
102
-
103
- 5. **Defaults check** — "The blueprint recommends these tools (which may already match your project). Want to go with the defaults, or change any?"
104
- - Zod for validation
105
- - t3-env for environment variable validation
106
- - SWR (`useSWRMutation`) for auth mutation hooks
107
- - react-hook-form for auth forms
108
-
109
- Skip questions where the answer is obvious from the project structure or from `.project-context.md`.
110
-
111
- ## Step 4: Adapt and Scaffold
112
-
113
- Based on the project structure, project context, and user answers, adapt the blueprint files:
114
-
115
- ### 4a. Database Layer
116
-
117
- **If monorepo:**
118
- - Copy/adapt `files/db/drizzle.config.ts` → `packages/db/drizzle/auth/drizzle.config.ts`
119
- - Copy `files/db/auth-schema.ts` as a reference (the actual schema will be auto-generated)
120
- - Add the `"./auth"` export to `packages/db/package.json`
121
- - Add `auth:generate` and `auth:migrate` scripts to `packages/db/package.json`
122
-
123
- **If single-repo:**
124
- - Copy/adapt `files/db/drizzle.config.ts` → `drizzle/auth/drizzle.config.ts` (at project root)
125
- - Adjust schema paths to `"./src/db/auth/schema.ts"` (relative to root)
126
- - Create `src/db/auth/` directory for auth schema
127
- - No separate package.json export needed — use direct imports
128
-
129
- ### 4b. Server Layer
130
-
131
- **If monorepo:**
132
- - Copy/adapt `files/server/auth.ts` → `apis/server/src/auth/index.ts`
133
- - Replace `{{APP_NAME}}`, `{{EMAIL_FROM}}`, `{{SCOPE}}`
134
- - Copy/adapt `files/server/auth-db.ts` → `apis/server/src/db/auth.ts`
135
- - Copy/adapt `files/server/middleware.ts` → `apis/server/src/middleware/auth.ts`
136
- - Merge auth env vars into `apis/server/src/env.ts`
137
-
138
- **If single-repo:**
139
- - Copy/adapt `files/server/auth.ts` → `src/lib/auth/index.ts`
140
- - Replace `{{APP_NAME}}`, `{{EMAIL_FROM}}`
141
- - Adjust DB import to use direct path: `import { db } from "@/db/auth/client"` or `#db/auth/client`
142
- - Copy/adapt `files/server/auth-db.ts` → `src/lib/db/auth.ts`
143
- - Default to Next.js API routes (no separate Hono server)
144
- - Merge auth env vars into existing `env.ts` (or create one)
145
-
146
- **Both:**
147
- - If the project uses a different server framework than Hono, adapt the middleware while keeping the core `auth.api.getSession({ headers })` pattern
148
-
149
- ### 4c. Mount Auth Handler
150
-
151
- **If monorepo with Hono server:**
152
- - Add CORS config + `app.on(["POST", "GET"], "/api/auth/*", ...)` handler in `apis/server/`
153
-
154
- **If single-repo or Next.js API routes:**
155
- - Create `app/api/auth/[...all]/route.ts` with `toNextJsHandler(auth)`
156
- - No CORS config needed (same origin)
157
-
158
- **Other frameworks:** Follow the platform integration section in BLUEPRINT.md
159
-
160
- ### 4d. Client Layer
161
-
162
- **If monorepo:**
163
- - Copy client files to `apps/web/auth/`
164
- - Add `"#auth/*": "./auth/*"` import alias to `apps/web/package.json`
165
-
166
- **If single-repo:**
167
- - Copy client files to `src/auth/`
168
- - Add `"#auth/*": "./src/auth/*"` import alias to root `package.json` (or use `@/auth/*` if that's the convention)
169
-
170
- **Both:**
171
- - Adapt `files/client/auth-client.ts` — adjust baseURL for deployment setup
172
- - If using org plugin: copy all `files/client/context/`, `hooks/`, `schema/`, `types/` files
173
- - If NOT using org plugin: only copy `files/client/schema/auth.ts`
174
-
175
- ### 4e. Route Protection
176
-
177
- - Copy/adapt `files/middleware/route-protection.ts` into the project's Next.js middleware
178
- - If middleware.ts already exists, MERGE the auth logic into it — don't overwrite
179
- - If using Hono standalone mode: add API proxy rewrites to `next.config.ts`
180
-
181
- ### 4f. Project Scripts
182
-
183
- **If monorepo:**
184
- - Add `auth:generate` script to the server package (runs `@better-auth/cli generate`)
185
- - Add `auth:generate`, `auth:migrate`, `auth:setup` to root `package.json` (Turbo wrappers)
186
- - Add `auth:generate` and `auth:migrate` tasks to `turbo.json` (both `cache: false`)
187
-
188
- **If single-repo:**
189
- - Add scripts directly to root `package.json`:
190
- - `auth:generate` -> `npx @better-auth/cli@latest generate --config ./src/lib/auth/index.ts --output ./src/db/auth/schema.ts --yes`
191
- - `auth:migrate` -> `drizzle-kit generate --config ./drizzle/auth/drizzle.config.ts && drizzle-kit migrate --config ./drizzle/auth/drizzle.config.ts`
192
- - `auth:setup` -> `pnpm auth:generate && pnpm auth:migrate`
193
- - No Turbo tasks needed
194
-
195
- ## Step 5: Update Project Context
196
-
197
- Append an entry to `.project-context.md` under `## Installed Blueprints`:
198
-
199
- ```yaml
200
- ### auth-better-auth
201
- blueprint: auth-better-auth
202
- choices:
203
- database: <user's choice>
204
- auth_db_isolation: <separate|shared>
205
- server_framework: <hono|next.js>
206
- organization_plugin: <true|false>
207
- social_providers: [<list>]
208
- email_provider: <resend|other>
209
- env_validation: <t3-env|other>
210
- form_validation: <zod|other>
211
- data_fetching: <swr|other>
212
- files_created:
213
- - <list of all files created or modified>
214
- env_vars_added:
215
- - <list of env vars>
216
- scripts_added:
217
- - <list of scripts>
218
- ```
219
-
220
- If `.project-context.md` does not exist, create it with the standard header and the Installed Blueprints section. Log a note: "No discovery or foundation context found. Consider running `/discover` and `/scaffold-foundation` for a complete project context."
221
-
222
- Also append any significant architectural decisions to the `## Architecture Decisions` section.
223
-
224
- ### Inject Maintenance Rules
225
-
226
- Append the condensed maintenance rules to the target project's rules file(s):
227
-
228
- 1. If `CLAUDE.md` exists in the target project → append rules there
229
- 2. If `AGENTS.md` exists in the target project → append rules there
230
- 3. If both exist → append to both (keep them in sync)
231
- 4. If neither exists → ask the user which AI coding tool(s) they use:
232
- - Claude Code → create CLAUDE.md with a `## Maintenance Rules` section
233
- - OpenCode or Cursor → create AGENTS.md with a `## Maintenance Rules` section (both tools read AGENTS.md)
234
- - Multiple tools → create all applicable files
235
-
236
- The maintenance rules content is identical regardless of which file it goes into:
237
-
238
- ```markdown
239
- ### auth-better-auth maintenance
240
- - After modifying Better Auth server config, plugins, or providers: run `pnpm auth:generate && pnpm auth:migrate`
241
- - After updating `better-auth` package: run `pnpm auth:generate`, check for schema changes, migrate if needed
242
- - After adding/changing env vars: update all `.env` files and verify `pnpm dev` starts clean
243
- - After changing `BETTER_AUTH_URL` or `FRONTEND_DOMAIN`: verify CORS config and OAuth callback URLs
244
- - After any auth changes: verify `{BETTER_AUTH_URL}/api/auth/ok` responds
245
- - Never edit the auto-generated auth schema directly — modify the Better Auth config and regenerate
246
- ```
247
-
248
- If the `## Maintenance Rules` heading already exists (from another blueprint), only add the `### auth-better-auth maintenance` subsection — do not duplicate the heading.
249
-
250
- ## Step 6: Output Summary
251
-
252
- After scaffolding, provide the user with a clear summary:
253
-
254
- ### Packages to Install
255
-
256
- List every package that needs to be installed, grouped by workspace:
257
-
258
- ```
259
- # Server (apis/server or wherever auth lives)
260
- pnpm add better-auth drizzle-orm pg resend @t3-oss/env-core zod dotenv
261
-
262
- # Client (apps/web)
263
- pnpm add better-auth swr react-hook-form @hookform/resolvers zod @t3-oss/env-nextjs
264
-
265
- # DB package (packages/db) — dev deps
266
- pnpm add -D drizzle-kit pg
267
- ```
268
-
269
- Adjust based on what's already installed in the project.
270
-
271
- ### Environment Variables
272
-
273
- List every env var that needs to be set, with example values:
274
-
275
- ```env
276
- # Server
277
- BETTER_AUTH_URL=http://localhost:4000
278
- BETTER_AUTH_SECRET= # Generate: openssl rand -base64 32
279
- AUTH_DATABASE_URL= # PostgreSQL connection URL
280
- FRONTEND_DOMAIN=http://localhost:3000
281
- GOOGLE_CLIENT_ID= # From Google Cloud Console
282
- GOOGLE_CLIENT_SECRET= # Redirect URI: {BETTER_AUTH_URL}/api/auth/callback/google
283
- RESEND_API_KEY= # From resend.com
284
-
285
- # Client (.env.local in web app)
286
- NEXT_PUBLIC_API_URL=http://localhost:4000
287
- NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000
288
- ```
289
-
290
- ### Manual Steps Remaining
291
-
292
- List anything that can't be automated:
293
-
294
- 1. **Create a PostgreSQL database** for auth (if using separate auth DB)
295
- 2. **Set up Google OAuth** — create OAuth 2.0 credentials in Google Cloud Console, add redirect URI
296
- 3. **Set up Resend** — create an account, verify your domain, get API key
297
- 4. **Run auth setup** — `pnpm auth:setup` (generates schema + runs migrations)
298
- 5. **Build auth UI pages** — follow the Auth Flows section in BLUEPRINT.md to create the pages matching your design system
299
- 6. **Test the auth flow** — sign up, verify email, sign in, create org (if applicable)
300
-
301
- ### Files Created
302
-
303
- List every file that was created or modified, with a one-line description.
304
-
305
- ## Important Notes
306
-
307
- - If the Better Auth skills are installed (`npx skillsadd better-auth/skills`), invoke `/best-practices` for quick-reference on configuration. If not available, refer to the Better Auth docs and References section in BLUEPRINT.md.
308
- - When adapting code, preserve the `// CONFIGURE:` comments so the user can find customization points later.
309
- - If the project structure differs significantly from the blueprint's assumptions, explain the differences and suggest how to adapt rather than forcing the blueprint's structure.
310
- - Never overwrite existing files without asking. If a file exists (like `middleware.ts` or `env.ts`), merge the auth additions into it.
@@ -1,158 +0,0 @@
1
- # Scaffold Foundation
2
-
3
- Set up the monorepo project skeleton using the foundation blueprint. **For single-repo applications** (standalone Next.js, Node, or Bun apps), skip this command and go directly to feature blueprints (`/scaffold-db`, `/scaffold-auth`) — they detect single-repo projects and adapt automatically.
4
-
5
- ## Step 1: Read the Blueprint
6
-
7
- Read the full foundation blueprint and all template files:
8
-
9
- ```
10
- ~/Documents/WithMata/my-blueprints/blueprints/foundation/monorepo-turbo/BLUEPRINT.md
11
- ~/Documents/WithMata/my-blueprints/blueprints/foundation/monorepo-turbo/files/**/*
12
- ```
13
-
14
- If not found at that path, ask the user for the path to their blueprints repo.
15
-
16
- The BLUEPRINT.md contains the full architecture documentation, naming conventions, folder conventions, and file manifest. Follow it precisely.
17
-
18
- ## Step 2: Read Project Context
19
-
20
- Check if `.project-context.md` exists in the target project root:
21
-
22
- - **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.
23
-
24
- - **If it has a Foundation section already**: warn the user. Ask: "Foundation was already set up. Do you want to re-scaffold (destructive — replaces existing structure) or skip?"
25
-
26
- - **If no context file exists**: that is fine. Ask the user directly for the product name and npm scope.
27
-
28
- ## Step 3: Understand Current State
29
-
30
- Explore the target project directory:
31
-
32
- - Is it empty? Fresh start — scaffold everything.
33
- - Does it already have files? Ask before overwriting anything.
34
- - Is there an existing `package.json`? Read it for context.
35
-
36
- ## Step 4: Ask Configuration Questions
37
-
38
- Only three questions — skip any already answered by project context:
39
-
40
- 1. **npm scope** — "What npm scope should internal packages use? (e.g., @acme)" Default: derive from product name.
41
- 2. **Project name** — "What is the human-readable project name?" (for metadata, page titles). Default: from discovery context.
42
- 3. **Node.js version** — "Target Node.js version?" Default: `>=22`.
43
-
44
- ## Step 5: Scaffold
45
-
46
- Create the monorepo skeleton by adapting all files from the blueprint. Replace placeholders:
47
-
48
- - `{{SCOPE}}` -> the npm scope (e.g., `@acme`)
49
- - `{{APP_NAME}}` -> the human-readable name (e.g., `Acme Dashboard`)
50
-
51
- ### 5a. Root Configuration
52
-
53
- From `files/root/`, create at project root:
54
- - `package.json` — root monorepo config
55
- - `turbo.json` — task orchestration
56
- - `pnpm-workspace.yaml` — workspace patterns
57
- - `biome.json` — linting + formatting
58
- - `.gitignore` — from `files/root/gitignore`
59
-
60
- ### 5b. Config Packages
61
-
62
- From `files/config/`, create:
63
- - `config/typescript-config/` — base.json, nextjs.json, react-library.json, package.json
64
- - `config/tailwind-config/` — shared-styles.css, postcss.config.js, package.json
65
-
66
- ### 5c. Next.js App Shell
67
-
68
- From `files/apps/web/`, create:
69
- - `apps/web/package.json`
70
- - `apps/web/tsconfig.json`
71
- - `apps/web/next.config.ts`
72
- - `apps/web/env.ts`
73
- - `apps/web/postcss.config.mjs`
74
- - `apps/web/app/layout.tsx`
75
- - `apps/web/app/page.tsx`
76
- - `apps/web/app/globals.css`
77
-
78
- ### 5d. Empty Workspace Directories
79
-
80
- Create empty directories for feature blueprints:
81
- - `apis/` — backend feature blueprint will add servers here
82
- - `packages/` — feature blueprints will add shared packages here
83
-
84
- ### 5e. Initialize
85
-
86
- After creating all files:
87
- 1. Initialize git if not already a repo: `git init`
88
- 2. Run `pnpm install` to verify the workspace configuration is valid
89
- 3. Verify the dev server starts: `pnpm dev` (briefly — just check it boots)
90
-
91
- ## Step 6: Update Project Context
92
-
93
- Append the `## Foundation` section to `.project-context.md`:
94
-
95
- ```yaml
96
- ## Foundation
97
- monorepo_tool: turborepo
98
- package_manager: pnpm
99
- npm_scope: "<scope>"
100
- node_version: ">=22"
101
- workspaces:
102
- apps: ["web"]
103
- apis: []
104
- packages: []
105
- config: ["typescript-config", "tailwind-config"]
106
- framework: next.js (app router)
107
- typescript: strict
108
- linter: biome
109
- styling: tailwind-v4
110
- env_validation: t3-env + zod
111
- module_resolution: node subpath imports (#prefix)
112
- foundation_completed: <date>
113
- ```
114
-
115
- If `.project-context.md` does not exist, create it with the standard header and the Foundation section.
116
-
117
- ### Inject Maintenance Rules
118
-
119
- Append the condensed maintenance rules to the target project's rules file(s):
120
-
121
- 1. If `CLAUDE.md` exists in the target project → append rules there
122
- 2. If `AGENTS.md` exists in the target project → append rules there
123
- 3. If both exist → append to both (keep them in sync)
124
- 4. If neither exists → ask the user which AI coding tool(s) they use:
125
- - Claude Code → create CLAUDE.md with a `## Maintenance Rules` section
126
- - OpenCode or Cursor → create AGENTS.md with a `## Maintenance Rules` section (both tools read AGENTS.md)
127
- - Multiple tools → create all applicable files
128
-
129
- The maintenance rules content is identical regardless of which file it goes into:
130
-
131
- ```markdown
132
- ## Maintenance Rules
133
-
134
- ### Monorepo maintenance
135
- - After every code change: format with Biome (`pnpm biome check --write .`) before considering work complete
136
- - After adding new workspace packages: verify `pnpm-workspace.yaml` patterns match, run `pnpm install`
137
- - After modifying shared configs (`config/typescript-config/`, `config/tailwind-config/`): verify all consumers still build
138
- - After changing `turbo.json`: verify task ordering with `pnpm turbo run <task> --dry`
139
- - After adding workspace dependencies: run `pnpm install` to create workspace links
140
- - Keep `turbo.json` tasks with `cache: false` for any task with side effects (migrations, code generation)
141
- ```
142
-
143
- ## Step 7: Summarize
144
-
145
- Tell the user:
146
-
147
- - Project structure overview (directory tree)
148
- - What was configured (scope, Node version, tooling)
149
- - How to start development: `pnpm dev`
150
- - Available feature blueprints to install next
151
- - Suggest: "Run `/scaffold-auth` to add authentication. Other feature blueprints: ui-shared-components, tailwind-v4, db-drizzle-postgres."
152
-
153
- ## Important Notes
154
-
155
- - Never overwrite existing files without asking.
156
- - Preserve all `// CONFIGURE:` comments in generated files so the user can find customization points.
157
- - The Tailwind config is intentionally minimal — the UI feature blueprint extends it with shadcn, animations, and component-specific styles.
158
- - Feature blueprints will add scripts to root `package.json` and tasks to `turbo.json` — the foundation provides the base that they extend.
@@ -1,96 +0,0 @@
1
- ---
2
- description: Run a structured product discovery session — outputs docs, no code
3
- ---
4
-
5
- # Run Product Discovery
6
-
7
- Run a rigorous product discovery session. This produces product documentation — no code is generated. The session is a structured 60-minute deep dive that transforms a raw idea into a defensible product strategy.
8
-
9
- ## Step 1: Read the Blueprint
10
-
11
- Read the full discovery blueprint and all templates:
12
-
13
- ```
14
- ~/Documents/WithMata/my-blueprints/blueprints/discovery/product-discovery/BLUEPRINT.md
15
- ~/Documents/WithMata/my-blueprints/blueprints/discovery/product-discovery/templates/*
16
- ```
17
-
18
- If not found at that path, ask the user for the path to their blueprints repo.
19
-
20
- The BLUEPRINT.md contains the full methodology: phased session structure, frameworks, operating principles, research strategy, challenge patterns, and quality checkpoints. Follow it precisely.
21
-
22
- ## Step 2: Check for Existing Discovery
23
-
24
- Check if `.project-context.md` exists and already contains a `## Product Discovery` section. If it does:
25
-
26
- - Show the user what was previously discovered
27
- - Ask: "Product discovery was already completed. Would you like to redo it (replaces existing), refine it (update specific sections), or skip?"
28
-
29
- ## Step 3: Run the Discovery Session
30
-
31
- Follow the full 5-phase discovery process documented in BLUEPRINT.md. The blueprint contains the complete methodology: phase structure, frameworks, operating principles, research strategy, challenge patterns, and quality gates. Follow it precisely. Do not abbreviate or skip phases.
32
-
33
- This is conversational — you are guiding the user through structured discovery, not filling in a form.
34
-
35
- Quick reference for the phases:
36
- 1. **Phase 1: Initial Framing** — what and who
37
- 2. **Phase 2: Problem Deep Dive** — root cause via 5 Whys
38
- 3. **Phase 3: User Definition** — archetypes and persona variations
39
- 4. **Phase 4: Solution Positioning** — competitive landscape and differentiation
40
- 5. **Phase 5: Synthesis** — distill findings for documentation
41
-
42
- ## Step 4: Verify Quality Checkpoints
43
-
44
- Before generating documentation, verify ALL quality checkpoints listed in BLUEPRINT.md pass. If any fail, continue probing — do not rush to documentation.
45
-
46
- ## Step 5: Generate Documentation
47
-
48
- Create the `docs/product/` directory structure in the target project. Use the templates from the blueprint as the structural guide — fill them with the session's findings.
49
-
50
- ```
51
- docs/
52
- └── product/
53
- ├── product-thesis.md
54
- ├── product-brief.md
55
- └── users/
56
- ├── archetype-[name].md # One per archetype identified
57
- └── research-summary.md
58
- ```
59
-
60
- See BLUEPRINT.md for document quality standards and writing guidelines for each document type. Do not create files beyond what's specified. Do not rename the structure.
61
-
62
- ## Step 6: Update Project Context
63
-
64
- Create or update `.project-context.md` in the target project root:
65
-
66
- - If the file does not exist, create it with a header and the `## Product Discovery` section
67
- - If the file exists but has no discovery section, add the discovery section after the header
68
- - If the file exists with a discovery section (user chose to redo), replace that section only
69
-
70
- Append this structured YAML block:
71
-
72
- ```yaml
73
- ## Product Discovery
74
- product_name: "<name>"
75
- problem_statement: "<one sentence>"
76
- core_pillars:
77
- - "<pillar 1>"
78
- - "<pillar 2>"
79
- - "<pillar 3>"
80
- primary_archetype: "<archetype name>"
81
- discovery_completed: <date>
82
- artifacts:
83
- - docs/product/product-thesis.md
84
- - docs/product/product-brief.md
85
- - docs/product/users/archetype-<name>.md
86
- - docs/product/users/research-summary.md
87
- ```
88
-
89
- ## Step 7: Summary
90
-
91
- Tell the user:
92
-
93
- - What documents were generated (list each with a one-line description)
94
- - Key findings: core pillars, primary archetype, main competitive gap
95
- - Critical assumptions that need validation
96
- - Suggest next step: "Run `/scaffold-foundation` to set up the project skeleton, or `/new-project` to continue the full workflow."