create-baton 1.0.0 → 1.1.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/package.json +1 -1
- package/src/constants.js +3 -3
- package/templates/BATON_v3.1.md +53 -15
- package/templates/skills/domains/api/SKILL.md +318 -0
- package/templates/skills/domains/ecommerce/SKILL.md +277 -0
- package/templates/skills/domains/portfolio/SKILL.md +213 -0
- package/templates/skills/domains/saas/SKILL.md +252 -0
- package/templates/skills/patterns/authentication/SKILL.md +245 -0
- package/templates/skills/patterns/database-design/SKILL.md +230 -0
- package/templates/skills/patterns/email/SKILL.md +236 -0
- package/templates/skills/patterns/file-uploads/SKILL.md +216 -0
- package/templates/skills/patterns/payments/SKILL.md +246 -0
- package/templates/skills/patterns/seo/SKILL.md +219 -0
- package/templates/skills/stacks/prisma/SKILL.md +281 -0
- package/templates/skills/stacks/shadcn/SKILL.md +270 -0
- package/templates/skills/stacks/tailwind/SKILL.md +242 -0
- package/templates/skills/stacks/typescript/SKILL.md +241 -0
- package/templates/skills/stacks/vercel/SKILL.md +232 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ecommerce
|
|
3
|
+
description: >-
|
|
4
|
+
E-commerce patterns — product catalog, cart management, checkout flow,
|
|
5
|
+
inventory tracking, and order management. Load at Session 0 when building
|
|
6
|
+
an online store or marketplace. Stays loaded for the entire project lifecycle.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# E-Commerce Domain Skill
|
|
10
|
+
|
|
11
|
+
> E-commerce is not a CRUD app with a checkout button. It's a system where money moves and inventory matters.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Load This Skill When
|
|
16
|
+
|
|
17
|
+
- User says they're building a store, marketplace, or selling products online
|
|
18
|
+
- Project involves product listings, shopping cart, or checkout
|
|
19
|
+
- Revenue model is transactional (per purchase, not subscription)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Core Data Model (Session 0-1)
|
|
24
|
+
|
|
25
|
+
### Minimum Tables
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
products — What you're selling
|
|
29
|
+
product_variants — Size, color, etc. (optional, add when needed)
|
|
30
|
+
orders — Purchase records
|
|
31
|
+
order_items — Products in each order
|
|
32
|
+
customers — Buyers (may overlap with users)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Product Schema
|
|
36
|
+
|
|
37
|
+
```sql
|
|
38
|
+
CREATE TABLE products (
|
|
39
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
40
|
+
name TEXT NOT NULL,
|
|
41
|
+
slug TEXT UNIQUE NOT NULL,
|
|
42
|
+
description TEXT,
|
|
43
|
+
price_cents INTEGER NOT NULL, -- Store in cents, ALWAYS
|
|
44
|
+
compare_at_price_cents INTEGER, -- Original price for "sale" display
|
|
45
|
+
currency TEXT DEFAULT 'USD',
|
|
46
|
+
status TEXT DEFAULT 'draft', -- draft | active | archived
|
|
47
|
+
inventory_count INTEGER DEFAULT 0,
|
|
48
|
+
images JSONB DEFAULT '[]',
|
|
49
|
+
metadata JSONB DEFAULT '{}',
|
|
50
|
+
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
51
|
+
updated_at TIMESTAMPTZ DEFAULT NOW()
|
|
52
|
+
);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Critical rules:**
|
|
56
|
+
- Store prices in smallest currency unit (cents, fils, pence)
|
|
57
|
+
- Never use floating point for money
|
|
58
|
+
- Products have statuses — don't show drafts to customers
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Product Display (Session 1-3)
|
|
63
|
+
|
|
64
|
+
### Product Listing Page
|
|
65
|
+
|
|
66
|
+
Show:
|
|
67
|
+
- Product image (first image, optimized)
|
|
68
|
+
- Product name
|
|
69
|
+
- Price (formatted with currency)
|
|
70
|
+
- "Sale" badge if compare_at_price exists
|
|
71
|
+
- "Out of stock" badge if inventory_count = 0
|
|
72
|
+
|
|
73
|
+
### Product Detail Page
|
|
74
|
+
|
|
75
|
+
Show:
|
|
76
|
+
- Image gallery (swipeable on mobile)
|
|
77
|
+
- Name, price, description
|
|
78
|
+
- Variant selector (if applicable)
|
|
79
|
+
- Add to cart button (disabled if out of stock)
|
|
80
|
+
- Quantity selector
|
|
81
|
+
|
|
82
|
+
**Price display helper:**
|
|
83
|
+
```typescript
|
|
84
|
+
function formatPrice(cents: number, currency = 'USD'): string {
|
|
85
|
+
return new Intl.NumberFormat('en-US', {
|
|
86
|
+
style: 'currency',
|
|
87
|
+
currency,
|
|
88
|
+
}).format(cents / 100);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Cart (Session 2-3)
|
|
95
|
+
|
|
96
|
+
### Cart Strategy
|
|
97
|
+
|
|
98
|
+
| Approach | Pros | Cons |
|
|
99
|
+
|----------|------|------|
|
|
100
|
+
| **localStorage** | Simple, no auth needed | Lost on device switch |
|
|
101
|
+
| **Database** | Persists, works cross-device | Needs auth or session ID |
|
|
102
|
+
| **Hybrid** | localStorage for guests, DB for logged-in | More complex |
|
|
103
|
+
|
|
104
|
+
**Default:** localStorage for MVP. Move to database when users ask for saved carts.
|
|
105
|
+
|
|
106
|
+
### Cart Data Structure
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
interface CartItem {
|
|
110
|
+
productId: string;
|
|
111
|
+
variantId?: string;
|
|
112
|
+
quantity: number;
|
|
113
|
+
priceAtAdd: number; // Price when added (prices can change)
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Cart Rules
|
|
118
|
+
|
|
119
|
+
- Validate inventory before checkout (not just at add-to-cart)
|
|
120
|
+
- Show item count in header/nav always
|
|
121
|
+
- Let users update quantity or remove items
|
|
122
|
+
- Show subtotal, update on every change
|
|
123
|
+
- Don't clear cart on page refresh
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Checkout (Session 3-5)
|
|
128
|
+
|
|
129
|
+
### Checkout Flow
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
Cart → Shipping info → Payment → Confirmation
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Keep it to ONE page if possible. Multi-step checkout kills conversion.
|
|
136
|
+
|
|
137
|
+
### Use Stripe Checkout
|
|
138
|
+
|
|
139
|
+
Don't build a custom payment form. Stripe Checkout handles:
|
|
140
|
+
- Card input (PCI compliant)
|
|
141
|
+
- Apple Pay, Google Pay
|
|
142
|
+
- 3D Secure
|
|
143
|
+
- Tax calculation
|
|
144
|
+
- Receipt emails
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// Create checkout session
|
|
148
|
+
const session = await stripe.checkout.sessions.create({
|
|
149
|
+
mode: 'payment',
|
|
150
|
+
line_items: cartItems.map(item => ({
|
|
151
|
+
price_data: {
|
|
152
|
+
currency: 'usd',
|
|
153
|
+
product_data: { name: item.name },
|
|
154
|
+
unit_amount: item.priceAtAdd,
|
|
155
|
+
},
|
|
156
|
+
quantity: item.quantity,
|
|
157
|
+
})),
|
|
158
|
+
success_url: `${baseUrl}/order/success?session_id={CHECKOUT_SESSION_ID}`,
|
|
159
|
+
cancel_url: `${baseUrl}/cart`,
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### After Payment (Webhook)
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
Payment confirmed →
|
|
167
|
+
Create order record →
|
|
168
|
+
Decrement inventory →
|
|
169
|
+
Send confirmation email →
|
|
170
|
+
Clear cart
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Critical:** Decrement inventory in the webhook, not at checkout start. Failed payments shouldn't reduce stock.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Order Management (Session 4-6)
|
|
178
|
+
|
|
179
|
+
### Order Statuses
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
pending → confirmed → processing → shipped → delivered
|
|
183
|
+
↘ cancelled
|
|
184
|
+
↘ refunded
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Order Schema
|
|
188
|
+
|
|
189
|
+
```sql
|
|
190
|
+
CREATE TABLE orders (
|
|
191
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
192
|
+
customer_id UUID REFERENCES customers(id),
|
|
193
|
+
status TEXT DEFAULT 'pending',
|
|
194
|
+
subtotal_cents INTEGER NOT NULL,
|
|
195
|
+
shipping_cents INTEGER DEFAULT 0,
|
|
196
|
+
tax_cents INTEGER DEFAULT 0,
|
|
197
|
+
total_cents INTEGER NOT NULL,
|
|
198
|
+
shipping_address JSONB,
|
|
199
|
+
stripe_session_id TEXT,
|
|
200
|
+
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
201
|
+
);
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### What Customers Need
|
|
205
|
+
|
|
206
|
+
- Order confirmation page (immediately after checkout)
|
|
207
|
+
- Order history page (list of past orders)
|
|
208
|
+
- Order detail page (items, status, tracking)
|
|
209
|
+
- Email notifications (confirmation, shipped, delivered)
|
|
210
|
+
|
|
211
|
+
### What Admin Needs
|
|
212
|
+
|
|
213
|
+
- Order list with filters (status, date range)
|
|
214
|
+
- Order detail with ability to update status
|
|
215
|
+
- Basic revenue dashboard (total sales, order count)
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Inventory (Session 3-5)
|
|
220
|
+
|
|
221
|
+
### Simple Inventory Rules
|
|
222
|
+
|
|
223
|
+
- Track `inventory_count` on each product
|
|
224
|
+
- Decrement on confirmed order (webhook)
|
|
225
|
+
- Increment on cancellation/refund
|
|
226
|
+
- Show "Out of stock" when count = 0
|
|
227
|
+
- Show "Low stock" when count < threshold (e.g., 5)
|
|
228
|
+
|
|
229
|
+
### Don't Over-Build
|
|
230
|
+
|
|
231
|
+
Skip these until you actually need them:
|
|
232
|
+
- Warehouse management
|
|
233
|
+
- Multi-location inventory
|
|
234
|
+
- Automated reordering
|
|
235
|
+
- Batch/lot tracking
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Search and Filtering (Session 4-6)
|
|
240
|
+
|
|
241
|
+
### Minimum Viable Search
|
|
242
|
+
|
|
243
|
+
- Text search on product name + description
|
|
244
|
+
- Filter by category (if categories exist)
|
|
245
|
+
- Sort by price (low-high, high-low) and newest
|
|
246
|
+
|
|
247
|
+
### Don't Build Yet
|
|
248
|
+
|
|
249
|
+
- Faceted search (wait for 100+ products)
|
|
250
|
+
- AI-powered recommendations
|
|
251
|
+
- Elasticsearch/Algolia (use database full-text search first)
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Session Checkpoints
|
|
256
|
+
|
|
257
|
+
### Session 3: Storefront Check
|
|
258
|
+
- [ ] Products display correctly
|
|
259
|
+
- [ ] Cart works (add, remove, update quantity)
|
|
260
|
+
- [ ] Price formatting is correct everywhere
|
|
261
|
+
|
|
262
|
+
### Session 5: Checkout Check
|
|
263
|
+
- [ ] Stripe Checkout works (test mode)
|
|
264
|
+
- [ ] Webhook creates orders and decrements inventory
|
|
265
|
+
- [ ] Order confirmation page shows after payment
|
|
266
|
+
- [ ] Cart clears after successful purchase
|
|
267
|
+
|
|
268
|
+
### Session 8: Pre-Launch Check
|
|
269
|
+
- [ ] Real products loaded
|
|
270
|
+
- [ ] Stripe in live mode
|
|
271
|
+
- [ ] Order notification emails working
|
|
272
|
+
- [ ] Admin can view and manage orders
|
|
273
|
+
- [ ] Inventory tracking accurate
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
*Last updated: Baton Protocol v3.1*
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: portfolio
|
|
3
|
+
description: >-
|
|
4
|
+
Portfolio and personal brand site patterns — case studies, project showcases,
|
|
5
|
+
contact forms, and performance optimization. Load at Session 0 when building
|
|
6
|
+
a portfolio, personal site, or creative showcase. Stays loaded entire lifecycle.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Portfolio Domain Skill
|
|
10
|
+
|
|
11
|
+
> A portfolio is a sales page for your skills. Every design choice should answer: "Would I hire this person?"
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Load This Skill When
|
|
16
|
+
|
|
17
|
+
- User says they're building a portfolio, personal site, or showcase
|
|
18
|
+
- Project is about presenting work, not building a product
|
|
19
|
+
- Goal is impressions, not recurring revenue
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## What Makes a Good Portfolio (Session 0)
|
|
24
|
+
|
|
25
|
+
### The 5-Second Test
|
|
26
|
+
|
|
27
|
+
A visitor decides in 5 seconds:
|
|
28
|
+
1. **Who are you?** (name + role)
|
|
29
|
+
2. **What do you do?** (one sentence)
|
|
30
|
+
3. **Can I see proof?** (projects visible immediately)
|
|
31
|
+
|
|
32
|
+
If any answer is missing above the fold, the site fails.
|
|
33
|
+
|
|
34
|
+
### Content Priority (in order)
|
|
35
|
+
|
|
36
|
+
1. Name + title + one-line bio
|
|
37
|
+
2. 3-6 best projects (not everything you've ever done)
|
|
38
|
+
3. Brief about section
|
|
39
|
+
4. Contact method
|
|
40
|
+
5. Optional: blog, resume, testimonials
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Site Structure (Session 1)
|
|
45
|
+
|
|
46
|
+
### Simple and Fast
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
/ — Hero + project grid
|
|
50
|
+
/projects/[slug] — Individual case study
|
|
51
|
+
/about — Bio, skills, background
|
|
52
|
+
/contact — Contact form or links
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
That's it. Don't add pages until you have a reason.
|
|
56
|
+
|
|
57
|
+
### Navigation
|
|
58
|
+
|
|
59
|
+
- Max 4 nav items: Work, About, Contact, [Blog/Resume]
|
|
60
|
+
- Logo/name links home
|
|
61
|
+
- Mobile: hamburger menu or bottom nav
|
|
62
|
+
- Current page indicator
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Project Showcase (Session 1-3)
|
|
67
|
+
|
|
68
|
+
### Project Card (Grid View)
|
|
69
|
+
|
|
70
|
+
Each card shows:
|
|
71
|
+
- Featured image/screenshot (16:9 or 4:3, consistent ratio)
|
|
72
|
+
- Project name
|
|
73
|
+
- One-line description
|
|
74
|
+
- Tech tags (optional, subtle)
|
|
75
|
+
|
|
76
|
+
### Case Study Page
|
|
77
|
+
|
|
78
|
+
Structure each project page the same way:
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
## [Project Name]
|
|
82
|
+
|
|
83
|
+
**One-liner:** What it is and who it's for
|
|
84
|
+
|
|
85
|
+
**The Challenge:** What problem needed solving (2-3 sentences)
|
|
86
|
+
|
|
87
|
+
**The Solution:** What you built and key decisions (3-5 sentences)
|
|
88
|
+
|
|
89
|
+
**Key Features:** 3-5 bullet points with screenshots
|
|
90
|
+
|
|
91
|
+
**Results:** Numbers if possible (users, revenue, performance)
|
|
92
|
+
|
|
93
|
+
**Tech Stack:** List of technologies used
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Rules:**
|
|
97
|
+
- Lead with visuals — screenshot or demo above the fold
|
|
98
|
+
- Keep text short — visitors skim, they don't read
|
|
99
|
+
- Show 3-6 projects maximum — quality over quantity
|
|
100
|
+
- Order by impressiveness, not chronology
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Design Standards (Session 1-2)
|
|
105
|
+
|
|
106
|
+
### Typography
|
|
107
|
+
|
|
108
|
+
- Large heading for name (40-60px)
|
|
109
|
+
- Clean body font (16-18px, system font or Inter)
|
|
110
|
+
- Generous line height (1.6-1.8 for body)
|
|
111
|
+
- Max reading width: 680px for text blocks
|
|
112
|
+
|
|
113
|
+
### Color
|
|
114
|
+
|
|
115
|
+
- Dark background with light text (modern, dramatic) OR
|
|
116
|
+
- Light background with dark text (clean, professional)
|
|
117
|
+
- One accent color for links and CTAs
|
|
118
|
+
- Don't use more than 3 colors total
|
|
119
|
+
|
|
120
|
+
### Animation
|
|
121
|
+
|
|
122
|
+
- Subtle fade-in on scroll (IntersectionObserver)
|
|
123
|
+
- Hover effects on project cards (scale 1.02, shadow)
|
|
124
|
+
- Page transitions (optional, keep fast)
|
|
125
|
+
- **Never:** Auto-playing video, parallax that causes jank, loading screens
|
|
126
|
+
|
|
127
|
+
### Performance
|
|
128
|
+
|
|
129
|
+
Portfolio sites MUST be fast. Target:
|
|
130
|
+
- First paint under 1 second
|
|
131
|
+
- Full load under 2 seconds
|
|
132
|
+
- Lighthouse performance score 90+
|
|
133
|
+
|
|
134
|
+
Use Next.js Image component, lazy loading, and static generation.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Contact (Session 2-3)
|
|
139
|
+
|
|
140
|
+
### Options (Pick One)
|
|
141
|
+
|
|
142
|
+
| Method | Pros | Cons |
|
|
143
|
+
|--------|------|------|
|
|
144
|
+
| **Email link** | Simplest, no backend needed | Spam exposure |
|
|
145
|
+
| **Contact form** | Professional, controlled | Needs backend/service |
|
|
146
|
+
| **Calendly embed** | Direct booking | Feels salesy |
|
|
147
|
+
| **Social links** | Multiple channels | No single inbox |
|
|
148
|
+
|
|
149
|
+
**Default for most:** Contact form with email notification.
|
|
150
|
+
|
|
151
|
+
### Contact Form (If Used)
|
|
152
|
+
|
|
153
|
+
Fields:
|
|
154
|
+
- Name (required)
|
|
155
|
+
- Email (required)
|
|
156
|
+
- Message (required)
|
|
157
|
+
- That's it. No phone, no company, no dropdown menus.
|
|
158
|
+
|
|
159
|
+
Use a form service (Formspree, Resend, or server action) to avoid building a backend just for contact.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## SEO for Portfolios (Session 3+)
|
|
164
|
+
|
|
165
|
+
### Minimum
|
|
166
|
+
|
|
167
|
+
- Page title: "[Name] — [Role]" (e.g., "Sarah Chen — Product Designer")
|
|
168
|
+
- Meta description: One sentence about what you do
|
|
169
|
+
- Open Graph image: Screenshot of your homepage or a branded card
|
|
170
|
+
- Sitemap generated automatically (Next.js does this)
|
|
171
|
+
|
|
172
|
+
### Project Pages
|
|
173
|
+
|
|
174
|
+
- Each project gets its own URL (`/projects/project-name`)
|
|
175
|
+
- Unique title and description per project
|
|
176
|
+
- Featured image as OG image
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Blog (Optional, Session 5+)
|
|
181
|
+
|
|
182
|
+
Only add a blog if the user specifically wants one. Don't suggest it.
|
|
183
|
+
|
|
184
|
+
If added:
|
|
185
|
+
- Markdown or MDX files (no CMS unless requested)
|
|
186
|
+
- Simple list page, individual post pages
|
|
187
|
+
- Date, title, reading time
|
|
188
|
+
- No categories, tags, or comments until needed
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Session Checkpoints
|
|
193
|
+
|
|
194
|
+
### Session 2: Foundation Check
|
|
195
|
+
- [ ] Homepage shows name, role, and project grid
|
|
196
|
+
- [ ] At least 2 project case studies exist
|
|
197
|
+
- [ ] Mobile responsive (test at 375px)
|
|
198
|
+
|
|
199
|
+
### Session 4: Polish Check
|
|
200
|
+
- [ ] All projects have case study pages
|
|
201
|
+
- [ ] Contact method works
|
|
202
|
+
- [ ] About page exists
|
|
203
|
+
- [ ] Lighthouse performance 90+
|
|
204
|
+
|
|
205
|
+
### Session 6: Launch Check
|
|
206
|
+
- [ ] Custom domain configured
|
|
207
|
+
- [ ] OG images set for all pages
|
|
208
|
+
- [ ] Tested on real phones (not just browser resize)
|
|
209
|
+
- [ ] Ask someone else to review for 30 seconds
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
*Last updated: Baton Protocol v3.1*
|