@withmata/blueprints 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/audit.md +179 -0
- package/.claude/commands/discover.md +92 -0
- package/.claude/commands/new-blueprint.md +265 -0
- package/.claude/commands/new-project.md +230 -0
- package/.claude/commands/scaffold-auth.md +310 -0
- package/.claude/commands/scaffold-db.md +270 -0
- package/.claude/commands/scaffold-foundation.md +158 -0
- package/.cursor/commands/audit.md +179 -0
- package/.cursor/commands/discover.md +92 -0
- package/.cursor/commands/new-blueprint.md +265 -0
- package/.cursor/commands/new-project.md +230 -0
- package/.cursor/commands/scaffold-auth.md +310 -0
- package/.cursor/commands/scaffold-db.md +270 -0
- package/.cursor/commands/scaffold-foundation.md +158 -0
- package/.opencode/commands/audit.md +183 -0
- package/.opencode/commands/discover.md +96 -0
- package/.opencode/commands/new-blueprint.md +269 -0
- package/.opencode/commands/new-project.md +234 -0
- package/.opencode/commands/scaffold-auth.md +314 -0
- package/.opencode/commands/scaffold-db.md +274 -0
- package/.opencode/commands/scaffold-foundation.md +162 -0
- package/ENGINEERING.md +47 -0
- package/blueprints/discovery/product-discovery/BLUEPRINT.md +361 -0
- package/blueprints/discovery/product-discovery/templates/archetype-template.md +143 -0
- package/blueprints/discovery/product-discovery/templates/product-brief.md +65 -0
- package/blueprints/discovery/product-discovery/templates/product-thesis.md +64 -0
- package/blueprints/discovery/product-discovery/templates/research-summary.md +43 -0
- package/blueprints/features/auth-better-auth/BLUEPRINT.md +794 -0
- package/blueprints/features/auth-better-auth/files/client/auth-client.ts +31 -0
- package/blueprints/features/auth-better-auth/files/client/context/organization.ts +236 -0
- package/blueprints/features/auth-better-auth/files/client/hooks/use-create-organization.ts +45 -0
- package/blueprints/features/auth-better-auth/files/client/hooks/use-has-permission.ts +26 -0
- package/blueprints/features/auth-better-auth/files/client/hooks/use-organization.ts +64 -0
- package/blueprints/features/auth-better-auth/files/client/schema/auth.ts +21 -0
- package/blueprints/features/auth-better-auth/files/client/schema/organization.ts +51 -0
- package/blueprints/features/auth-better-auth/files/client/types/organization.ts +20 -0
- package/blueprints/features/auth-better-auth/files/db/auth-schema.ts +184 -0
- package/blueprints/features/auth-better-auth/files/db/drizzle.config.ts +21 -0
- package/blueprints/features/auth-better-auth/files/middleware/route-protection.ts +84 -0
- package/blueprints/features/auth-better-auth/files/server/auth-db.ts +18 -0
- package/blueprints/features/auth-better-auth/files/server/auth.ts +159 -0
- package/blueprints/features/auth-better-auth/files/server/env.ts +44 -0
- package/blueprints/features/auth-better-auth/files/server/middleware.ts +144 -0
- package/blueprints/features/db-drizzle-postgres/BLUEPRINT.md +596 -0
- package/blueprints/features/db-drizzle-postgres/files/db/drizzle.config.ts +18 -0
- package/blueprints/features/db-drizzle-postgres/files/db/env.example +3 -0
- package/blueprints/features/db-drizzle-postgres/files/db/package.json +33 -0
- package/blueprints/features/db-drizzle-postgres/files/db/src/client.ts +34 -0
- package/blueprints/features/db-drizzle-postgres/files/db/src/example-entity.ts +73 -0
- package/blueprints/features/db-drizzle-postgres/files/db/src/index.ts +8 -0
- package/blueprints/features/db-drizzle-postgres/files/db/src/scripts/seed.ts +50 -0
- package/blueprints/features/db-drizzle-postgres/files/db/tsconfig.json +13 -0
- package/blueprints/features/tailwind-v4/BLUEPRINT.md +29 -0
- package/blueprints/features/ui-shared-components/BLUEPRINT.md +35 -0
- package/blueprints/foundation/monorepo-turbo/BLUEPRINT.md +378 -0
- package/blueprints/foundation/monorepo-turbo/files/apps/web/app/globals.css +2 -0
- package/blueprints/foundation/monorepo-turbo/files/apps/web/app/layout.tsx +23 -0
- package/blueprints/foundation/monorepo-turbo/files/apps/web/app/page.tsx +7 -0
- package/blueprints/foundation/monorepo-turbo/files/apps/web/env.ts +13 -0
- package/blueprints/foundation/monorepo-turbo/files/apps/web/next.config.ts +12 -0
- package/blueprints/foundation/monorepo-turbo/files/apps/web/package.json +28 -0
- package/blueprints/foundation/monorepo-turbo/files/apps/web/postcss.config.mjs +5 -0
- package/blueprints/foundation/monorepo-turbo/files/apps/web/tsconfig.json +18 -0
- package/blueprints/foundation/monorepo-turbo/files/config/tailwind-config/package.json +14 -0
- package/blueprints/foundation/monorepo-turbo/files/config/tailwind-config/postcss.config.mjs +5 -0
- package/blueprints/foundation/monorepo-turbo/files/config/tailwind-config/shared-styles.css +88 -0
- package/blueprints/foundation/monorepo-turbo/files/config/typescript-config/base.json +19 -0
- package/blueprints/foundation/monorepo-turbo/files/config/typescript-config/nextjs.json +12 -0
- package/blueprints/foundation/monorepo-turbo/files/config/typescript-config/package.json +5 -0
- package/blueprints/foundation/monorepo-turbo/files/config/typescript-config/react-library.json +7 -0
- package/blueprints/foundation/monorepo-turbo/files/root/biome.json +46 -0
- package/blueprints/foundation/monorepo-turbo/files/root/gitignore +35 -0
- package/blueprints/foundation/monorepo-turbo/files/root/package.json +25 -0
- package/blueprints/foundation/monorepo-turbo/files/root/pnpm-workspace.yaml +5 -0
- package/blueprints/foundation/monorepo-turbo/files/root/turbo.json +30 -0
- package/dist/index.js +453 -0
- package/package.json +53 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Project Audit
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Step 1: Read Available Blueprints
|
|
6
|
+
|
|
7
|
+
Load all available blueprint specs to understand what is possible:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
~/Documents/WithMata/my-blueprints/blueprints/discovery/product-discovery/BLUEPRINT.md
|
|
11
|
+
~/Documents/WithMata/my-blueprints/blueprints/foundation/monorepo-turbo/BLUEPRINT.md
|
|
12
|
+
~/Documents/WithMata/my-blueprints/blueprints/features/auth-better-auth/BLUEPRINT.md
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Also scan for any additional feature blueprints:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
~/Documents/WithMata/my-blueprints/blueprints/features/*/BLUEPRINT.md
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Only consider a blueprint "available" if its BLUEPRINT.md has `Status: Complete`. If not found at these paths, ask the user for the path to their blueprints repo.
|
|
22
|
+
|
|
23
|
+
## Step 2: Read Project Context
|
|
24
|
+
|
|
25
|
+
Check if `.project-context.md` exists in this project root.
|
|
26
|
+
|
|
27
|
+
- **If it exists**: read it fully. Note which stages are complete (Discovery, Foundation, Installed Blueprints) and what choices were made.
|
|
28
|
+
- **If it does not exist**: note this — it means either no blueprints have been used, or the project predates the blueprint system.
|
|
29
|
+
|
|
30
|
+
## Step 3: Explore the Project
|
|
31
|
+
|
|
32
|
+
Regardless of whether project context exists, explore the actual project to understand its true state. If `.project-context.md` contradicts what you find in the actual files, trust the files and note the discrepancy.
|
|
33
|
+
|
|
34
|
+
### 3a. Product & Planning
|
|
35
|
+
|
|
36
|
+
- Does `docs/product/` exist? Are there product briefs, user stories, or discovery artifacts?
|
|
37
|
+
- Is there any structured product documentation, or just a README?
|
|
38
|
+
|
|
39
|
+
### 3b. Project Structure & Type
|
|
40
|
+
|
|
41
|
+
- **Detect project type:**
|
|
42
|
+
- **Monorepo indicators**: `pnpm-workspace.yaml`, `turbo.json`, `nx.json`, `lerna.json`, or `"workspaces"` in root `package.json`
|
|
43
|
+
- **Single-repo indicators**: Single `package.json` at root, `src/` directory, no workspace config
|
|
44
|
+
- Record as `monorepo` or `single-repo` in the report
|
|
45
|
+
- What package manager? Check for `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`, `bun.lock`
|
|
46
|
+
- If monorepo: What workspaces exist? List `apps/`, `packages/`, `apis/`, `config/` or equivalent
|
|
47
|
+
- Is there a `biome.json`? ESLint config? Prettier config?
|
|
48
|
+
- Is TypeScript strict? Check `tsconfig.json` for `strict: true` and `noUncheckedIndexedAccess`
|
|
49
|
+
- Are there shared config packages? Or is config duplicated?
|
|
50
|
+
|
|
51
|
+
### 3c. Authentication
|
|
52
|
+
|
|
53
|
+
- Is there an auth system? Search for:
|
|
54
|
+
- Better Auth config files (`better-auth`, `createAuthClient`)
|
|
55
|
+
- NextAuth/Auth.js files (`auth.ts`, `[...nextauth]`, `authOptions`)
|
|
56
|
+
- Hand-rolled auth (JWT imports, `bcrypt`, `jsonwebtoken`, session handling in middleware)
|
|
57
|
+
- Third-party services (Clerk, Auth0, Supabase auth, Firebase auth)
|
|
58
|
+
- Are there login/signup pages? Route protection middleware?
|
|
59
|
+
- Are there organization/team/workspace features?
|
|
60
|
+
|
|
61
|
+
### 3d. Database
|
|
62
|
+
|
|
63
|
+
- Is Drizzle set up? Check for `drizzle.config.ts`, `drizzle-kit`
|
|
64
|
+
- Other ORMs? Check for Prisma (`schema.prisma`), TypeORM, Knex
|
|
65
|
+
- Is there a shared DB package, or is database access scattered?
|
|
66
|
+
|
|
67
|
+
### 3e. Styling & UI
|
|
68
|
+
|
|
69
|
+
- Tailwind version? Check `tailwindcss` version in package.json — v3 (JS config) vs v4 (CSS config)
|
|
70
|
+
- Is there a shared UI package, or are components duplicated?
|
|
71
|
+
- Component library? shadcn/ui, Radix, MUI, Chakra?
|
|
72
|
+
|
|
73
|
+
### 3f. Environment & Validation
|
|
74
|
+
|
|
75
|
+
- How are env vars handled? t3-env, raw `process.env`, dotenv only?
|
|
76
|
+
- Is there input validation? Zod, Valibot, Yup, Joi?
|
|
77
|
+
|
|
78
|
+
### 3g. Code Quality
|
|
79
|
+
|
|
80
|
+
- Are there patterns that diverge from best practices?
|
|
81
|
+
- Default exports where named exports are preferred
|
|
82
|
+
- Missing barrel exports (`index.ts`) in packages
|
|
83
|
+
- File-type organization instead of feature-based
|
|
84
|
+
- Missing or inconsistent error handling
|
|
85
|
+
|
|
86
|
+
### 3h. Blueprint Dependency Check
|
|
87
|
+
|
|
88
|
+
For each blueprint listed under `## Installed Blueprints` in `.project-context.md`:
|
|
89
|
+
- Read its `## Blueprint Dependencies` section from the BLUEPRINT.md
|
|
90
|
+
- Check if each `required` dependency is also listed in Installed Blueprints
|
|
91
|
+
- If a required dependency is missing, include it in the report as a recommendation
|
|
92
|
+
|
|
93
|
+
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."
|
|
94
|
+
|
|
95
|
+
## Step 4: Generate the Audit Report
|
|
96
|
+
|
|
97
|
+
Present findings as a structured report. Be concrete and specific — reference actual files and patterns found.
|
|
98
|
+
|
|
99
|
+
### Report Format
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
**Project Audit: [project name or directory name]**
|
|
104
|
+
|
|
105
|
+
### Current State
|
|
106
|
+
|
|
107
|
+
| Area | Status | Details |
|
|
108
|
+
|------|--------|---------|
|
|
109
|
+
| Product Discovery | [done / not found / partial] | [Brief note] |
|
|
110
|
+
| Foundation / Structure | [done / partial / needs work] | [Brief note] |
|
|
111
|
+
| Authentication | [blueprint / hand-rolled / third-party / none] | [Brief note] |
|
|
112
|
+
| Database | [Drizzle / Prisma / other / none] | [Brief note] |
|
|
113
|
+
| Styling | [Tailwind v4 / v3 / other] | [Brief note] |
|
|
114
|
+
| Code Quality | [good / needs attention] | [Brief note] |
|
|
115
|
+
|
|
116
|
+
### Recommendations
|
|
117
|
+
|
|
118
|
+
For each recommendation:
|
|
119
|
+
|
|
120
|
+
1. **[Priority: High/Medium/Low] [Category] — [One-line summary]**
|
|
121
|
+
- **What we found:** [Specific observation referencing actual files]
|
|
122
|
+
- **Why it matters:** [Impact on the project — explain for non-technical users too]
|
|
123
|
+
- **Action:** [Exact command or step to fix it]
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### Recommendation Priority Guidelines
|
|
128
|
+
|
|
129
|
+
**High priority** — things that block progress or create real risk:
|
|
130
|
+
- No auth system and the product needs user accounts
|
|
131
|
+
- No monorepo structure in a multi-workspace project
|
|
132
|
+
- Hand-rolled auth with security gaps (plain text passwords, no CSRF, no rate limiting)
|
|
133
|
+
- Missing environment variable validation
|
|
134
|
+
|
|
135
|
+
**Medium priority** — things that improve quality and maintainability:
|
|
136
|
+
- A blueprint could replace hand-rolled infrastructure
|
|
137
|
+
- Missing product documentation for a project still figuring out its direction
|
|
138
|
+
- Inconsistent patterns across workspaces
|
|
139
|
+
- Tailwind v3 when v4 is available
|
|
140
|
+
- ESLint + Prettier when Biome could replace both
|
|
141
|
+
|
|
142
|
+
**Low priority** — nice-to-haves:
|
|
143
|
+
- Blueprints in development that are not yet available (mention them as "coming soon")
|
|
144
|
+
- Style preferences that do not affect functionality
|
|
145
|
+
- Optimizations for mature projects
|
|
146
|
+
|
|
147
|
+
## Step 5: Provide Actionable Next Steps
|
|
148
|
+
|
|
149
|
+
End the report with a clear list of what to do, in recommended order:
|
|
150
|
+
|
|
151
|
+
### Next Steps
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
# Run these in order — each one is independent, stop whenever you want
|
|
155
|
+
|
|
156
|
+
1. [command] # [what it does and why]
|
|
157
|
+
2. [command] # [what it does and why]
|
|
158
|
+
...
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
For blueprint commands, use the slash command format: `/discover`, `/scaffold-foundation`, `/scaffold-auth`
|
|
162
|
+
|
|
163
|
+
For non-blueprint improvements, include the actual shell commands or instructions.
|
|
164
|
+
|
|
165
|
+
## Tone Guidelines
|
|
166
|
+
|
|
167
|
+
- **Be honest.** If the project is in great shape, say so. Do not manufacture recommendations.
|
|
168
|
+
- **Be warm and accessible.** The user may be non-technical. Explain WHY something matters, not just what to do.
|
|
169
|
+
- **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.
|
|
170
|
+
- **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.
|
|
171
|
+
- **Do not overwhelm.** Lead with the 3-5 most impactful recommendations. If there are many findings, prioritize.
|
|
172
|
+
- **Celebrate what is done well.** If something follows best practices, acknowledge it briefly.
|
|
173
|
+
|
|
174
|
+
## Important Notes
|
|
175
|
+
|
|
176
|
+
- This command is **read-only**. It does not modify any files — it only reads and reports.
|
|
177
|
+
- 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.
|
|
178
|
+
- 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`.
|
|
179
|
+
- If everything looks good, say so: "This project is in great shape. No immediate recommendations."
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Run Product Discovery
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Step 1: Read the Blueprint
|
|
6
|
+
|
|
7
|
+
Read the full discovery blueprint and all templates:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
~/Documents/WithMata/my-blueprints/blueprints/discovery/product-discovery/BLUEPRINT.md
|
|
11
|
+
~/Documents/WithMata/my-blueprints/blueprints/discovery/product-discovery/templates/*
|
|
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 methodology: phased session structure, frameworks, operating principles, research strategy, challenge patterns, and quality checkpoints. Follow it precisely.
|
|
17
|
+
|
|
18
|
+
## Step 2: Check for Existing Discovery
|
|
19
|
+
|
|
20
|
+
Check if `.project-context.md` exists and already contains a `## Product Discovery` section. If it does:
|
|
21
|
+
|
|
22
|
+
- Show the user what was previously discovered
|
|
23
|
+
- Ask: "Product discovery was already completed. Would you like to redo it (replaces existing), refine it (update specific sections), or skip?"
|
|
24
|
+
|
|
25
|
+
## Step 3: Run the Discovery Session
|
|
26
|
+
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
This is conversational — you are guiding the user through structured discovery, not filling in a form.
|
|
30
|
+
|
|
31
|
+
Quick reference for the phases:
|
|
32
|
+
1. **Phase 1: Initial Framing** — what and who
|
|
33
|
+
2. **Phase 2: Problem Deep Dive** — root cause via 5 Whys
|
|
34
|
+
3. **Phase 3: User Definition** — archetypes and persona variations
|
|
35
|
+
4. **Phase 4: Solution Positioning** — competitive landscape and differentiation
|
|
36
|
+
5. **Phase 5: Synthesis** — distill findings for documentation
|
|
37
|
+
|
|
38
|
+
## Step 4: Verify Quality Checkpoints
|
|
39
|
+
|
|
40
|
+
Before generating documentation, verify ALL quality checkpoints listed in BLUEPRINT.md pass. If any fail, continue probing — do not rush to documentation.
|
|
41
|
+
|
|
42
|
+
## Step 5: Generate Documentation
|
|
43
|
+
|
|
44
|
+
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.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
docs/
|
|
48
|
+
└── product/
|
|
49
|
+
├── product-thesis.md
|
|
50
|
+
├── product-brief.md
|
|
51
|
+
└── users/
|
|
52
|
+
├── archetype-[name].md # One per archetype identified
|
|
53
|
+
└── research-summary.md
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
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.
|
|
57
|
+
|
|
58
|
+
## Step 6: Update Project Context
|
|
59
|
+
|
|
60
|
+
Create or update `.project-context.md` in the target project root:
|
|
61
|
+
|
|
62
|
+
- If the file does not exist, create it with a header and the `## Product Discovery` section
|
|
63
|
+
- If the file exists but has no discovery section, add the discovery section after the header
|
|
64
|
+
- If the file exists with a discovery section (user chose to redo), replace that section only
|
|
65
|
+
|
|
66
|
+
Append this structured YAML block:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
## Product Discovery
|
|
70
|
+
product_name: "<name>"
|
|
71
|
+
problem_statement: "<one sentence>"
|
|
72
|
+
core_pillars:
|
|
73
|
+
- "<pillar 1>"
|
|
74
|
+
- "<pillar 2>"
|
|
75
|
+
- "<pillar 3>"
|
|
76
|
+
primary_archetype: "<archetype name>"
|
|
77
|
+
discovery_completed: <date>
|
|
78
|
+
artifacts:
|
|
79
|
+
- docs/product/product-thesis.md
|
|
80
|
+
- docs/product/product-brief.md
|
|
81
|
+
- docs/product/users/archetype-<name>.md
|
|
82
|
+
- docs/product/users/research-summary.md
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Step 7: Summary
|
|
86
|
+
|
|
87
|
+
Tell the user:
|
|
88
|
+
|
|
89
|
+
- What documents were generated (list each with a one-line description)
|
|
90
|
+
- Key findings: core pillars, primary archetype, main competitive gap
|
|
91
|
+
- Critical assumptions that need validation
|
|
92
|
+
- Suggest next step: "Run `/scaffold-foundation` to set up the project skeleton, or `/new-project` to continue the full workflow."
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# Add a New Blueprint
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Step 1: Understand the Conventions
|
|
6
|
+
|
|
7
|
+
Read these files to understand the system you're adding to:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
ENGINEERING.md # Engineering preferences
|
|
11
|
+
README.md # System overview and blueprint anatomy
|
|
12
|
+
CHANGELOG.md # To update when done
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Also scan existing complete blueprints to understand the quality bar:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
blueprints/features/auth-better-auth/BLUEPRINT.md # Best example of a feature blueprint
|
|
19
|
+
blueprints/foundation/monorepo-turbo/BLUEPRINT.md # Best example of a foundation blueprint
|
|
20
|
+
blueprints/discovery/product-discovery/BLUEPRINT.md # Best example of a discovery blueprint
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Step 2: Gather Information
|
|
24
|
+
|
|
25
|
+
Ask the user:
|
|
26
|
+
|
|
27
|
+
1. **"What pattern are you extracting?"** — What does it do? (e.g., "shared database layer with Drizzle", "Stripe billing integration", "email service with Resend")
|
|
28
|
+
|
|
29
|
+
2. **"Which tier?"** — Discovery (produces docs), Foundation (project skeleton), or Feature (plugs into existing project)? Most new blueprints are Features.
|
|
30
|
+
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
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`).
|
|
34
|
+
|
|
35
|
+
## Step 3: Extract or Build
|
|
36
|
+
|
|
37
|
+
### If extracting from an existing project:
|
|
38
|
+
|
|
39
|
+
Read the relevant code in the source project. Understand:
|
|
40
|
+
- What files are involved
|
|
41
|
+
- How they connect to each other
|
|
42
|
+
- What's project-specific vs what's the reusable pattern
|
|
43
|
+
- What dependencies are needed
|
|
44
|
+
- What environment variables are required
|
|
45
|
+
- How it integrates with the monorepo (workspace deps, turbo tasks, root scripts)
|
|
46
|
+
|
|
47
|
+
Then create the blueprint:
|
|
48
|
+
|
|
49
|
+
1. Create the directory: `blueprints/{tier}/{name}/`
|
|
50
|
+
2. Create `files/` with the extracted code — generalize project-specific values:
|
|
51
|
+
- Replace npm scopes with `{{SCOPE}}`
|
|
52
|
+
- Replace app names with `{{APP_NAME}}`
|
|
53
|
+
- Replace project-specific emails, URLs, etc. with `{{PLACEHOLDER}}` and `// CONFIGURE:` comments
|
|
54
|
+
- Remove any business logic that's not part of the pattern
|
|
55
|
+
3. Create `BLUEPRINT.md` following the structure below
|
|
56
|
+
|
|
57
|
+
### If building from scratch:
|
|
58
|
+
|
|
59
|
+
1. Create the directory: `blueprints/{tier}/{name}/`
|
|
60
|
+
2. Build the code files in `files/`, following the conventions in ENGINEERING.md
|
|
61
|
+
3. Create `BLUEPRINT.md` following the structure below
|
|
62
|
+
|
|
63
|
+
## Step 4: Write the BLUEPRINT.md
|
|
64
|
+
|
|
65
|
+
This is the most important file. It's what makes AI-assisted scaffolding intelligent rather than mechanical. Follow this structure:
|
|
66
|
+
|
|
67
|
+
### Required sections (all tiers):
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
# [Name] Blueprint — [Short Description]
|
|
71
|
+
|
|
72
|
+
## Tier
|
|
73
|
+
[Discovery | Foundation | Feature]
|
|
74
|
+
|
|
75
|
+
## Status
|
|
76
|
+
[Complete | In Progress | Planned]
|
|
77
|
+
|
|
78
|
+
## Problem
|
|
79
|
+
[What problem does this blueprint solve? Be specific about the pain point.]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Additional sections for Feature blueprints:
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
## Blueprint Dependencies
|
|
86
|
+
|
|
87
|
+
[Does this blueprint require or recommend other blueprints be installed first?
|
|
88
|
+
List them in a table with columns: Blueprint, Type (required/recommended), Why.
|
|
89
|
+
If required, include a subsection explaining fallback behavior if the dependency is absent.
|
|
90
|
+
If no dependencies, write "None."]
|
|
91
|
+
|
|
92
|
+
## Single-Repo Adaptation
|
|
93
|
+
|
|
94
|
+
[How does file placement, imports, and scripts differ for standalone (non-monorepo) apps?
|
|
95
|
+
Include a path mapping table (monorepo vs single-repo) and a single-repo scripts example.
|
|
96
|
+
Document what core patterns stay the same regardless of project type.]
|
|
97
|
+
|
|
98
|
+
## Architecture
|
|
99
|
+
|
|
100
|
+
### Core Pattern
|
|
101
|
+
[How does this work at a high level?]
|
|
102
|
+
|
|
103
|
+
### Key Decisions
|
|
104
|
+
[For each major decision, document WHAT you chose and WHY. This is what lets the AI coding tool adapt intelligently.]
|
|
105
|
+
|
|
106
|
+
- **[Decision 1]** (recommended/required) — [Explanation of what and why. Include alternatives if relevant.]
|
|
107
|
+
- **[Decision 2]** (optional) — [Explanation]
|
|
108
|
+
|
|
109
|
+
## Hard Requirements vs Recommended Defaults
|
|
110
|
+
|
|
111
|
+
**Hard requirements:**
|
|
112
|
+
- [Things that can't change]
|
|
113
|
+
|
|
114
|
+
**Recommended defaults — ask during scaffolding:**
|
|
115
|
+
|
|
116
|
+
| Choice | Recommended | Alternatives |
|
|
117
|
+
|---|---|---|
|
|
118
|
+
| [Choice 1] | [Default] | [Options] |
|
|
119
|
+
|
|
120
|
+
## Dependencies
|
|
121
|
+
|
|
122
|
+
### npm packages
|
|
123
|
+
|
|
124
|
+
**Server:**
|
|
125
|
+
| Package | Version | Purpose |
|
|
126
|
+
|---|---|---|
|
|
127
|
+
| [pkg] | [version] | [why] |
|
|
128
|
+
|
|
129
|
+
**Client:**
|
|
130
|
+
| Package | Version | Purpose |
|
|
131
|
+
|---|---|---|
|
|
132
|
+
|
|
133
|
+
### Environment Variables
|
|
134
|
+
|
|
135
|
+
| Variable | Where | Description |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| [VAR] | [Server/Client] | [What it's for] |
|
|
138
|
+
|
|
139
|
+
## Monorepo Wiring
|
|
140
|
+
|
|
141
|
+
[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.]
|
|
142
|
+
|
|
143
|
+
## File Manifest
|
|
144
|
+
|
|
145
|
+
| File | Purpose | Target Location |
|
|
146
|
+
|---|---|---|
|
|
147
|
+
| [file path in files/] | [what it does] | [where it goes in target project] |
|
|
148
|
+
|
|
149
|
+
## Integration Steps
|
|
150
|
+
|
|
151
|
+
[Ordered phases for scaffolding. Group related steps.]
|
|
152
|
+
|
|
153
|
+
### Phase 1: [Name]
|
|
154
|
+
1. [Step]
|
|
155
|
+
2. [Step]
|
|
156
|
+
|
|
157
|
+
### Phase 2: [Name]
|
|
158
|
+
...
|
|
159
|
+
|
|
160
|
+
## Maintenance Hooks
|
|
161
|
+
|
|
162
|
+
[What needs to happen after changes to keep this working?]
|
|
163
|
+
|
|
164
|
+
### Condensed Rules for project rules file
|
|
165
|
+
|
|
166
|
+
```markdown
|
|
167
|
+
### [name] maintenance
|
|
168
|
+
- [rule 1]
|
|
169
|
+
- [rule 2]
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## References
|
|
173
|
+
|
|
174
|
+
- [Links to docs, repos, etc.]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Additional sections for Discovery blueprints:
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
## Output
|
|
181
|
+
[What documents are generated and where]
|
|
182
|
+
|
|
183
|
+
## Process
|
|
184
|
+
[The conversational flow — phases, frameworks, quality gates]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Additional sections for Foundation blueprints:
|
|
188
|
+
|
|
189
|
+
```markdown
|
|
190
|
+
## Output
|
|
191
|
+
[What project structure is generated — show the directory tree]
|
|
192
|
+
|
|
193
|
+
## Architecture
|
|
194
|
+
[Key structural decisions: why this tool, why this config, why this convention]
|
|
195
|
+
|
|
196
|
+
## Expects from Discovery
|
|
197
|
+
[What info it reads from the discovery context, if anything]
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Quality checklist for BLUEPRINT.md:
|
|
201
|
+
|
|
202
|
+
Before considering the BLUEPRINT.md done, verify:
|
|
203
|
+
|
|
204
|
+
- [ ] Every architectural decision explains WHY, not just WHAT
|
|
205
|
+
- [ ] Configurable vs opinionated choices are clearly separated
|
|
206
|
+
- [ ] Blueprint Dependencies section is present (even if "None")
|
|
207
|
+
- [ ] Single-Repo Adaptation section documents path mapping and script differences
|
|
208
|
+
- [ ] File manifest covers every file in files/ with both monorepo and single-repo target locations
|
|
209
|
+
- [ ] Integration steps are ordered and phased, with conditional monorepo/single-repo phases
|
|
210
|
+
- [ ] Dependencies list specific versions
|
|
211
|
+
- [ ] Environment variables are documented with descriptions
|
|
212
|
+
- [ ] Monorepo wiring is documented (this is always the hardest part)
|
|
213
|
+
- [ ] Maintenance hooks define trigger-action pairs
|
|
214
|
+
- [ ] Code files use `{{SCOPE}}`, `{{APP_NAME}}`, and `// CONFIGURE:` markers
|
|
215
|
+
- [ ] References link to official docs
|
|
216
|
+
|
|
217
|
+
## Step 5: Create the Scaffold Command
|
|
218
|
+
|
|
219
|
+
Create the command in all three tool directories: `.claude/commands/scaffold-{name}.md`, `.opencode/commands/scaffold-{name}.md`, and `.cursor/commands/scaffold-{name}.md`. The OpenCode version should include YAML frontmatter with a `description` field. The Claude Code and Cursor versions use plain markdown (no frontmatter). The command body is the same across all three.
|
|
220
|
+
|
|
221
|
+
Follow the pattern from existing commands (read `.claude/commands/scaffold-auth.md` as the model). Every scaffold command must:
|
|
222
|
+
|
|
223
|
+
1. **Read the blueprint** — BLUEPRINT.md and all files
|
|
224
|
+
2. **Read project context** — `.project-context.md` for existing state
|
|
225
|
+
3. **Explore the target project** — understand current structure
|
|
226
|
+
4. **Ask clarifying questions** — based on the blueprint's configurable options
|
|
227
|
+
5. **Adapt and scaffold** — replace placeholders, adapt to project structure
|
|
228
|
+
6. **Update project context** — append to `.project-context.md`
|
|
229
|
+
7. **Inject maintenance rules** — detect and append to the target project's rules file(s): CLAUDE.md, AGENTS.md, or both (see the multi-tool injection pattern in existing scaffold commands)
|
|
230
|
+
8. **Summarize** — packages to install, env vars to set, manual steps remaining
|
|
231
|
+
|
|
232
|
+
The command should reference the BLUEPRINT.md as the source of truth for methodology and not duplicate its content.
|
|
233
|
+
|
|
234
|
+
## Step 6: Update the Repo
|
|
235
|
+
|
|
236
|
+
After the blueprint and command are created:
|
|
237
|
+
|
|
238
|
+
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.
|
|
239
|
+
|
|
240
|
+
2. **Update CHANGELOG.md** — Add an entry under [Unreleased] → Added describing the new blueprint.
|
|
241
|
+
|
|
242
|
+
3. **Update the directory structure** in README.md if it's shown there.
|
|
243
|
+
|
|
244
|
+
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.
|
|
245
|
+
|
|
246
|
+
5. **Ensure all three directories have the new scaffold command:** `.claude/commands/`, `.opencode/commands/`, and `.cursor/commands/`.
|
|
247
|
+
|
|
248
|
+
## Step 7: Verify
|
|
249
|
+
|
|
250
|
+
Before considering the blueprint done:
|
|
251
|
+
|
|
252
|
+
1. Read back the BLUEPRINT.md and verify it meets the quality checklist from Step 4
|
|
253
|
+
2. Read the scaffold command and verify it follows the pattern from Step 5
|
|
254
|
+
3. Verify all files in files/ use proper placeholders (no hardcoded scopes or app names)
|
|
255
|
+
4. Verify README.md and CHANGELOG.md are updated
|
|
256
|
+
5. Show the user a summary of everything that was created
|
|
257
|
+
|
|
258
|
+
## Tips for Good Blueprints
|
|
259
|
+
|
|
260
|
+
- **Extract from real projects** — Blueprints that come from battle-tested code are always better than theoretical ones.
|
|
261
|
+
- **Document the WHY** — The code is the easy part. The decisions and reasoning are what make AI-assisted scaffolding intelligent.
|
|
262
|
+
- **Keep it focused** — One blueprint, one problem. If you're tempted to add "and also X", that's probably a separate blueprint.
|
|
263
|
+
- **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.
|
|
264
|
+
- **Think about maintenance** — What breaks silently if you forget to run something? Those are your maintenance hooks.
|
|
265
|
+
- **Use existing blueprints as your quality bar** — Read auth-better-auth before writing yours. Match that level of detail.
|