@withmata/blueprints 0.2.0 → 0.3.1

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,269 +0,0 @@
1
- ---
2
- description: Add a new blueprint to this repo
3
- ---
4
-
5
- # Add a New Blueprint
6
-
7
- 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.
8
-
9
- ## Step 1: Understand the Conventions
10
-
11
- Read these files to understand the system you're adding to:
12
-
13
- ```
14
- ENGINEERING.md # Engineering preferences
15
- README.md # System overview and blueprint anatomy
16
- CHANGELOG.md # To update when done
17
- ```
18
-
19
- Also scan existing complete blueprints to understand the quality bar:
20
-
21
- ```
22
- blueprints/features/auth-better-auth/BLUEPRINT.md # Best example of a feature blueprint
23
- blueprints/foundation/monorepo-turbo/BLUEPRINT.md # Best example of a foundation blueprint
24
- blueprints/discovery/product-discovery/BLUEPRINT.md # Best example of a discovery blueprint
25
- ```
26
-
27
- ## Step 2: Gather Information
28
-
29
- Ask the user:
30
-
31
- 1. **"What pattern are you extracting?"** — What does it do? (e.g., "shared database layer with Drizzle", "Stripe billing integration", "email service with Resend")
32
-
33
- 2. **"Which tier?"** — Discovery (produces docs), Foundation (project skeleton), or Feature (plugs into existing project)? Most new blueprints are Features.
34
-
35
- 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.
36
-
37
- 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`).
38
-
39
- ## Step 3: Extract or Build
40
-
41
- ### If extracting from an existing project:
42
-
43
- Read the relevant code in the source project. Understand:
44
- - What files are involved
45
- - How they connect to each other
46
- - What's project-specific vs what's the reusable pattern
47
- - What dependencies are needed
48
- - What environment variables are required
49
- - How it integrates with the monorepo (workspace deps, turbo tasks, root scripts)
50
-
51
- Then create the blueprint:
52
-
53
- 1. Create the directory: `blueprints/{tier}/{name}/`
54
- 2. Create `files/` with the extracted code — generalize project-specific values:
55
- - Replace npm scopes with `{{SCOPE}}`
56
- - Replace app names with `{{APP_NAME}}`
57
- - Replace project-specific emails, URLs, etc. with `{{PLACEHOLDER}}` and `// CONFIGURE:` comments
58
- - Remove any business logic that's not part of the pattern
59
- 3. Create `BLUEPRINT.md` following the structure below
60
-
61
- ### If building from scratch:
62
-
63
- 1. Create the directory: `blueprints/{tier}/{name}/`
64
- 2. Build the code files in `files/`, following the conventions in ENGINEERING.md
65
- 3. Create `BLUEPRINT.md` following the structure below
66
-
67
- ## Step 4: Write the BLUEPRINT.md
68
-
69
- This is the most important file. It's what makes AI-assisted scaffolding intelligent rather than mechanical. Follow this structure:
70
-
71
- ### Required sections (all tiers):
72
-
73
- ```markdown
74
- # [Name] Blueprint — [Short Description]
75
-
76
- ## Tier
77
- [Discovery | Foundation | Feature]
78
-
79
- ## Status
80
- [Complete | In Progress | Planned]
81
-
82
- ## Problem
83
- [What problem does this blueprint solve? Be specific about the pain point.]
84
- ```
85
-
86
- ### Additional sections for Feature blueprints:
87
-
88
- ```markdown
89
- ## Blueprint Dependencies
90
-
91
- [Does this blueprint require or recommend other blueprints be installed first?
92
- List them in a table with columns: Blueprint, Type (required/recommended), Why.
93
- If required, include a subsection explaining fallback behavior if the dependency is absent.
94
- If no dependencies, write "None."]
95
-
96
- ## Single-Repo Adaptation
97
-
98
- [How does file placement, imports, and scripts differ for standalone (non-monorepo) apps?
99
- Include a path mapping table (monorepo vs single-repo) and a single-repo scripts example.
100
- Document what core patterns stay the same regardless of project type.]
101
-
102
- ## Architecture
103
-
104
- ### Core Pattern
105
- [How does this work at a high level?]
106
-
107
- ### Key Decisions
108
- [For each major decision, document WHAT you chose and WHY. This is what lets the AI coding tool adapt intelligently.]
109
-
110
- - **[Decision 1]** (recommended/required) — [Explanation of what and why. Include alternatives if relevant.]
111
- - **[Decision 2]** (optional) — [Explanation]
112
-
113
- ## Hard Requirements vs Recommended Defaults
114
-
115
- **Hard requirements:**
116
- - [Things that can't change]
117
-
118
- **Recommended defaults — ask during scaffolding:**
119
-
120
- | Choice | Recommended | Alternatives |
121
- |---|---|---|
122
- | [Choice 1] | [Default] | [Options] |
123
-
124
- ## Dependencies
125
-
126
- ### npm packages
127
-
128
- **Server:**
129
- | Package | Version | Purpose |
130
- |---|---|---|
131
- | [pkg] | [version] | [why] |
132
-
133
- **Client:**
134
- | Package | Version | Purpose |
135
- |---|---|---|
136
-
137
- ### Environment Variables
138
-
139
- | Variable | Where | Description |
140
- |---|---|---|
141
- | [VAR] | [Server/Client] | [What it's for] |
142
-
143
- ## Monorepo Wiring
144
-
145
- [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.]
146
-
147
- ## File Manifest
148
-
149
- | File | Purpose | Target Location |
150
- |---|---|---|
151
- | [file path in files/] | [what it does] | [where it goes in target project] |
152
-
153
- ## Integration Steps
154
-
155
- [Ordered phases for scaffolding. Group related steps.]
156
-
157
- ### Phase 1: [Name]
158
- 1. [Step]
159
- 2. [Step]
160
-
161
- ### Phase 2: [Name]
162
- ...
163
-
164
- ## Maintenance Hooks
165
-
166
- [What needs to happen after changes to keep this working?]
167
-
168
- ### Condensed Rules for project rules file
169
-
170
- ```markdown
171
- ### [name] maintenance
172
- - [rule 1]
173
- - [rule 2]
174
- ```
175
-
176
- ## References
177
-
178
- - [Links to docs, repos, etc.]
179
- ```
180
-
181
- ### Additional sections for Discovery blueprints:
182
-
183
- ```markdown
184
- ## Output
185
- [What documents are generated and where]
186
-
187
- ## Process
188
- [The conversational flow — phases, frameworks, quality gates]
189
- ```
190
-
191
- ### Additional sections for Foundation blueprints:
192
-
193
- ```markdown
194
- ## Output
195
- [What project structure is generated — show the directory tree]
196
-
197
- ## Architecture
198
- [Key structural decisions: why this tool, why this config, why this convention]
199
-
200
- ## Expects from Discovery
201
- [What info it reads from the discovery context, if anything]
202
- ```
203
-
204
- ### Quality checklist for BLUEPRINT.md:
205
-
206
- Before considering the BLUEPRINT.md done, verify:
207
-
208
- - [ ] Every architectural decision explains WHY, not just WHAT
209
- - [ ] Configurable vs opinionated choices are clearly separated
210
- - [ ] Blueprint Dependencies section is present (even if "None")
211
- - [ ] Single-Repo Adaptation section documents path mapping and script differences
212
- - [ ] File manifest covers every file in files/ with both monorepo and single-repo target locations
213
- - [ ] Integration steps are ordered and phased, with conditional monorepo/single-repo phases
214
- - [ ] Dependencies list specific versions
215
- - [ ] Environment variables are documented with descriptions
216
- - [ ] Monorepo wiring is documented (this is always the hardest part)
217
- - [ ] Maintenance hooks define trigger-action pairs
218
- - [ ] Code files use `{{SCOPE}}`, `{{APP_NAME}}`, and `// CONFIGURE:` markers
219
- - [ ] References link to official docs
220
-
221
- ## Step 5: Create the Scaffold Command
222
-
223
- 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.
224
-
225
- Follow the pattern from existing commands (read `.claude/commands/scaffold-auth.md` as the model). Every scaffold command must:
226
-
227
- 1. **Read the blueprint** — BLUEPRINT.md and all files
228
- 2. **Read project context** — `.project-context.md` for existing state
229
- 3. **Explore the target project** — understand current structure
230
- 4. **Ask clarifying questions** — based on the blueprint's configurable options
231
- 5. **Adapt and scaffold** — replace placeholders, adapt to project structure
232
- 6. **Update project context** — append to `.project-context.md`
233
- 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)
234
- 8. **Summarize** — packages to install, env vars to set, manual steps remaining
235
-
236
- The command should reference the BLUEPRINT.md as the source of truth for methodology and not duplicate its content.
237
-
238
- ## Step 6: Update the Repo
239
-
240
- After the blueprint and command are created:
241
-
242
- 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.
243
-
244
- 2. **Update CHANGELOG.md** — Add an entry under [Unreleased] → Added describing the new blueprint.
245
-
246
- 3. **Update the directory structure** in README.md if it's shown there.
247
-
248
- 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.
249
-
250
- 5. **Ensure all three directories have the new scaffold command:** `.claude/commands/`, `.opencode/commands/`, and `.cursor/commands/`.
251
-
252
- ## Step 7: Verify
253
-
254
- Before considering the blueprint done:
255
-
256
- 1. Read back the BLUEPRINT.md and verify it meets the quality checklist from Step 4
257
- 2. Read the scaffold command and verify it follows the pattern from Step 5
258
- 3. Verify all files in files/ use proper placeholders (no hardcoded scopes or app names)
259
- 4. Verify README.md and CHANGELOG.md are updated
260
- 5. Show the user a summary of everything that was created
261
-
262
- ## Tips for Good Blueprints
263
-
264
- - **Extract from real projects** — Blueprints that come from battle-tested code are always better than theoretical ones.
265
- - **Document the WHY** — The code is the easy part. The decisions and reasoning are what make AI-assisted scaffolding intelligent.
266
- - **Keep it focused** — One blueprint, one problem. If you're tempted to add "and also X", that's probably a separate blueprint.
267
- - **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.
268
- - **Think about maintenance** — What breaks silently if you forget to run something? Those are your maintenance hooks.
269
- - **Use existing blueprints as your quality bar** — Read auth-better-auth before writing yours. Match that level of detail.
@@ -1,234 +0,0 @@
1
- ---
2
- description: Full project lifecycle — Discovery → Foundation → Features
3
- ---
4
-
5
- # New Project
6
-
7
- Take a product from idea to running code. This command walks through the full lifecycle — defining the product, setting up the codebase to support it, and wiring in the capabilities it needs. You're a product partner with deep engineering expertise: the product strategy drives every technical decision.
8
-
9
- ## Step 1: Read the Blueprints
10
-
11
- Load all available blueprints so you understand what's possible:
12
-
13
- ```
14
- ~/Documents/WithMata/my-blueprints/blueprints/discovery/product-discovery/BLUEPRINT.md
15
- ~/Documents/WithMata/my-blueprints/blueprints/discovery/product-discovery/templates/*
16
- ~/Documents/WithMata/my-blueprints/blueprints/foundation/monorepo-turbo/BLUEPRINT.md
17
- ~/Documents/WithMata/my-blueprints/blueprints/foundation/monorepo-turbo/files/**/*
18
- ```
19
-
20
- Also scan for available feature blueprints:
21
-
22
- ```
23
- ~/Documents/WithMata/my-blueprints/blueprints/features/*/BLUEPRINT.md
24
- ```
25
-
26
- Only consider a feature blueprint "available" if its BLUEPRINT.md has `Status: Complete` (not a placeholder). If not found at the paths above, ask the user for the path to their blueprints repo.
27
-
28
- ## Step 2: Assess Current State
29
-
30
- Before doing anything, understand where this project stands.
31
-
32
- **Check `.project-context.md`** in the target project root. This file tracks what has already been done:
33
-
34
- - **Has a `## Product Discovery` section?** Discovery is complete.
35
- - **Has a `## Foundation` section?** Foundation is scaffolded.
36
- - **Has entries under `## Installed Blueprints`?** Some features are already installed.
37
-
38
- **Explore the target directory:**
39
-
40
- - Empty directory? Fresh start — begin from Stage 1.
41
- - Has `docs/product/`? Discovery was done (even without a context file).
42
- - Has `package.json`, `turbo.json`, workspace dirs? Foundation was done.
43
- - Has auth files, DB packages, etc.? Features were installed.
44
-
45
- ## Step 3: Determine Starting Point
46
-
47
- Based on what you found, tell the user where things stand. Lead with the product, not the tech:
48
-
49
- - **Nothing exists**: "This is a blank slate. Let's start by figuring out what you're building and who it's for — then we'll set up the codebase to support it."
50
-
51
- - **Discovery done, nothing else**: "You've already defined [product name] — [problem statement in one line]. We've got a clear picture of the product. Let's turn that into something you can ship."
52
-
53
- - **Discovery + Foundation done**: "The product is defined and the codebase is ready. Based on what [primary archetype] needs, let's wire in the right capabilities."
54
-
55
- - **Everything done**: "This project looks fully set up. Want to add more capabilities, or revisit any of the product decisions?"
56
-
57
- If the user wants to start at a specific stage, let them. If they want to redo a completed stage, confirm before proceeding (it may be destructive).
58
-
59
- ---
60
-
61
- ## Stage 1: Discovery
62
-
63
- > "Before we write any code, let's get clear on what we're building and why it matters."
64
-
65
- This is the most important stage. Everything downstream — the architecture, the features, the trade-offs — flows from what we define here. Don't rush it.
66
-
67
- Follow the full discovery process from the product-discovery blueprint. This is a rigorous product conversation — challenge assumptions, research the market, and push until the product thesis is sharp. You'll work through:
68
-
69
- 1. **Initial Framing** — What are you building? Who is it for? Why does it need to exist?
70
- 2. **Problem Deep Dive** — 5 Whys to get past symptoms to root cause
71
- 3. **User Definition** — Vivid archetypes and personas via scenario mapping + JTBD
72
- 4. **Solution Positioning** — Competitive landscape, differentiation, "why now?"
73
- 5. **Synthesis** — Distill everything into a defensible product thesis
74
-
75
- Use the templates from the blueprint to generate:
76
-
77
- ```
78
- docs/product/
79
- ├── product-thesis.md # The 2-minute read — pillars, metrics, positioning
80
- ├── product-brief.md # Supporting research and detail
81
- └── users/
82
- ├── archetype-[name].md # Vivid portraits of who you're building for
83
- └── research-summary.md # Evidence and sources
84
- ```
85
-
86
- Create or update `.project-context.md` with the `## Product Discovery` section.
87
-
88
- ### Pause Point
89
-
90
- After discovery is complete, connect what was defined to what comes next:
91
-
92
- "We've defined [product name] around [N] core pillars: [list them]. The primary user is [archetype] — [one-line description of their world]. This gives us a clear foundation to build on. Want to set up the codebase now, or let this sit and come back to it?"
93
-
94
- If stopping: "Whenever you're ready, run `/scaffold-foundation` to set up the project, or `/new-project` again to pick up where we left off."
95
-
96
- ---
97
-
98
- ## Stage 1.5: Project Type
99
-
100
- After discovery is complete, determine the project type:
101
-
102
- "Now let's set up the codebase. Are you building a:
103
- 1. **Monorepo** — multiple packages, shared config, Turborepo (recommended for larger products with separate frontend/backend/packages)
104
- 2. **Single-repo** — one application, everything in one package.json (simpler for smaller products or standalone apps)"
105
-
106
- Record the choice in `.project-context.md` under `## Foundation`:
107
- ```yaml
108
- project_type: monorepo # or single-repo
109
- ```
110
-
111
- - If **monorepo**: proceed to Stage 2 (Foundation)
112
- - If **single-repo**: skip Stage 2 entirely, proceed to Stage 3 (Features). Note in context: "Foundation skipped — single-repo project."
113
-
114
- ---
115
-
116
- ## Stage 2: Foundation
117
-
118
- > "The product is defined. Let's build the structure to support it."
119
-
120
- > **Note:** Skip this stage for single-repo projects — proceed directly to Stage 3.
121
-
122
- Read the discovery context from `.project-context.md` to inform technical decisions:
123
-
124
- - Derive the npm scope from the product name (e.g., "Acme Dashboard" -> `@acme`)
125
- - Use the product pillars and archetype needs to inform any trade-offs
126
- - Apply technical constraints from discovery if any were noted
127
-
128
- Follow the foundation blueprint process. Only three questions — skip any already answered by project context:
129
-
130
- 1. **npm scope** — defaults from product name
131
- 2. **Project name** — human-readable, for metadata and page titles
132
- 3. **Node.js version** — defaults to `>=22`
133
-
134
- Scaffold the monorepo skeleton: root configs, TypeScript config package, Tailwind config package, Next.js app shell, and empty workspace directories for future blueprints.
135
-
136
- After scaffolding:
137
-
138
- 1. Run `pnpm install` to verify the workspace is valid
139
- 2. Briefly verify the dev server boots: `pnpm dev`
140
- 3. Append the `## Foundation` section to `.project-context.md`
141
-
142
- ### Pause Point
143
-
144
- After foundation is complete, bridge to features by referencing the product:
145
-
146
- "The codebase is ready — [scope] monorepo with Turborepo, Biome, and a Next.js app shell. Now let's think about what [product name] needs to actually work. Want to look at what's available, or stop here for now?"
147
-
148
- If stopping: "You can add capabilities anytime. Run `/scaffold-auth` for authentication, or `/new-project` to see all available blueprints."
149
-
150
- ---
151
-
152
- ## Stage 3: Features
153
-
154
- > "Let's wire in what [product name] needs to deliver on its core pillars."
155
-
156
- If discovery was completed, reference the product pillars and archetype needs when presenting features. Connect each blueprint back to the product — don't just list technical capabilities.
157
-
158
- List the available feature blueprints. Read each `BLUEPRINT.md` under `blueprints/features/*/` and show only those with `Status: Complete`.
159
-
160
- **Present features in dependency order** — blueprints that others depend on should be listed first. Check each blueprint's `## Blueprint Dependencies` section. For example, db should be listed before auth (since auth requires db).
161
-
162
- For each available blueprint, show:
163
- - **Name** — human-readable
164
- - **What it enables for the product** — tie it to a pillar or user need when possible
165
- - **Dependencies** — note if it requires another blueprint (e.g., "requires Database")
166
- - **Command** — the slash command to run it individually
167
-
168
- Example:
169
-
170
- ```
171
- Based on what [product name] needs:
172
-
173
- 1. Authentication (Better Auth + Drizzle) — /scaffold-auth
174
- User accounts, login flows, route protection. Required for [relevant pillar].
175
- If org plugin: team/workspace management for [archetype need].
176
- ```
177
-
178
- Ask: "Which of these does [product name] need? We'll set them up one at a time."
179
-
180
- If no discovery context exists, fall back to a straightforward capability list without the product framing.
181
-
182
- ### For Each Selected Feature
183
-
184
- 1. Read the feature's BLUEPRINT.md and all its files
185
- 2. Read `.project-context.md` to understand current state
186
- 3. Follow the blueprint's scaffolding process (ask its configuration questions, adapt files, etc.)
187
- 4. Append the feature's entry to `## Installed Blueprints` in .project-context.md
188
-
189
- After each feature is installed, ask: "[Feature] is wired in. Want to add another, or is [product name] ready to start building on?"
190
-
191
- ---
192
-
193
- ## Step 7: Final Summary
194
-
195
- Once the user is done (whether after one stage or all three), provide a summary that connects the product to the technical foundation:
196
-
197
- ### What We Built
198
-
199
- - **The product** (if discovery ran) — what it is, who it's for, the core pillars it delivers on
200
- - **The codebase** (if foundation ran) — how the project structure supports the product
201
- - **The capabilities** (if features ran) — what's wired in and how it maps to product needs
202
-
203
- ### Getting Started
204
-
205
- ```
206
- pnpm dev # Start the development server
207
- ```
208
-
209
- ### Environment Variables to Set
210
-
211
- List any env vars that need values (aggregated from all stages).
212
-
213
- ### Manual Steps Remaining
214
-
215
- List anything that can't be automated (aggregated from all stages).
216
-
217
- ### What's Next
218
-
219
- Suggest next steps in terms of product progress, not just technical tasks. Reference specific commands:
220
-
221
- - "The product thesis identified [pillar] as a core pillar — `/scaffold-auth` wires in the user accounts and access control to support that."
222
- - "Other feature blueprints coming soon: UI components, database, Tailwind theming."
223
- - "Start building the core product experience — the [archetype]'s primary workflow."
224
-
225
- ---
226
-
227
- ## Important Notes
228
-
229
- - **Resumable** — this command always checks `.project-context.md` before starting. Run it again anytime to pick up where you left off, or use the individual stage commands (`/discover`, `/scaffold-foundation`, `/scaffold-auth`).
230
- - **Non-destructive** — never overwrite existing files without asking. If a stage was already completed, confirm before redoing it.
231
- - **Product-first** — every technical decision should trace back to the product definition. When in doubt, reference the pillars, the archetype, and the problem statement.
232
- - **Conversational** — this is a guided conversation, not a script. Adapt to the user's pace. If they want to skip ahead, let them. If they want to dig deeper into a stage, follow their lead.
233
- - **Project context is the source of truth** — every stage reads it, every stage appends to it. This is how stages communicate with each other across sessions.
234
- - **Maintenance rules accumulate** — each stage injects its maintenance rules into the project's rules file(s). These rules tell the AI coding tool what actions to take after certain types of changes. They accumulate as more blueprints are installed — the monorepo rules from foundation, plus auth rules, plus database rules, etc. The tool reads these at the start of every session.