@withmata/blueprints 0.3.1 → 0.3.3
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/skills/blueprint-catalog/SKILL.md +13 -2
- package/.claude/skills/scaffold-auth/SKILL.md +2 -2
- package/.claude/skills/scaffold-env/SKILL.md +222 -0
- package/.claude/skills/scaffold-foundation/SKILL.md +166 -16
- package/.claude/skills/scaffold-tailwind/SKILL.md +177 -0
- package/.claude/skills/scaffold-ui/SKILL.md +206 -0
- package/blueprints/features/env-t3/BLUEPRINT.md +332 -0
- package/blueprints/features/env-t3/files/nextjs/.env.example +17 -0
- package/blueprints/features/env-t3/files/nextjs/.env.local +0 -0
- package/blueprints/features/env-t3/files/nextjs/env/client.ts +13 -0
- package/blueprints/features/env-t3/files/nextjs/env/server.ts +12 -0
- package/blueprints/features/env-t3/files/server/.env.example +14 -0
- package/blueprints/features/env-t3/files/server/.env.local +0 -0
- package/blueprints/features/env-t3/files/server/env.ts +17 -0
- package/blueprints/features/tailwind-v4/BLUEPRINT.md +262 -12
- package/blueprints/features/tailwind-v4/files/tailwind-config/package.json +20 -0
- package/blueprints/features/tailwind-v4/files/tailwind-config/shared-styles.css +131 -0
- package/blueprints/features/ui-shared-components/BLUEPRINT.md +350 -13
- package/blueprints/features/ui-shared-components/files/ui/components.json +21 -0
- package/blueprints/features/ui-shared-components/files/ui/package.json +42 -0
- package/blueprints/features/ui-shared-components/files/ui/styles/globals.css +2 -0
- package/blueprints/features/ui-shared-components/files/ui/tsconfig.json +9 -0
- package/blueprints/features/ui-shared-components/files/ui/utils/cn.ts +6 -0
- package/blueprints/features/ui-shared-components/files/ui/utils/cva.ts +4 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scaffold-tailwind
|
|
3
|
+
description: Scaffold Tailwind v4 full design system into the current project
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scaffold Tailwind v4 Blueprint
|
|
7
|
+
|
|
8
|
+
Scaffold the `tailwind-v4` blueprint into the current project. This upgrades the foundation's minimal tailwind-config into a production-ready design system with animations, typography, sidebar tokens, and full shadcn/ui integration.
|
|
9
|
+
|
|
10
|
+
## Step 1: Read the Blueprint
|
|
11
|
+
|
|
12
|
+
Read the full BLUEPRINT.md and all template files from the tailwind blueprint:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
~/.withmata/blueprints/blueprints/features/tailwind-v4/BLUEPRINT.md
|
|
16
|
+
~/.withmata/blueprints/blueprints/features/tailwind-v4/files/**/*
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If not found at these paths, run `npx @withmata/blueprints` to install.
|
|
20
|
+
|
|
21
|
+
## Step 1.5: Read Project Context
|
|
22
|
+
|
|
23
|
+
Check if `.project-context.md` exists in the target project root:
|
|
24
|
+
|
|
25
|
+
- **If it exists**: read it to understand:
|
|
26
|
+
- npm scope (from Foundation)
|
|
27
|
+
- Whether `monorepo-turbo` foundation is installed
|
|
28
|
+
- What other blueprints are already installed
|
|
29
|
+
- Use this to determine if `config/tailwind-config/` exists
|
|
30
|
+
|
|
31
|
+
- **If it does not exist**: proceed normally — explore the project manually
|
|
32
|
+
|
|
33
|
+
## Step 2: Understand the Target Project
|
|
34
|
+
|
|
35
|
+
### 2a. Detect Project Type
|
|
36
|
+
|
|
37
|
+
Check `.project-context.md` for `project_type`. If not present, detect:
|
|
38
|
+
|
|
39
|
+
- **Monorepo indicators**: `pnpm-workspace.yaml`, `turbo.json`, or `"workspaces"` in root `package.json`
|
|
40
|
+
- **Single-repo indicators**: Single `package.json` at root, `src/` directory
|
|
41
|
+
|
|
42
|
+
### 2b. Check Existing Tailwind Setup
|
|
43
|
+
|
|
44
|
+
- Does `config/tailwind-config/` exist? (Foundation blueprint creates this)
|
|
45
|
+
- Read existing `shared-styles.css` — is it the minimal version or already upgraded?
|
|
46
|
+
- Read existing `package.json` — what deps are already present?
|
|
47
|
+
- Check `tailwind-v4` in `.project-context.md` Installed Blueprints — already installed?
|
|
48
|
+
|
|
49
|
+
## Step 3: Ask Clarifying Questions
|
|
50
|
+
|
|
51
|
+
1. **Sidebar tokens** — "Include sidebar-specific color tokens for dashboard layouts? (Default: yes)"
|
|
52
|
+
2. **Chart tokens** — "Include chart color tokens for data visualization? (Default: yes)"
|
|
53
|
+
|
|
54
|
+
Skip questions if the user has indicated preferences or if the project type makes the answer obvious.
|
|
55
|
+
|
|
56
|
+
## Step 4: Adapt and Scaffold
|
|
57
|
+
|
|
58
|
+
### 4a. Monorepo — Upgrade Existing Config
|
|
59
|
+
|
|
60
|
+
**If `config/tailwind-config/` exists (foundation was run):**
|
|
61
|
+
|
|
62
|
+
1. **Replace `shared-styles.css`** — Copy the full version from this blueprint, replacing the foundation's minimal version entirely. The full version includes everything the minimal version had, plus:
|
|
63
|
+
- `@import "tw-animate-css"`
|
|
64
|
+
- `@import "shadcn/tailwind.css"`
|
|
65
|
+
- `@import "tailwind-scrollbar-hide/v4"`
|
|
66
|
+
- Sidebar tokens (`--color-sidebar-*`)
|
|
67
|
+
- Chart tokens (`--color-chart-*`)
|
|
68
|
+
- Extended radius tokens (`--radius-3xl`, `--radius-4xl`)
|
|
69
|
+
- Font mono token (`--font-mono`)
|
|
70
|
+
|
|
71
|
+
2. **Merge `package.json` dependencies** — Add these to the existing `dependencies`:
|
|
72
|
+
- `@tailwindcss/typography`
|
|
73
|
+
- `shadcn`
|
|
74
|
+
- `tailwind-scrollbar-hide`
|
|
75
|
+
- `tw-animate-css`
|
|
76
|
+
Keep existing `devDependencies` unchanged.
|
|
77
|
+
|
|
78
|
+
3. **Leave `postcss.config.mjs` unchanged** — it's already correct from foundation.
|
|
79
|
+
|
|
80
|
+
**If `config/tailwind-config/` does NOT exist:**
|
|
81
|
+
|
|
82
|
+
1. Create the `config/tailwind-config/` directory
|
|
83
|
+
2. Copy `shared-styles.css` from template
|
|
84
|
+
3. Copy `package.json` from template — replace `{{SCOPE}}`
|
|
85
|
+
4. Create `postcss.config.mjs`:
|
|
86
|
+
```javascript
|
|
87
|
+
export const postcssConfig = {
|
|
88
|
+
plugins: {
|
|
89
|
+
"@tailwindcss/postcss": {},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 4b. Single-Repo
|
|
95
|
+
|
|
96
|
+
1. Create `src/styles/shared-styles.css` from template
|
|
97
|
+
2. Add all design system deps to root `package.json`
|
|
98
|
+
3. Update `globals.css` or equivalent to import the shared styles:
|
|
99
|
+
```css
|
|
100
|
+
@import "./src/styles/shared-styles.css";
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 4c. Install Dependencies
|
|
104
|
+
|
|
105
|
+
Run `pnpm install` (or the project's package manager) to fetch new dependencies.
|
|
106
|
+
|
|
107
|
+
## Step 5: Update Project Context
|
|
108
|
+
|
|
109
|
+
Append an entry to `.project-context.md` under `## Installed Blueprints`:
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
### tailwind-v4
|
|
113
|
+
blueprint: tailwind-v4
|
|
114
|
+
choices:
|
|
115
|
+
include_sidebar_tokens: <true|false>
|
|
116
|
+
include_chart_tokens: <true|false>
|
|
117
|
+
include_scrollbar_hide: <true|false>
|
|
118
|
+
files_modified:
|
|
119
|
+
- config/tailwind-config/shared-styles.css
|
|
120
|
+
- config/tailwind-config/package.json
|
|
121
|
+
packages_added:
|
|
122
|
+
- "@tailwindcss/typography"
|
|
123
|
+
- shadcn
|
|
124
|
+
- tailwind-scrollbar-hide
|
|
125
|
+
- tw-animate-css
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Create Maintenance Skill
|
|
129
|
+
|
|
130
|
+
Create a project-level maintenance skill:
|
|
131
|
+
|
|
132
|
+
**File:** `<project>/.claude/skills/tailwind-maintenance/SKILL.md`
|
|
133
|
+
|
|
134
|
+
```yaml
|
|
135
|
+
---
|
|
136
|
+
name: tailwind-maintenance
|
|
137
|
+
description: Maintenance rules for Tailwind v4 design system. Invoke when modifying theme tokens, colors, or adding new apps.
|
|
138
|
+
user-invocable: false
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
### tailwind-v4 maintenance
|
|
142
|
+
- After adding a new color: add CSS variable to both :root and .dark selectors in shared-styles.css, then map in @theme inline
|
|
143
|
+
- After adding a new app: import the tailwind-config package in the app's globals.css
|
|
144
|
+
- After upgrading Tailwind: check for @import, @theme, or @custom-variant breaking changes
|
|
145
|
+
- Never use tailwind.config.js — all configuration is CSS-based in shared-styles.css
|
|
146
|
+
- Colors use OKLCH color space — do not use hex or RGB
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Step 6: Output Summary
|
|
150
|
+
|
|
151
|
+
### Packages Added
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
@tailwindcss/typography, shadcn, tailwind-scrollbar-hide, tw-animate-css
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Files Modified
|
|
158
|
+
|
|
159
|
+
List every file created or modified with a one-line description.
|
|
160
|
+
|
|
161
|
+
### What Changed from Foundation
|
|
162
|
+
|
|
163
|
+
- `shared-styles.css` upgraded with animation imports, sidebar tokens, chart tokens, scrollbar utility
|
|
164
|
+
- `package.json` now includes design system dependencies
|
|
165
|
+
- Typography plugin available (add `@plugin "@tailwindcss/typography"` in app globals.css)
|
|
166
|
+
|
|
167
|
+
### Next Steps
|
|
168
|
+
|
|
169
|
+
- Add `@plugin "@tailwindcss/typography"` to your app's `globals.css` if you need prose styling
|
|
170
|
+
- Customize the primary color hue in `:root` and `.dark` (currently indigo at hue 264)
|
|
171
|
+
- Run `/scaffold-ui` to set up a shared component library that uses this design system
|
|
172
|
+
|
|
173
|
+
## Important Notes
|
|
174
|
+
|
|
175
|
+
- The full `shared-styles.css` is a complete replacement — it includes everything the foundation's minimal version had plus the new additions.
|
|
176
|
+
- Never overwrite `postcss.config.mjs` — it's already correct from the foundation.
|
|
177
|
+
- If the user has customized colors in the existing `shared-styles.css`, ask before replacing. Offer to merge their custom values into the new file.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scaffold-ui
|
|
3
|
+
description: Scaffold shared UI component library with shadcn/ui into the current project
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scaffold UI Blueprint
|
|
7
|
+
|
|
8
|
+
Scaffold the `ui-shared-components` blueprint into the current project. Read the full blueprint first, then adapt it to this project's stack.
|
|
9
|
+
|
|
10
|
+
## Step 1: Read the Blueprint
|
|
11
|
+
|
|
12
|
+
Read the full BLUEPRINT.md and all template files from the UI blueprint:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
~/.withmata/blueprints/blueprints/features/ui-shared-components/BLUEPRINT.md
|
|
16
|
+
~/.withmata/blueprints/blueprints/features/ui-shared-components/files/**/*
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If not found at these paths, run `npx @withmata/blueprints` to install.
|
|
20
|
+
|
|
21
|
+
## Step 1.5: Read Project Context
|
|
22
|
+
|
|
23
|
+
Check if `.project-context.md` exists in the target project root:
|
|
24
|
+
|
|
25
|
+
- **If it exists**: read it to understand:
|
|
26
|
+
- npm scope (from Foundation)
|
|
27
|
+
- Whether `tailwind-v4` is installed (required dependency)
|
|
28
|
+
- What other blueprints are installed
|
|
29
|
+
- Use this to pre-fill scope and adapt paths
|
|
30
|
+
|
|
31
|
+
- **If it does not exist**: proceed normally — explore the project manually
|
|
32
|
+
|
|
33
|
+
When project context provides clear answers, skip the corresponding questions in Step 3.
|
|
34
|
+
|
|
35
|
+
## Step 2: Understand the Target Project
|
|
36
|
+
|
|
37
|
+
### 2a. Detect Project Type
|
|
38
|
+
|
|
39
|
+
Check `.project-context.md` for `project_type`. If not present, detect:
|
|
40
|
+
|
|
41
|
+
- **Monorepo indicators**: `pnpm-workspace.yaml`, `turbo.json`, or `"workspaces"` in root `package.json`
|
|
42
|
+
- **Single-repo indicators**: Single `package.json` at root, `src/` directory
|
|
43
|
+
|
|
44
|
+
### 2b. Check Blueprint Dependencies
|
|
45
|
+
|
|
46
|
+
**Required: `tailwind-v4`**
|
|
47
|
+
|
|
48
|
+
Check if `tailwind-v4` is in `.project-context.md` Installed Blueprints, OR check if `config/tailwind-config/shared-styles.css` contains `@import "tw-animate-css"` (indicator of the full tailwind-v4 blueprint).
|
|
49
|
+
|
|
50
|
+
If NOT installed: ask "UI components need the Tailwind design system. Run `/scaffold-tailwind` first? (Y/n)"
|
|
51
|
+
- If yes: tell the user to run `/scaffold-tailwind` first, then come back
|
|
52
|
+
- If no: proceed with basic Tailwind defaults and warn about missing design tokens
|
|
53
|
+
|
|
54
|
+
### 2c. Explore Structure
|
|
55
|
+
|
|
56
|
+
**If monorepo:**
|
|
57
|
+
1. Does `packages/ui/` already exist? If so, what's in it?
|
|
58
|
+
2. What npm scope is used?
|
|
59
|
+
3. What is the shared TypeScript config package name?
|
|
60
|
+
4. Where are the consuming apps? (`apps/web/`, `apps/*/`, etc.)
|
|
61
|
+
5. What's in the consuming app's `globals.css`?
|
|
62
|
+
|
|
63
|
+
**If single-repo:**
|
|
64
|
+
1. Does `src/ui/` or `src/components/` exist?
|
|
65
|
+
2. What framework is this? (Next.js?)
|
|
66
|
+
3. What import convention is used? (`@/`, `#`, relative?)
|
|
67
|
+
|
|
68
|
+
## Step 3: Ask Clarifying Questions
|
|
69
|
+
|
|
70
|
+
1. **shadcn style** — "Which shadcn style do you prefer? (Default: new-york)" Only ask if the user hasn't specified.
|
|
71
|
+
|
|
72
|
+
2. **Icon library** — "Which icon library? Lucide (default, shadcn default), Phosphor (richer set), or custom?"
|
|
73
|
+
|
|
74
|
+
3. **Existing `packages/ui/`** — If it exists: "I found an existing `packages/ui/`. I'll merge the new files without overwriting existing ones."
|
|
75
|
+
|
|
76
|
+
Skip questions where the answer is obvious.
|
|
77
|
+
|
|
78
|
+
## Step 4: Adapt and Scaffold
|
|
79
|
+
|
|
80
|
+
### 4a. Monorepo — Create UI Package
|
|
81
|
+
|
|
82
|
+
1. Create `packages/ui/` directory (if it doesn't exist)
|
|
83
|
+
2. Copy `package.json` — replace `{{SCOPE}}` with the project's npm scope
|
|
84
|
+
3. Copy `tsconfig.json` — replace `{{SCOPE}}`
|
|
85
|
+
4. Copy `components.json` — update style if user chose something other than `new-york`, update iconLibrary if user chose something other than `lucide`
|
|
86
|
+
5. Create `styles/` directory and copy `globals.css` — replace `{{SCOPE}}`
|
|
87
|
+
6. Create `utils/` directory, copy `cn.ts` and `cva.ts`
|
|
88
|
+
7. Create empty directories: `components/ui/`, `icons/`, `icons/logos/`
|
|
89
|
+
|
|
90
|
+
### 4b. Single-Repo — Create UI Directory
|
|
91
|
+
|
|
92
|
+
1. Create `src/ui/` directory structure
|
|
93
|
+
2. Copy utility files (`cn.ts`, `cva.ts`) to `src/ui/utils/`
|
|
94
|
+
3. Copy `styles/globals.css` to `src/ui/styles/` — adjust import to direct path
|
|
95
|
+
4. Copy `components.json` to project root — update aliases for single-repo paths
|
|
96
|
+
5. Create empty directories: `src/ui/components/ui/`, `src/ui/icons/`
|
|
97
|
+
6. Add UI deps to root `package.json`
|
|
98
|
+
|
|
99
|
+
### 4c. Update Consuming App
|
|
100
|
+
|
|
101
|
+
**For each Next.js app (monorepo):**
|
|
102
|
+
|
|
103
|
+
Update `app/globals.css`. The final file should look like:
|
|
104
|
+
|
|
105
|
+
```css
|
|
106
|
+
@import "tailwindcss";
|
|
107
|
+
@import "{{SCOPE}}/tailwind-config";
|
|
108
|
+
@import "{{SCOPE}}/ui/styles";
|
|
109
|
+
@plugin "@tailwindcss/typography";
|
|
110
|
+
|
|
111
|
+
@source "../../../packages/ui";
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Compute the `@source` relative path based on the consuming app's location relative to `packages/ui/`. For example:
|
|
115
|
+
- `apps/web/` → `@source "../../../packages/ui"` (if workspace root is 3 levels up... actually the typical path is `../../packages/ui` since apps/web/ is 2 levels)
|
|
116
|
+
- Verify the path resolves correctly
|
|
117
|
+
|
|
118
|
+
**Important:** Don't overwrite the entire `globals.css` — merge the new imports. If the file already has `@import "tailwindcss"` and `@import "{{SCOPE}}/tailwind-config"`, add the new lines after them.
|
|
119
|
+
|
|
120
|
+
### 4d. Dependency Installation
|
|
121
|
+
|
|
122
|
+
Run `pnpm install` to wire workspace dependencies.
|
|
123
|
+
|
|
124
|
+
## Step 5: Update Project Context
|
|
125
|
+
|
|
126
|
+
Append an entry to `.project-context.md` under `## Installed Blueprints`:
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
### ui-shared-components
|
|
130
|
+
blueprint: ui-shared-components
|
|
131
|
+
choices:
|
|
132
|
+
shadcn_style: <style>
|
|
133
|
+
icon_library: <library>
|
|
134
|
+
include_cva: true
|
|
135
|
+
files_created:
|
|
136
|
+
- <list of all files created>
|
|
137
|
+
globals_css_updated:
|
|
138
|
+
- <list of globals.css files modified>
|
|
139
|
+
packages_added:
|
|
140
|
+
- <list of packages>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Create Maintenance Skill
|
|
144
|
+
|
|
145
|
+
Create a project-level maintenance skill:
|
|
146
|
+
|
|
147
|
+
**File:** `<project>/.claude/skills/ui-maintenance/SKILL.md`
|
|
148
|
+
|
|
149
|
+
```yaml
|
|
150
|
+
---
|
|
151
|
+
name: ui-maintenance
|
|
152
|
+
description: Maintenance rules for shared UI component library. Invoke when adding components, icons, or modifying the UI package.
|
|
153
|
+
user-invocable: false
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### ui-shared-components maintenance
|
|
157
|
+
- Add shadcn components via `pnpm dlx shadcn@latest add <name>` from packages/ui/
|
|
158
|
+
- Use cn() for all className composition — never concatenate class strings manually
|
|
159
|
+
- Internal imports use #prefix (#components/ui/button); cross-package imports use @scope/ui/components/ui/button
|
|
160
|
+
- After adding a new export directory: add to both exports and imports in packages/ui/package.json
|
|
161
|
+
- After adding a new consuming app: add @import and @source directive to the app's globals.css
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Step 6: Output Summary
|
|
165
|
+
|
|
166
|
+
### Packages to Install
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Should be handled by pnpm install, but verify these are in packages/ui/package.json:
|
|
170
|
+
# Dependencies: @radix-ui/react-slot, class-variance-authority, clsx, tailwind-merge, tw-animate-css, shadcn
|
|
171
|
+
# DevDeps: @tailwindcss/postcss, tailwindcss, typescript, @types/react, @types/react-dom
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Files Created
|
|
175
|
+
|
|
176
|
+
List every file created or modified with a one-line description.
|
|
177
|
+
|
|
178
|
+
### How to Add Components
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# From packages/ui/
|
|
182
|
+
cd packages/ui
|
|
183
|
+
pnpm dlx shadcn@latest add button
|
|
184
|
+
pnpm dlx shadcn@latest add card
|
|
185
|
+
pnpm dlx shadcn@latest add input
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### How to Use in Apps
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import { Button } from "@scope/ui/components/ui/button";
|
|
192
|
+
import { cn } from "@scope/ui/utils/cn";
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Next Steps
|
|
196
|
+
|
|
197
|
+
- Add your first shadcn components with the commands above
|
|
198
|
+
- Create brand icons in `packages/ui/icons/logos/`
|
|
199
|
+
- Build custom components in `packages/ui/components/`
|
|
200
|
+
|
|
201
|
+
## Important Notes
|
|
202
|
+
|
|
203
|
+
- When adapting code, preserve the `// CONFIGURE:` comments so the user can find customization points later.
|
|
204
|
+
- Never overwrite existing files without asking. If `packages/ui/` exists, merge new files.
|
|
205
|
+
- The `@source` directive path must be correct relative to the consuming app — verify it resolves.
|
|
206
|
+
- If `tailwind-v4` is not installed and the user proceeds anyway, the UI package will work but may have missing design tokens (no animations, no sidebar colors, etc.).
|