Skip to content

Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations.

refactor: inline references into final 4 skills — completes #65

Marcus Webb936165298a4e
diff --git a/plugins/cloudflare/skills/tanstack-start/SKILL.md b/plugins/cloudflare/skills/tanstack-start/SKILL.md
index 376f3039..f40c1bea 100644
--- a/plugins/cloudflare/skills/tanstack-start/SKILL.md
+++ b/plugins/cloudflare/skills/tanstack-start/SKILL.md
@@ -19,12 +19,107 @@ Build a complete full-stack app from nothing. Claude generates every file — no
| Auth | better-auth (Google OAuth + email/password) |
| Deployment | Cloudflare Workers |
+## Project File Tree
+
+```
+PROJECT_NAME/
+├── src/
+│ ├── routes/
+│ │ ├── __root.tsx # Root layout (HTML shell, theme, CSS import)
+│ │ ├── index.tsx # Landing / auth redirect
+│ │ ├── login.tsx # Login page
+│ │ ├── register.tsx # Register page
+│ │ ├── _authed.tsx # Auth guard layout route
+│ │ ├── _authed/
+│ │ │ ├── dashboard.tsx # Dashboard with stat cards
+│ │ │ ├── items.tsx # Items list table
+│ │ │ ├── items.$id.tsx # Edit item
+│ │ │ └── items.new.tsx # Create item
+│ │ └── api/
+│ │ └── auth/
+│ │ └── $.ts # better-auth API catch-all
+│ ├── components/
+│ │ ├── ui/ # shadcn/ui components (auto-installed)
+│ │ ├── app-sidebar.tsx # Navigation sidebar
+│ │ ├── theme-toggle.tsx # Light/dark/system toggle
+│ │ ├── user-nav.tsx # User dropdown menu
+│ │ └── stat-card.tsx # Dashboard stat card
+│ ├── db/
+│ │ ├── schema.ts # Drizzle schema (all tables)
+│ │ └── index.ts # Drizzle client factory
+│ ├── lib/
+│ │ ├── auth.server.ts # better-auth server config
+│ │ ├── auth.client.ts # better-auth React hooks
+│ │ └── utils.ts # cn() helper for shadcn/ui
+│ ├── server/
+│ │ └── functions.ts # Server functions (CRUD, auth checks)
+│ ├── styles/
+│ │ └── app.css # Tailwind v4 + shadcn/ui CSS variables
+│ ├── router.tsx # TanStack Router configuration
+│ ├── client.tsx # Client entry (hydrateRoot)
+│ ├── ssr.tsx # SSR entry
+│ └── routeTree.gen.ts # Auto-generated route tree (do not edit)
+├── drizzle/ # Generated migrations
+├── public/ # Static assets (favicon, etc.)
+├── vite.config.ts
+├── wrangler.jsonc
+├── drizzle.config.ts
+├── tsconfig.json
+├── package.json
+├── .dev.vars # Local env vars (NOT committed)
+└── .gitignore
+```
+
+## Dependencies
+
+**Runtime:**
+```json
+{
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0",
+ "@tanstack/react-router": "^1.120.0",
+ "@tanstack/react-start": "^1.120.0",
+ "drizzle-orm": "^0.38.0",
+ "better-auth": "^1.2.0",
+ "zod": "^3.24.0",
+ "class-variance-authority": "^0.7.0",
+ "clsx": "^2.1.0",
+ "tailwind-merge": "^3.0.0",
+ "lucide-react": "^0.480.0"
+}
+```
+
+**Dev:**
+```json
+{
+ "@cloudflare/vite-plugin": "^1.0.0",
+ "@tailwindcss/vite": "^4.0.0",
+ "@vitejs/plugin-react": "^4.4.0",
+ "tailwindcss": "^4.0.0",
+ "typescript": "^5.7.0",
+ "drizzle-kit": "^0.30.0",
+ "wrangler": "^4.0.0",
+ "tw-animate-css": "^1.2.0"
+}
+```
+
+**Scripts:**
+```json
+{
+ "dev": "vite",
+ "build": "vite build",
+ "preview": "vite preview",
+ "deploy": "wrangler deploy",
+ "db:generate": "drizzle-kit generate",
+ "db:migrate:local": "wrangler d1 migrations apply PROJECT_NAME-db --local",
+ "db:migrate:remote": "wrangler d1 migrations apply PROJECT_NAME-db --remote"
+}
+```
+
## Workflow
### Step 1: Gather Project Info
-Ask for:
-
| Required | Optional |
|----------|----------|
| Project name (kebab-case) | Google OAuth credentials |
@@ -36,39 +131,93 @@ Ask for:
Create the project directory and all config files from scratch.
-**See `references/architecture.md`** for the complete file tree, all dependencies, and config templates.
+**`vite.config.ts`** — Plugin order matters. Cloudflare MUST be first:
-Create these files first:
+```typescript
+import { defineConfig } from "vite";
+import { cloudflare } from "@cloudflare/vite-plugin";
+import { tanstackStart } from "@tanstack/react-start/plugin/vite";
+import tailwindcss from "@tailwindcss/vite";
+import viteReact from "@vitejs/plugin-react";
-1. **`package.json`** — all runtime + dev dependencies with version ranges from architecture.md
-2. **`tsconfig.json`** — strict mode, `@/*` path alias mapped to `src/*`
-3. **`vite.config.ts`** — plugins in correct order: `cloudflare()` → `tailwindcss()` → `tanstackStart()` → `viteReact()`
-4. **`wrangler.jsonc`** — `main: "@tanstack/react-start/server-entry"`, `nodejs_compat` flag, D1 binding placeholder
-5. **`.dev.vars`** — generate `BETTER_AUTH_SECRET` with `openssl rand -hex 32`, set `BETTER_AUTH_URL=http://localhost:3000`, `TRUSTED_ORIGINS=http://localhost:3000`
-6. **`.gitignore`** — node_modules, .wrangler, dist, .output, .dev.vars, .vinxi, .DS_Store
+export default defineConfig({
+ plugins: [
+ cloudflare({ viteEnvironment: { name: "ssr" } }),
+ tailwindcss(),
+ tanstackStart(),
+ viteReact(),
+ ],
+});
+```
-Then:
+**`wrangler.jsonc`**:
-```bash
-cd PROJECT_NAME
-pnpm install
+```jsonc
+{
+ "$schema": "node_modules/wrangler/config-schema.json",
+ "name": "PROJECT_NAME",
+ "compatibility_date": "2025-04-01",
+ "compatibility_flags": ["nodejs_compat"],
+ "main": "@tanstack/react-start/server-entry",
+ "account_id": "ACCOUNT_ID",
+ "d1_databases": [
+ {
+ "binding": "DB",
+ "database_name": "PROJECT_NAME-db",
+ "database_id": "DATABASE_ID",
+ "migrations_dir": "drizzle"
+ }
+ ]
+}
+```
+
+Key points: `main` MUST be `"@tanstack/react-start/server-entry"` (Nitro server entry). Use `nodejs_compat` (NOT `node_compat`). Add `account_id` to avoid interactive prompts.
+
+**`tsconfig.json`**:
+
+```json
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "jsx": "react-jsx",
+ "strict": true,
+ "skipLibCheck": true,
+ "esModuleInterop": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "paths": { "@/*": ["./src/*"] },
+ "types": ["@cloudflare/workers-types/2023-07-01"]
+ },
+ "include": ["src/**/*", "vite.config.ts"]
+}
```
-Create D1 database and update wrangler.jsonc:
+**`.dev.vars`** — generate `BETTER_AUTH_SECRET` with `openssl rand -hex 32`:
+
+```
+BETTER_AUTH_SECRET=<generated-hex-32>
+BETTER_AUTH_URL=http://localhost:3000
+TRUSTED_ORIGINS=http://localhost:3000
+# GOOGLE_CLIENT_ID=
+# GOOGLE_CLIENT_SECRET=
+```
+
+**`.gitignore`** — node_modules, .wrangler, dist, .output, .dev.vars, .vinxi, .DS_Store
+
+Then install and create the D1 database:
```bash
+cd PROJECT_NAME && pnpm install
npx wrangler d1 create PROJECT_NAME-db
# Copy the database_id into wrangler.jsonc d1_databases binding
```
### Step 3: Database Schema
-Create the Drizzle schema with D1-correct patterns.
-
-**`src/db/schema.ts`** — Define all tables:
-
-- **better-auth tables**: `users`, `sessions`, `accounts`, `verifications` — these are required by better-auth
-- **Application table**: `items` (or whatever the project needs) for CRUD demo
+**`src/db/schema.ts`** — All tables. better-auth requires: `users`, `sessions`, `accounts`, `verifications`. Add application tables (e.g. `items`) for CRUD demo.
D1-specific rules:
- Use `integer` for timestamps (Unix epoch), NOT Date objects
@@ -88,7 +237,7 @@ export function getDb() {
}
```
-**CRITICAL**: Use `import { env } from "cloudflare:workers"` — NOT `process.env`. This is a per-request binding, so create the Drizzle client inside each server function, not at module level.
+**CRITICAL**: Use `import { env } from "cloudflare:workers"` — NOT `process.env`. Create the Drizzle client inside each server function (per-request), not at module level.
**`drizzle.config.ts`**:
@@ -102,16 +251,6 @@ export default defineConfig({
});
```
-Add migration scripts to `package.json`:
-
-```json
-{
- "db:generate": "drizzle-kit generate",
- "db:migrate:local": "wrangler d1 migrations apply PROJECT_NAME-db --local",
- "db:migrate:remote": "wrangler d1 migrations apply PROJECT_NAME-db --remote"
-}
-```
-
Generate and apply the initial migration:
```bash
@@ -121,7 +260,7 @@ pnpm db:migrate:local
### Step 4: Configure Auth
-**`src/lib/auth.server.ts`** — Server-side better-auth configuration:
+**`src/lib/auth.server.ts`** — Server-side better-auth:
```typescript
import { betterAuth } from "better-auth";
@@ -145,7 +284,7 @@ export function getAuth() {
}
```
-**CRITICAL**: `getAuth()` must be called per-request (inside handler/loader), NOT at module level. The `env` import from `cloudflare:workers` is only available during request handling.
+**CRITICAL**: `getAuth()` must be called per-request (inside handler/loader), NOT at module level.
**`src/lib/auth.client.ts`** — Client-side auth hooks:
@@ -155,7 +294,7 @@ import { createAuthClient } from "better-auth/react";
export const { useSession, signIn, signOut, signUp } = createAuthClient();
```
-**`src/routes/api/auth/$.ts`** — API catch-all route for better-auth:
+**`src/routes/api/auth/$.ts`** — API catch-all for better-auth:
```typescript
import { createAPIFileRoute } from "@tanstack/react-start/api";
@@ -169,76 +308,88 @@ export const APIRoute = createAPIFileRoute("/api/auth/$")({
**CRITICAL**: Auth MUST use an API route (`createAPIFileRoute`), NOT a server function (`createServerFn`). better-auth needs direct request/response access.
-### Step 5: App Shell + Theme
+### Step 5: Server Functions
-**`src/routes/__root.tsx`** — Root layout with HTML document:
+**Core pattern** — always create DB client inside the handler:
-- Render full HTML document with `<HeadContent />` and `<Scripts />` from `@tanstack/react-router`
-- Add `suppressHydrationWarning` on `<html>` for SSR + theme toggle compatibility
-- Import the global CSS file
-- Include theme initialisation script inline to prevent flash of wrong theme
-
-**`src/styles/app.css`** — Tailwind v4 + shadcn/ui:
+```typescript
+import { createServerFn } from "@tanstack/react-start";
+import { getDb } from "../db";
-- `@import "tailwindcss"` (v4 syntax)
-- CSS variables for shadcn/ui tokens in `:root` and `.dark`
-- Neutral/monochrome palette (stone, slate, zinc)
-- Use semantic tokens only — never raw Tailwind colours
+export const getItems = createServerFn({ method: "GET" }).handler(async () => {
+ const db = getDb();
+ return db.select().from(items).all();
+});
+```
-**`src/router.tsx`** — Router configuration:
+**Input validation** with Zod:
```typescript
-import { createRouter as createTanStackRouter } from "@tanstack/react-router";
-import { routeTree } from "./routeTree.gen";
+export const createItem = createServerFn({ method: "POST" })
+ .inputValidator(
+ z.object({
+ name: z.string().min(1),
+ description: z.string().optional(),
+ })
+ )
+ .handler(async ({ data }) => {
+ const db = getDb();
+ const id = crypto.randomUUID();
+ await db.insert(items).values({ id, ...data, createdAt: Date.now() });
+ return { id };
+ });
+```
-export function createRouter() {
- return createTanStackRouter({ routeTree });
-}
+**Protected server functions** — check auth, throw redirect if unauthenticated:
-declare module "@tanstack/react-router" {
- interface Register {
- router: ReturnType<typeof createRouter>;
+```typescript
+import { redirect } from "@tanstack/react-router";
+import { getAuth } from "../lib/auth.server";
+
+async function requireSession(request?: Request) {
+ const auth = getAuth();
+ const session = await auth.api.getSession({
+ headers: request?.headers ?? new Headers(),
+ });
+ if (!session) {
+ throw redirect({ to: "/login" });
}
+ return session;
}
-```
-
-**`src/client.tsx`** and **`src/ssr.tsx`** — Entry points (standard TanStack Start boilerplate).
-Install shadcn/ui components needed for the dashboard:
+export const getSessionFn = createServerFn({ method: "GET" }).handler(
+ async ({ request }) => {
+ const auth = getAuth();
+ return auth.api.getSession({ headers: request.headers });
+ }
+);
-```bash
-pnpm dlx shadcn@latest init --defaults
-pnpm dlx shadcn@latest add button card input label sidebar table dropdown-menu form separator sheet
+export const getItems = createServerFn({ method: "GET" }).handler(
+ async ({ request }) => {
+ const session = await requireSession(request);
+ const db = getDb();
+ return db.select().from(items).where(eq(items.userId, session.user.id)).all();
+ }
+);
```
-**Note**: Configure shadcn to use `src/components` as the components directory.
-
-Theme toggle: three-state (light → dark → system → light). Store preference in localStorage. Apply `.dark` class on `<html>`. Use JS-only system preference detection — NO CSS `@media (prefers-color-scheme)` queries.
+**Route loader pattern** — server functions in route `loader`:
-### Step 6: Routes + Dashboard
-
-Create the route files:
+```typescript
+export const Route = createFileRoute("/_authed/items")({
+ loader: () => getItems(),
+ component: ItemsPage,
+});
-```
-src/routes/
-├── __root.tsx # Root layout (HTML shell, theme, CSS)
-├── index.tsx # Landing → redirect to /dashboard if authenticated
-├── login.tsx # Login form (email/password + Google OAuth button)
-├── register.tsx # Registration form
-├── _authed.tsx # Auth guard layout (beforeLoad checks session)
-└── _authed/
- ├── dashboard.tsx # Stat cards overview
- ├── items.tsx # Items list (table with actions)
- ├── items.$id.tsx # Edit item form
- └── items.new.tsx # Create item form
+function ItemsPage() {
+ const items = Route.useLoaderData();
+ return <div>{items.map((item) => <div key={item.id}>{item.name}</div>)}</div>;
+}
```
-**Auth guard pattern** (`_authed.tsx`):
+**Auth guard** (`_authed.tsx`) — use `beforeLoad`:
```typescript
-import { createFileRoute, redirect } from "@tanstack/react-router";
-import { getSessionFn } from "../server/auth";
-
export const Route = createFileRoute("/_authed")({
beforeLoad: async () => {
const session = await getSessionFn();
@@ -250,18 +401,61 @@ export const Route = createFileRoute("/_authed")({
});
```
-**Components** (in `src/components/`):
+Child routes access session via `Route.useRouteContext()`.
-- `app-sidebar.tsx` — shadcn Sidebar with navigation links (Dashboard, Items)
-- `theme-toggle.tsx` — three-state theme toggle button
-- `user-nav.tsx` — user dropdown menu with sign-out action
-- `stat-card.tsx` — reusable stat card for the dashboard
+**Mutation + invalidation** — after mutations, invalidate router to refetch loaders:
-**See `references/server-functions.md`** for `createServerFn` patterns used in route loaders and mutations.
+```typescript
+function CreateItemForm() {
+ const router = useRouter();
+ const handleSubmit = async (data: NewItem) => {
+ await createItem({ data });
+ router.invalidate();
+ router.navigate({ to: "/items" });
+ };
+ return <form onSubmit={...}>...</form>;
+}
+```
-### Step 7: CRUD Server Functions
+**Type safety** — use Drizzle's `InferSelectModel` / `InferInsertModel` for server function input/output types. For auth failures, always use `throw redirect()` — not error responses.
+
+### Step 6: App Shell + Theme
+
+**`src/routes/__root.tsx`** — Root layout with full HTML document, `<HeadContent />` and `<Scripts />` from `@tanstack/react-router`. Add `suppressHydrationWarning` on `<html>` for SSR + theme toggle compatibility. Import global CSS. Include inline theme init script to prevent flash.
+
+**`src/styles/app.css`** — `@import "tailwindcss"` (v4 syntax), CSS variables for shadcn/ui tokens in `:root` and `.dark`, neutral/monochrome palette. Use semantic tokens only.
+
+**`src/router.tsx`**:
+
+```typescript
+import { createRouter as createTanStackRouter } from "@tanstack/react-router";
+import { routeTree } from "./routeTree.gen";
-Create server functions for the items resource:
+export function createRouter() {
+ return createTanStackRouter({ routeTree });
+}
+
+declare module "@tanstack/react-router" {
+ interface Register {
+ router: ReturnType<typeof createRouter>;
+ }
+}
+```
+
+**`src/client.tsx`** and **`src/ssr.tsx`** — standard TanStack Start entry point boilerplate.
+
+Install shadcn/ui (configure to use `src/components`):
+
+```bash
+pnpm dlx shadcn@latest init --defaults
+pnpm dlx shadcn@latest add button card input label sidebar table dropdown-menu form separator sheet
+```
+
+**Theme toggle**: three-state (light -> dark -> system -> light). Store in localStorage. Apply `.dark` class on `<html>`. Use JS-only system preference detection — NO CSS `@media (prefers-color-scheme)` queries.
+
+**Components** in `src/components/`: `app-sidebar.tsx` (navigation), `theme-toggle.tsx`, `user-nav.tsx` (dropdown with sign-out), `stat-card.tsx`.
+
+### Step 7: CRUD Server Functions
| Function | Method | Purpose |
|----------|--------|---------|
@@ -271,13 +465,7 @@ Create server functions for the items resource:
| `updateItem` | POST | Update existing item |
| `deleteItem` | POST | Delete item by ID |
-Each server function:
-1. Gets auth session (redirect if not authenticated)
-2. Creates per-request Drizzle client via `getDb()`
-3. Performs the database operation
-4. Returns typed data
-
-Route loaders call GET server functions. Mutations call POST server functions then `router.invalidate()` to refetch.
+Each server function: (1) gets auth session, (2) creates per-request Drizzle client via `getDb()`, (3) performs DB operation, (4) returns typed data. Route loaders call GET functions. Mutations call POST functions then `router.invalidate()`.
### Step 8: Verify Locally
@@ -285,52 +473,71 @@ Route loaders call GET server functions. Mutations call POST server functions th
pnpm dev
```
-Verification checklist:
-
- [ ] App loads at http://localhost:3000
- [ ] Register a new account (email/password)
- [ ] Login and logout work
-- [ ] Dashboard page loads with stat cards
-- [ ] Create a new item via /items/new
-- [ ] Items list shows the new item
-- [ ] Edit item via /items/:id
-- [ ] Delete item from the list
-- [ ] Theme toggle cycles: light → dark → system
-- [ ] Sidebar collapses on mobile viewports
+- [ ] Dashboard loads with stat cards
+- [ ] Create, list, edit, delete items
+- [ ] Theme toggle cycles: light -> dark -> system
+- [ ] Sidebar collapses on mobile
- [ ] No console errors
### Step 9: Deploy to Production
+**Pre-deploy checklist:**
+- [ ] `wrangler.jsonc` has correct `account_id`
+- [ ] D1 database created and `database_id` set
+- [ ] `main` is `"@tanstack/react-start/server-entry"`
+- [ ] `nodejs_compat` in `compatibility_flags`
+- [ ] `.dev.vars` is in `.gitignore`
+- [ ] No hardcoded secrets in source
+
+**Set production secrets:**
+
```bash
-# Set production secrets
openssl rand -hex 32 | npx wrangler secret put BETTER_AUTH_SECRET
echo "https://PROJECT.SUBDOMAIN.workers.dev" | npx wrangler secret put BETTER_AUTH_URL
echo "http://localhost:3000,https://PROJECT.SUBDOMAIN.workers.dev" | npx wrangler secret put TRUSTED_ORIGINS
+```
-# If using Google OAuth
+If using Google OAuth:
+```bash
echo "your-client-id" | npx wrangler secret put GOOGLE_CLIENT_ID
echo "your-client-secret" | npx wrangler secret put GOOGLE_CLIENT_SECRET
+```
-# Migrate remote database
-pnpm db:migrate:remote
+Add production redirect URI in Google Cloud Console: `https://PROJECT.SUBDOMAIN.workers.dev/api/auth/callback/google`
-# Build and deploy
+**Migrate and deploy:**
+
+```bash
+pnpm db:migrate:remote
pnpm build && npx wrangler deploy
```
-**After first deploy**: Update `BETTER_AUTH_URL` with your actual Worker URL. Add production URL to Google OAuth redirect URIs: `https://your-app.workers.dev/api/auth/callback/google`.
+After first deploy: update `BETTER_AUTH_URL` with actual Worker URL, then redeploy.
+
+**Post-deploy verification:**
+- [ ] App loads at production URL
+- [ ] Auth login/register works
+- [ ] CRUD operations work
+- [ ] Theme persists across page loads
-**See `references/deployment.md`** for the full production checklist and common mistakes.
+**Custom domain** (optional): Add in Cloudflare Dashboard -> Workers -> Triggers -> Custom Domains. Update `BETTER_AUTH_URL` and `TRUSTED_ORIGINS` secrets with the custom domain. Update Google OAuth redirect URI. Redeploy.
## Common Issues
-| Symptom | Fix |
-|---------|-----|
-| `env` is undefined in server function | Use `import { env } from "cloudflare:workers"` — must be inside request handler, not module scope |
-| D1 database not found | Check wrangler.jsonc `d1_databases` binding name matches code |
-| Auth redirect loop | `BETTER_AUTH_URL` must match actual URL exactly (protocol + domain, no trailing slash) |
-| Auth silently fails (redirects to home) | Set `TRUSTED_ORIGINS` secret with all valid URLs (comma-separated) |
-| Styles not loading in dev | Ensure `@tailwindcss/vite` plugin is in vite.config.ts |
-| SSR hydration mismatch | Add `suppressHydrationWarning` to `<html>` element |
-| Build fails on Cloudflare | Check `nodejs_compat` in compatibility_flags, `main` field in wrangler.jsonc |
-| Secrets not taking effect | `wrangler secret put` does NOT redeploy — run `npx wrangler deploy` after |
+| Symptom | Cause | Fix |
+|---------|-------|-----|
+| `env` is undefined | Accessed at module level | Use `import { env } from "cloudflare:workers"` inside request handler only |
+| D1 database not found | Binding mismatch | Check `d1_databases` binding name in wrangler.jsonc matches code |
+| Auth redirect loop | URL mismatch | `BETTER_AUTH_URL` must match actual URL exactly (protocol + domain, no trailing slash) |
+| Auth silently fails | Missing origins | Set `TRUSTED_ORIGINS` secret with all valid URLs (comma-separated) |
+| Styles not loading | Missing plugin | Ensure `@tailwindcss/vite` plugin is in vite.config.ts |
+| SSR hydration mismatch | Theme flash | Add `suppressHydrationWarning` to `<html>` element |
+| Build fails on Cloudflare | Bad config | Check `nodejs_compat` flag and `main` field in wrangler.jsonc |
+| Secrets not taking effect | No redeploy | `wrangler secret put` does NOT redeploy — run `npx wrangler deploy` after |
+| Auth endpoints return 404 | Wrong route type | Use `createAPIFileRoute` (API route), not `createServerFn` for better-auth |
+| "redirect_uri_mismatch" | Missing URI | Add production URL to Google Cloud Console OAuth redirect URIs |
+| Cryptic Vite errors | Plugin order | Must be: `cloudflare()` -> `tailwindcss()` -> `tanstackStart()` -> `viteReact()` |
+| "Table not found" 500s | Missing migration | Run `pnpm db:migrate:remote` before deploying |
diff --git a/plugins/cloudflare/skills/tanstack-start/references/architecture.md b/plugins/cloudflare/skills/tanstack-start/references/architecture.md
deleted file mode 100644
index 52550dce..00000000
--- a/plugins/cloudflare/skills/tanstack-start/references/architecture.md
+++ /dev/null
@@ -1,204 +0,0 @@
-# Architecture Reference
-
-Complete structural blueprint for TanStack Start on Cloudflare Workers. Claude uses this to generate all project files from scratch.
-
-## Project File Tree
-
-```
-PROJECT_NAME/
-├── src/
-│ ├── routes/
-│ │ ├── __root.tsx # Root layout (HTML shell, theme, CSS import)
-│ │ ├── index.tsx # Landing / auth redirect
-│ │ ├── login.tsx # Login page
-│ │ ├── register.tsx # Register page
-│ │ ├── _authed.tsx # Auth guard layout route
-│ │ ├── _authed/
-│ │ │ ├── dashboard.tsx # Dashboard with stat cards
-│ │ │ ├── items.tsx # Items list table
-│ │ │ ├── items.$id.tsx # Edit item
-│ │ │ └── items.new.tsx # Create item
-│ │ └── api/
-│ │ └── auth/
-│ │ └── $.ts # better-auth API catch-all
-│ ├── components/
-│ │ ├── ui/ # shadcn/ui components (auto-installed)
-│ │ ├── app-sidebar.tsx # Navigation sidebar
-│ │ ├── theme-toggle.tsx # Light/dark/system toggle
-│ │ ├── user-nav.tsx # User dropdown menu
-│ │ └── stat-card.tsx # Dashboard stat card
-│ ├── db/
-│ │ ├── schema.ts # Drizzle schema (all tables)
-│ │ └── index.ts # Drizzle client factory
-│ ├── lib/
-│ │ ├── auth.server.ts # better-auth server config
-│ │ ├── auth.client.ts # better-auth React hooks
-│ │ └── utils.ts # cn() helper for shadcn/ui
-│ ├── server/
-│ │ └── functions.ts # Server functions (CRUD, auth checks)
-│ ├── styles/
-│ │ └── app.css # Tailwind v4 + shadcn/ui CSS variables
-│ ├── router.tsx # TanStack Router configuration
-│ ├── client.tsx # Client entry (hydrateRoot)
-│ ├── ssr.tsx # SSR entry
-│ └── routeTree.gen.ts # Auto-generated route tree (do not edit)
-├── drizzle/ # Generated migrations
-├── public/ # Static assets (favicon, etc.)
-├── vite.config.ts # Vite + Cloudflare + TanStack Start config
-├── wrangler.jsonc # Cloudflare Workers config
-├── drizzle.config.ts # Drizzle Kit config
-├── tsconfig.json # TypeScript config
-├── package.json # Dependencies + scripts
-├── .dev.vars # Local env vars (NOT committed)
-└── .gitignore
-```
-
-## Dependencies
-
-### Runtime
-
-```json
-{
- "react": "^19.0.0",
- "react-dom": "^19.0.0",
- "@tanstack/react-router": "^1.120.0",
- "@tanstack/react-start": "^1.120.0",
- "drizzle-orm": "^0.38.0",
- "better-auth": "^1.2.0",
- "zod": "^3.24.0",
- "class-variance-authority": "^0.7.0",
- "clsx": "^2.1.0",
- "tailwind-merge": "^3.0.0",
- "lucide-react": "^0.480.0"
-}
-```
-
-### Dev
-
-```json
-{
- "@cloudflare/vite-plugin": "^1.0.0",
- "@tailwindcss/vite": "^4.0.0",
- "@vitejs/plugin-react": "^4.4.0",
- "tailwindcss": "^4.0.0",
- "typescript": "^5.7.0",
- "drizzle-kit": "^0.30.0",
- "wrangler": "^4.0.0",
- "tw-animate-css": "^1.2.0"
-}
-```
-
-### package.json scripts
-
-```json
-{
- "dev": "vite",
- "build": "vite build",
- "preview": "vite preview",
- "deploy": "wrangler deploy",
- "db:generate": "drizzle-kit generate",
- "db:migrate:local": "wrangler d1 migrations apply PROJECT_NAME-db --local",
- "db:migrate:remote": "wrangler d1 migrations apply PROJECT_NAME-db --remote"
-}
-```
-
-## Vite Configuration
-
-Plugin order matters. Cloudflare must be first.
-
-```typescript
-// vite.config.ts
-import { defineConfig } from "vite";
-import { cloudflare } from "@cloudflare/vite-plugin";
-import { tanstackStart } from "@tanstack/react-start/plugin/vite";
-import tailwindcss from "@tailwindcss/vite";
-import viteReact from "@vitejs/plugin-react";
-
-export default defineConfig({
- plugins: [
- cloudflare({ viteEnvironment: { name: "ssr" } }),
- tailwindcss(),
- tanstackStart(),
- viteReact(),
- ],
-});
-```
-
-## Wrangler Configuration
-
-```jsonc
-// wrangler.jsonc
-{
- "$schema": "node_modules/wrangler/config-schema.json",
- "name": "PROJECT_NAME",
- "compatibility_date": "2025-04-01",
- "compatibility_flags": ["nodejs_compat"],
- "main": "@tanstack/react-start/server-entry",
- "account_id": "ACCOUNT_ID",
- "d1_databases": [
- {
- "binding": "DB",
- "database_name": "PROJECT_NAME-db",
- "database_id": "DATABASE_ID",
- "migrations_dir": "drizzle"
- }
- ]
-}
-```
-
-Key points:
-- `main` MUST be `"@tanstack/react-start/server-entry"` — this is the Nitro server entry
-- `nodejs_compat` is required (NOT `node_compat`)
-- `migrations_dir` tells wrangler where Drizzle outputs migrations
-- Add `account_id` to avoid interactive prompts during deploy
-
-## TypeScript Configuration
-
-```json
-{
- "compilerOptions": {
- "target": "ES2022",
- "module": "ESNext",
- "moduleResolution": "bundler",
- "jsx": "react-jsx",
- "strict": true,
- "skipLibCheck": true,
- "esModuleInterop": true,
- "resolveJsonModule": true,
- "isolatedModules": true,
- "noEmit": true,
- "paths": {
- "@/*": ["./src/*"]
- },
- "types": ["@cloudflare/workers-types/2023-07-01"]
- },
- "include": ["src/**/*", "vite.config.ts"]
-}
-```
-
-## Environment Variables
-
-### Auth (required)
-
-| Variable | Purpose | Example |
-|----------|---------|---------|
-| `BETTER_AUTH_SECRET` | Session encryption key | `openssl rand -hex 32` |
-| `BETTER_AUTH_URL` | Auth base URL | `http://localhost:3000` (dev) |
-| `TRUSTED_ORIGINS` | Allowed origins (comma-separated) | `http://localhost:3000,https://app.workers.dev` |
-
-### Google OAuth (optional)
-
-| Variable | Purpose |
-|----------|---------|
-| `GOOGLE_CLIENT_ID` | From Google Cloud Console |
-| `GOOGLE_CLIENT_SECRET` | From Google Cloud Console |
-
-### .dev.vars template
-
-```
-BETTER_AUTH_SECRET=<generated-hex-32>
-BETTER_AUTH_URL=http://localhost:3000
-TRUSTED_ORIGINS=http://localhost:3000
-# GOOGLE_CLIENT_ID=
-# GOOGLE_CLIENT_SECRET=
-```
diff --git a/plugins/cloudflare/skills/tanstack-start/references/deployment.md b/plugins/cloudflare/skills/tanstack-start/references/deployment.md
deleted file mode 100644
index 1ddd0e6d..00000000
--- a/plugins/cloudflare/skills/tanstack-start/references/deployment.md
+++ /dev/null
@@ -1,158 +0,0 @@
-# Deployment Reference
-
-Production deployment checklist and common mistakes for TanStack Start on Cloudflare Workers.
-
-## Pre-Deploy Checklist
-
-- [ ] `wrangler.jsonc` has correct `account_id`
-- [ ] D1 database created and `database_id` in wrangler.jsonc
-- [ ] `main` field is `"@tanstack/react-start/server-entry"`
-- [ ] `nodejs_compat` in `compatibility_flags`
-- [ ] `.dev.vars` is in `.gitignore`
-- [ ] No hardcoded secrets in source code
-
-## Deploy Sequence
-
-### 1. Set Production Secrets
-
-```bash
-# Generate a DIFFERENT secret than dev
-openssl rand -hex 32 | npx wrangler secret put BETTER_AUTH_SECRET
-
-# Use your actual Worker URL (update after first deploy if needed)
-echo "https://PROJECT_NAME.SUBDOMAIN.workers.dev" | npx wrangler secret put BETTER_AUTH_URL
-
-# Include all valid origins
-echo "http://localhost:3000,https://PROJECT_NAME.SUBDOMAIN.workers.dev" | npx wrangler secret put TRUSTED_ORIGINS
-```
-
-### 2. Google OAuth (if using)
-
-```bash
-echo "your-client-id" | npx wrangler secret put GOOGLE_CLIENT_ID
-echo "your-client-secret" | npx wrangler secret put GOOGLE_CLIENT_SECRET
-```
-
-Add production redirect URI in Google Cloud Console:
-```
-https://PROJECT_NAME.SUBDOMAIN.workers.dev/api/auth/callback/google
-```
-
-### 3. Migrate Remote Database
-
-```bash
-pnpm db:migrate:remote
-```
-
-**Always run migrations on BOTH local AND remote** before testing.
-
-### 4. Build and Deploy
-
-```bash
-pnpm build && npx wrangler deploy
-```
-
-### 5. Post-Deploy Verification
-
-- [ ] App loads at production URL
-- [ ] Auth login/register works
-- [ ] Database operations work (create, read, update, delete)
-- [ ] Theme persists across page loads
-- [ ] No console errors
-
-## Custom Domain (Optional)
-
-After initial deploy:
-
-1. Add custom domain in Cloudflare Dashboard → Workers → your worker → Triggers → Custom Domains
-2. Update secrets:
- ```bash
- echo "https://yourdomain.com" | npx wrangler secret put BETTER_AUTH_URL
- echo "http://localhost:3000,https://yourdomain.com" | npx wrangler secret put TRUSTED_ORIGINS
- ```
-3. Update Google OAuth redirect URI to use custom domain
-4. Redeploy: `npx wrangler deploy`
-
-## Common Mistakes
-
-### 1. TRUSTED_ORIGINS Not Set
-
-**Symptom**: User signs in but gets silently redirected to homepage. Auth cookie not accepted.
-
-**Fix**: Set the TRUSTED_ORIGINS secret with ALL valid URLs (comma-separated, no spaces):
-```bash
-echo "http://localhost:3000,https://your-app.workers.dev" | npx wrangler secret put TRUSTED_ORIGINS
-```
-
-### 2. BETTER_AUTH_URL Mismatch
-
-**Symptom**: Auth works locally but fails in production. Redirect loops or "invalid callback" errors.
-
-**Fix**: The URL must match the actual production URL exactly — including `https://`, no trailing slash. After first deploy, check the actual Worker URL and update:
-```bash
-echo "https://actual-url.workers.dev" | npx wrangler secret put BETTER_AUTH_URL
-npx wrangler deploy # Must redeploy after setting secret
-```
-
-### 3. Secrets Set But Not Deployed
-
-**Symptom**: Changed a secret but the app still uses the old value.
-
-**Fix**: `wrangler secret put` does NOT automatically redeploy. Always run `npx wrangler deploy` after setting secrets.
-
-### 4. Database Migrations Not Applied to Remote
-
-**Symptom**: API returns 500 errors. "Table not found" or "no such table" in logs.
-
-**Fix**: Run migrations on remote:
-```bash
-pnpm db:migrate:remote
-```
-
-### 5. Google OAuth Redirect URI Missing
-
-**Symptom**: "Error 400: redirect_uri_mismatch" when signing in with Google.
-
-**Fix**: Add your production URL to Google Cloud Console → APIs & Services → Credentials → your OAuth client → Authorised redirect URIs:
-```
-https://your-app.workers.dev/api/auth/callback/google
-```
-
-### 6. Wrong Vite Plugin Order
-
-**Symptom**: Build fails or SSR doesn't work. Cryptic Vite errors about "environment not found".
-
-**Fix**: Plugin order in `vite.config.ts` must be: `cloudflare()` → `tailwindcss()` → `tanstackStart()` → `viteReact()`. Cloudflare MUST be first.
-
-### 7. Module-Level Env Access
-
-**Symptom**: `env` is undefined, or "Cannot access env outside of request context".
-
-**Fix**: Never import and use `env` from `cloudflare:workers` at module level. Always access inside server function handlers, route loaders, or API route handlers.
-
-```typescript
-// ❌ Module level — fails
-import { env } from "cloudflare:workers";
-const db = drizzle(env.DB);
-
-// ✅ Inside handler — works
-export const getItems = createServerFn({ method: "GET" }).handler(async () => {
- const db = drizzle(env.DB); // env accessed during request
-});
-```
-
-### 8. Auth on Server Function Instead of API Route
-
-**Symptom**: better-auth endpoints return 404 or auth flow doesn't work.
-
-**Fix**: better-auth needs a catch-all API route (`createAPIFileRoute`), not a server function. It handles its own routing internally:
-
-```typescript
-// src/routes/api/auth/$.ts
-import { createAPIFileRoute } from "@tanstack/react-start/api";
-
-export const APIRoute = createAPIFileRoute("/api/auth/$")({
- GET: ({ request }) => getAuth().handler(request),
- POST: ({ request }) => getAuth().handler(request),
-});
-```
diff --git a/plugins/cloudflare/skills/tanstack-start/references/server-functions.md b/plugins/cloudflare/skills/tanstack-start/references/server-functions.md
deleted file mode 100644
index 13995dbd..00000000
--- a/plugins/cloudflare/skills/tanstack-start/references/server-functions.md
+++ /dev/null
@@ -1,212 +0,0 @@
-# Server Functions Reference
-
-Patterns for `createServerFn` on Cloudflare Workers with D1, Drizzle, and better-auth.
-
-## Core Pattern
-
-```typescript
-import { createServerFn } from "@tanstack/react-start";
-import { getDb } from "../db";
-
-export const getItems = createServerFn({ method: "GET" }).handler(async () => {
- const db = getDb(); // Per-request Drizzle client
- return db.select().from(items).all();
-});
-```
-
-**CRITICAL**: Create the Drizzle client inside the handler, NOT at module level. The `env` import from `cloudflare:workers` is only available during request handling.
-
-## Env Access on Cloudflare
-
-```typescript
-// ✅ CORRECT — inside handler or called from handler
-import { env } from "cloudflare:workers";
-
-export const getItems = createServerFn({ method: "GET" }).handler(async () => {
- const db = drizzle(env.DB, { schema }); // env available here
- return db.select().from(items).all();
-});
-
-// ❌ WRONG — module level
-import { env } from "cloudflare:workers";
-const db = drizzle(env.DB, { schema }); // env is undefined here!
-```
-
-## Input Validation
-
-Use `.inputValidator()` with Zod or inline validator:
-
-```typescript
-import { z } from "zod";
-
-export const createItem = createServerFn({ method: "POST" })
- .inputValidator(
- z.object({
- name: z.string().min(1),
- description: z.string().optional(),
- })
- )
- .handler(async ({ data }) => {
- const db = getDb();
- const id = crypto.randomUUID();
- await db.insert(items).values({ id, ...data, createdAt: Date.now() });
- return { id };
- });
-```
-
-## Protected Server Functions
-
-Check auth session inside the handler. Throw redirect for unauthenticated users:
-
-```typescript
-import { redirect } from "@tanstack/react-router";
-import { getAuth } from "../lib/auth.server";
-
-async function requireSession(request?: Request) {
- const auth = getAuth();
- const session = await auth.api.getSession({ headers: request?.headers ?? new Headers() });
- if (!session) {
- throw redirect({ to: "/login" });
- }
- return session;
-}
-
-// Reusable auth check as a server function
-export const getSessionFn = createServerFn({ method: "GET" }).handler(
- async ({ request }) => {
- const auth = getAuth();
- const session = await auth.api.getSession({
- headers: request.headers,
- });
- return session;
- }
-);
-
-export const getItems = createServerFn({ method: "GET" }).handler(
- async ({ request }) => {
- const session = await requireSession(request);
- const db = getDb();
- return db
- .select()
- .from(items)
- .where(eq(items.userId, session.user.id))
- .all();
- }
-);
-```
-
-## Route Loader Pattern
-
-Use server functions in route `loader` for data fetching:
-
-```typescript
-import { createFileRoute } from "@tanstack/react-router";
-import { getItems } from "../../server/functions";
-
-export const Route = createFileRoute("/_authed/items")({
- loader: () => getItems(),
- component: ItemsPage,
-});
-
-function ItemsPage() {
- const items = Route.useLoaderData();
-
- return (
- <div>
- {items.map((item) => (
- <div key={item.id}>{item.name}</div>
- ))}
- </div>
- );
-}
-```
-
-## Route beforeLoad (Auth Guard)
-
-Use `beforeLoad` on layout routes to protect groups of routes:
-
-```typescript
-import { createFileRoute, redirect } from "@tanstack/react-router";
-import { getSessionFn } from "../server/functions";
-
-export const Route = createFileRoute("/_authed")({
- beforeLoad: async () => {
- const session = await getSessionFn();
- if (!session) {
- throw redirect({ to: "/login" });
- }
- return { session };
- },
-});
-```
-
-Child routes access the session via `useRouteContext()`:
-
-```typescript
-function DashboardPage() {
- const { session } = Route.useRouteContext();
- return <h1>Welcome, {session.user.name}!</h1>;
-}
-```
-
-## Mutation + Router Invalidation
-
-After mutations, invalidate the router to refetch loader data:
-
-```typescript
-function CreateItemForm() {
- const router = useRouter();
-
- const handleSubmit = async (data: NewItem) => {
- await createItem({ data });
- router.invalidate(); // Refetches all active loaders
- router.navigate({ to: "/items" });
- };
-
- return <form onSubmit={...}>...</form>;
-}
-```
-
-## Type Safety
-
-Use Drizzle's type inference for server function input/output:
-
-```typescript
-import { items } from "../db/schema";
-import type { InferSelectModel, InferInsertModel } from "drizzle-orm";
-
-type Item = InferSelectModel<typeof items>;
-type NewItem = InferInsertModel<typeof items>;
-
-export const getItems = createServerFn({ method: "GET" }).handler(
- async (): Promise<Item[]> => {
- const db = getDb();
- return db.select().from(items).all();
- }
-);
-```
-
-## Error Handling
-
-Server functions can throw errors that propagate to the client:
-
-```typescript
-export const getItem = createServerFn({ method: "GET" })
- .inputValidator(z.object({ id: z.string() }))
- .handler(async ({ data }) => {
- const db = getDb();
- const item = await db
- .select()
- .from(items)
- .where(eq(items.id, data.id))
- .get();
-
- if (!item) {
- throw new Error("Item not found");
- }
-
- return item;
- });
-```
-
-For auth failures, always use `throw redirect()` — not error responses.
diff --git a/plugins/cloudflare/skills/vite-flare-starter/SKILL.md b/plugins/cloudflare/skills/vite-flare-starter/SKILL.md
index 30b508a7..041a79c3 100644
--- a/plugins/cloudflare/skills/vite-flare-starter/SKILL.md
+++ b/plugins/cloudflare/skills/vite-flare-starter/SKILL.md
@@ -8,20 +8,55 @@ compatibility: claude-code-only
Clone and configure the batteries-included Cloudflare starter into a standalone project. Produces a fully rebranded, deployable full-stack app.
-## What You Get
+## Stack
-| Layer | Technology |
-|-------|-----------|
-| Frontend | React 19, Vite, Tailwind v4, shadcn/ui |
-| Backend | Hono (on Cloudflare Workers) |
-| Database | D1 (SQLite at edge) + Drizzle ORM |
-| Auth | better-auth (Google OAuth + optional email/password) |
-| Storage | R2 (S3-compatible object storage) |
-| AI | Workers AI binding |
-| Data Fetching | TanStack Query |
-| Deployment | Cloudflare Workers with Static Assets |
+| Layer | Technology | Version |
+|-------|-----------|---------|
+| Frontend | React, Vite, Tailwind CSS, shadcn/ui | 19, 6.x, v4, latest |
+| Backend | Hono (on Cloudflare Workers) | 4.x |
+| Database | D1 (SQLite at edge) + Drizzle ORM | 0.38+ |
+| Auth | better-auth (Google OAuth + email/password) | latest |
+| Storage | R2 (S3-compatible object storage) | — |
+| AI | Workers AI binding | — |
+| Data Fetching | TanStack Query | v5 |
-See `references/tech-stack.md` for the full dependency list.
+### Cloudflare Bindings
+
+| Binding | Type | Purpose |
+|---------|------|---------|
+| `DB` | D1 Database | Primary application database |
+| `AVATARS` | R2 Bucket | User avatar storage |
+| `FILES` | R2 Bucket | General file uploads |
+| `AI` | Workers AI | AI model inference |
+
+### Project Structure
+
+```
+src/
+├── client/ # React frontend
+│ ├── components/ # UI components
+│ ├── hooks/ # Custom hooks + TanStack Query
+│ ├── pages/ # Route pages
+│ ├── lib/ # Utilities (auth client, etc.)
+│ └── main.tsx # App entry point
+├── server/ # Hono backend
+│ ├── index.ts # Worker entry point
+│ ├── routes/ # API routes
+│ ├── middleware/ # Auth, CORS, etc.
+│ └── db/ # Drizzle schema + queries
+└── shared/ # Shared types between client/server
+```
+
+### Key Commands
+
+| Command | Purpose |
+|---------|---------|
+| `pnpm dev` | Start local dev server |
+| `pnpm build` | Production build |
+| `pnpm deploy` | Deploy to Cloudflare |
+| `pnpm db:migrate:local` | Apply migrations locally |
+| `pnpm db:migrate:remote` | Apply migrations to production |
+| `pnpm db:generate` | Generate migration from schema changes |
## Workflow
@@ -37,33 +72,103 @@ Ask for:
### Step 2: Clone and Configure
-Perform these operations to scaffold the project. See [references/setup-pattern.md](references/setup-pattern.md) for exact replacement targets and the `.dev.vars` template.
+#### 2a. Clone and clean
-1. **Clone** the repo and remove `.git`, init fresh repo
-2. **Find-replace** `vite-flare-starter` with the project name in wrangler.jsonc (worker name, database name, R2 bucket names), package.json (name, database refs), and index.html (title, meta)
-3. **Remove** hardcoded `account_id` and replace `database_id` with placeholder in wrangler.jsonc
-4. **Reset** package.json version to `0.1.0`
-5. **Generate** `BETTER_AUTH_SECRET` using `openssl rand -hex 32` (or Python `secrets.token_hex(32)`)
-6. **Create** `.dev.vars` from template (convert kebab-case name to Title Case for display, underscore for ID)
-7. **Optionally create** Cloudflare D1 database and R2 buckets, update wrangler.jsonc with database_id
-8. **Install** dependencies with `pnpm install`
-9. **Run** local database migration with `pnpm run db:migrate:local`
-10. **Initial commit**
+```bash
+git clone https://github.com/jezweb/vite-flare-starter.git PROJECT_DIR --depth 1
+cd PROJECT_DIR
+rm -rf .git
+git init
+```
-### Step 3: Manual Configuration
+#### 2b. Find-replace targets
+
+Replace `vite-flare-starter` with the project name in these locations:
-After the script completes:
+| File | Target | Replace with |
+|------|--------|-------------|
+| `wrangler.jsonc` | `"vite-flare-starter"` (worker name) | `"PROJECT_NAME"` |
+| `wrangler.jsonc` | `vite-flare-starter-db` | `PROJECT_NAME-db` |
+| `wrangler.jsonc` | `vite-flare-starter-avatars` | `PROJECT_NAME-avatars` |
+| `wrangler.jsonc` | `vite-flare-starter-files` | `PROJECT_NAME-files` |
+| `package.json` | `"name": "vite-flare-starter"` | `"name": "PROJECT_NAME"` |
+| `package.json` | `vite-flare-starter-db` | `PROJECT_NAME-db` |
+| `index.html` | `<title>` content | App display name (Title Case) |
-1. **Google OAuth** (if using):
- - Go to [Google Cloud Console](https://console.cloud.google.com/)
- - Create OAuth 2.0 Client ID
- - Add redirect URI: `http://localhost:5173/api/auth/callback/google`
- - Copy Client ID and Secret to `.dev.vars`
+Also in `wrangler.jsonc`:
+- **Remove** hardcoded `account_id` line (let wrangler prompt or use env var)
+- **Replace** `database_id` value with `REPLACE_WITH_YOUR_DATABASE_ID`
-2. **Favicon**: Replace `public/favicon.svg` with your own
+Reset `package.json` version to `"0.1.0"`.
-3. **CLAUDE.md**: Update project description and remove vite-flare-starter references
+Use the Edit tool for replacements (preferred over sed to avoid macOS/GNU differences).
+#### 2c. Generate auth secret
+
+```bash
+BETTER_AUTH_SECRET=$(openssl rand -hex 32 2>/dev/null || python3 -c "import secrets; print(secrets.token_hex(32))")
+```
+
+#### 2d. Create .dev.vars
+
+Convert kebab-case project name: `my-cool-app` becomes Display `My Cool App`, ID `my_cool_app`.
+
+```
+# Local Development Environment Variables
+# DO NOT COMMIT THIS FILE TO GIT
+
+# Authentication (better-auth)
+BETTER_AUTH_SECRET=<generated>
+BETTER_AUTH_URL=http://localhost:5173
+
+# Google OAuth (optional)
+GOOGLE_CLIENT_ID=
+GOOGLE_CLIENT_SECRET=
+
+# Email Auth Control (disabled by default)
+# ENABLE_EMAIL_LOGIN=true
+# ENABLE_EMAIL_SIGNUP=true
+
+# Application Configuration
+APP_NAME=<Display Name>
+VITE_APP_NAME=<Display Name>
+VITE_APP_ID=<app_id>
+VITE_TOKEN_PREFIX=<app_id>_
+VITE_GITHUB_URL=
+VITE_FOOTER_TEXT=
+
+NODE_ENV=development
+```
+
+#### 2e. Create Cloudflare resources (optional)
+
+```bash
+npx wrangler d1 create PROJECT_NAME-db
+# Extract database_id from output, update wrangler.jsonc
+
+npx wrangler r2 bucket create PROJECT_NAME-avatars
+npx wrangler r2 bucket create PROJECT_NAME-files
+```
+
+#### 2f. Install and migrate
+
+```bash
+pnpm install
+pnpm run db:migrate:local
+```
+
+#### 2g. Initial commit
+
+```bash
+git add -A
+git commit -m "Initial commit from vite-flare-starter"
+```
+
+### Step 3: Manual Configuration
+
+1. **Google OAuth** (if using): Go to Google Cloud Console, create OAuth 2.0 Client ID, add redirect URI `http://localhost:5173/api/auth/callback/google`, copy Client ID and Secret to `.dev.vars`
+2. **Favicon**: Replace `public/favicon.svg`
+3. **CLAUDE.md**: Update project description, remove vite-flare-starter references
4. **index.html**: Update `<title>` and meta description
### Step 4: Verify Locally
@@ -72,10 +177,7 @@ After the script completes:
pnpm dev
```
-Check:
-- [ ] http://localhost:5173 loads
-- [ ] Shows YOUR app name, not "Vite Flare Starter"
-- [ ] Sign-up/sign-in works (if Google OAuth configured)
+Check: http://localhost:5173 loads, shows YOUR app name, sign-up/sign-in works (if OAuth configured).
### Step 5: Deploy to Production
@@ -96,33 +198,94 @@ pnpm run db:migrate:remote
pnpm run build && pnpm run deploy
```
-**Critical**: After first deploy, update BETTER_AUTH_URL with your actual Worker URL. Also add the production URL to Google OAuth redirect URIs.
+**Critical**: After first deploy, update BETTER_AUTH_URL with your actual Worker URL. Add the production URL to Google OAuth redirect URIs.
-## Common Issues
+## Security Fingerprints
-| Symptom | Cause | Fix |
-|---------|-------|-----|
-| Auth silently fails (redirect to homepage) | Missing TRUSTED_ORIGINS | Set TRUSTED_ORIGINS secret with all valid URLs |
-| "Not authorized" on deploy | Wrong account_id | Remove account_id from wrangler.jsonc or set yours |
-| Database operations fail | Using original database_id | Create YOUR database, use YOUR database_id |
-| localStorage shows "vite-flare-starter" | Missing VITE_APP_ID | Set `VITE_APP_ID=yourapp` in .dev.vars |
-| Auth fails in production | BETTER_AUTH_URL mismatch | Must match actual Worker URL exactly |
+Change all of these so attackers cannot identify your site uses this starter:
+
+| Location | Default Value | How to Change |
+|----------|---------------|---------------|
+| Page title | "Vite Flare Starter" | `index.html` |
+| App name in UI | "Vite Flare Starter" | `VITE_APP_NAME` env var |
+| localStorage keys | `vite-flare-starter-theme` | `VITE_APP_ID` env var |
+| API tokens | `vfs_` prefix | `VITE_TOKEN_PREFIX` env var |
+| GitHub links | starter repo | `VITE_GITHUB_URL` (set empty to hide) |
+| Worker name | `vite-flare-starter` | `wrangler.jsonc` |
+| Database name | `vite-flare-starter-db` | `wrangler.jsonc` |
+| R2 buckets | `vite-flare-starter-*` | `wrangler.jsonc` |
-## What Gets Rebranded
+## Environment Variables
-The setup process handles these automatically:
+### Branding (VITE_ prefix = available in frontend)
-| File | What Changes |
-|------|-------------|
-| `wrangler.jsonc` | Worker name, database name, bucket names |
-| `package.json` | Package name, database references in scripts |
-| `.dev.vars` | App name, secret, URL |
-| `index.html` | Title, meta tags |
+| Variable | Purpose | Example |
+|----------|---------|---------|
+| `VITE_APP_NAME` | Display name in UI | "My Cool App" |
+| `VITE_APP_ID` | localStorage prefix, Sentry | "mycoolapp" |
+| `VITE_TOKEN_PREFIX` | API token prefix | "mca_" |
+| `VITE_GITHUB_URL` | GitHub link (empty = hidden) | "" |
+| `VITE_FOOTER_TEXT` | Footer copyright text | "2026 My Company" |
+| `APP_NAME` | Server-side app name | "My Cool App" |
-These need manual attention:
-- `CLAUDE.md` — project description
-- `public/favicon.svg` — your favicon
-- Google OAuth — redirect URIs
-- Production secrets — via `wrangler secret put`
+### Auth
-See `references/customization-guide.md` for the complete rebranding checklist.
+| Variable | Purpose | Notes |
+|----------|---------|-------|
+| `BETTER_AUTH_SECRET` | Session encryption | `openssl rand -hex 32` |
+| `BETTER_AUTH_URL` | Auth base URL | Must match actual URL exactly |
+| `TRUSTED_ORIGINS` | Allowed origins | Comma-separated, include localhost + prod |
+| `GOOGLE_CLIENT_ID` | Google OAuth | From Google Cloud Console |
+| `GOOGLE_CLIENT_SECRET` | Google OAuth | From Google Cloud Console |
+| `ENABLE_EMAIL_LOGIN` | Enable email/password | "true" to enable |
+| `ENABLE_EMAIL_SIGNUP` | Enable email signup | Requires ENABLE_EMAIL_LOGIN |
+
+### Email (Optional)
+
+| Variable | Purpose | Notes |
+|----------|---------|-------|
+| `EMAIL_FROM` | Sender address | For verification/password reset |
+| `EMAIL_API_KEY` | Email service API key | Resend recommended |
+
+## Common Customisations
+
+### Adding a New Database Table
+1. Add schema in `src/server/db/schema.ts`
+2. Generate migration: `pnpm db:generate`
+3. Apply locally: `pnpm db:migrate:local`
+4. Apply to production: `pnpm db:migrate:remote`
+
+### Adding a New API Route
+1. Create route file in `src/server/routes/`
+2. Register in `src/server/index.ts`
+3. Add TanStack Query hook in `src/client/hooks/`
+
+### Changing Auth Providers
+Edit `src/server/auth.ts`: add provider to `socialProviders`, add credentials to `.dev.vars` and production secrets, update client-side login buttons.
+
+### Feature Flags
+Control features via environment variables: `VITE_FEATURE_STYLE_GUIDE=true`, `VITE_FEATURE_COMPONENTS=true`. Add your own in `src/client/lib/features.ts`.
+
+## Troubleshooting
+
+| Symptom | Cause | Fix |
+|---------|-------|-----|
+| Auth redirects to homepage silently | Missing TRUSTED_ORIGINS | Set TRUSTED_ORIGINS with all valid URLs |
+| "Not authorized" on deploy | Wrong account_id | Remove account_id from wrangler.jsonc or set yours |
+| Database 500 errors | Missing migrations | Run `pnpm db:migrate:local` and `pnpm db:migrate:remote` |
+| localStorage shows "vite-flare-starter" | Missing VITE_APP_ID | Set `VITE_APP_ID=yourapp` in .dev.vars |
+| Auth fails in production only | BETTER_AUTH_URL mismatch | Must match actual Worker URL exactly (https, no trailing slash) |
+| "redirect_uri_mismatch" on Google sign-in | OAuth redirect URI missing | Add production URL to Google Cloud Console OAuth redirect URIs |
+| Secret changes have no effect | Not redeployed | `wrangler secret put` does NOT redeploy. Run `pnpm deploy` after |
+
+## Production Deployment Checklist
+
+- [ ] `BETTER_AUTH_SECRET` set (different from dev!)
+- [ ] `BETTER_AUTH_URL` matches actual Worker URL
+- [ ] `TRUSTED_ORIGINS` includes all valid URLs
+- [ ] Google OAuth redirect URI includes production URL
+- [ ] Remote database migrated (`pnpm db:migrate:remote`)
+- [ ] No `vite-flare-starter` references in config files
+- [ ] Favicon replaced
+- [ ] CLAUDE.md updated
+- [ ] `.dev.vars` is NOT committed (check `.gitignore`)
diff --git a/plugins/cloudflare/skills/vite-flare-starter/references/customization-guide.md b/plugins/cloudflare/skills/vite-flare-starter/references/customization-guide.md
deleted file mode 100644
index 4748bc23..00000000
--- a/plugins/cloudflare/skills/vite-flare-starter/references/customization-guide.md
+++ /dev/null
@@ -1,140 +0,0 @@
-# Customisation Guide
-
-Complete rebranding and customisation reference for vite-flare-starter forks.
-
-## Security Fingerprints
-
-If you don't change these, attackers can identify your site uses this starter:
-
-| Location | Default Value | How to Change |
-|----------|---------------|---------------|
-| Page title | "Vite Flare Starter" | `index.html` |
-| App name in UI | "Vite Flare Starter" | `VITE_APP_NAME` env var |
-| localStorage keys | `vite-flare-starter-theme` | `VITE_APP_ID` env var |
-| API tokens | `vfs_` prefix | `VITE_TOKEN_PREFIX` env var |
-| Sentry release | `[email protected]` | `VITE_APP_ID` env var |
-| GitHub links | starter repo | `VITE_GITHUB_URL` (set empty to hide) |
-| Worker name | `vite-flare-starter` | `wrangler.jsonc` |
-| Database name | `vite-flare-starter-db` | `wrangler.jsonc` |
-| R2 buckets | `vite-flare-starter-*` | `wrangler.jsonc` |
-
-## Environment Variables
-
-### Branding Variables (VITE_ prefix = available in frontend)
-
-| Variable | Purpose | Example |
-|----------|---------|---------|
-| `VITE_APP_NAME` | Display name in UI | "My Cool App" |
-| `VITE_APP_ID` | localStorage prefix, Sentry | "mycoolapp" |
-| `VITE_TOKEN_PREFIX` | API token prefix | "mca_" |
-| `VITE_GITHUB_URL` | GitHub link (empty = hidden) | "" |
-| `VITE_FOOTER_TEXT` | Footer copyright text | "2026 My Company" |
-| `APP_NAME` | Server-side app name | "My Cool App" |
-
-### Auth Variables
-
-| Variable | Purpose | Notes |
-|----------|---------|-------|
-| `BETTER_AUTH_SECRET` | Session encryption | Generate with `openssl rand -hex 32` |
-| `BETTER_AUTH_URL` | Auth base URL | Must match actual URL exactly |
-| `TRUSTED_ORIGINS` | Allowed origins | Comma-separated, include localhost + prod |
-| `GOOGLE_CLIENT_ID` | Google OAuth | From Google Cloud Console |
-| `GOOGLE_CLIENT_SECRET` | Google OAuth | From Google Cloud Console |
-| `ENABLE_EMAIL_LOGIN` | Enable email/password | "true" to enable |
-| `ENABLE_EMAIL_SIGNUP` | Enable email signup | "true" to enable (requires ENABLE_EMAIL_LOGIN) |
-
-### Email Variables (Optional)
-
-| Variable | Purpose | Notes |
-|----------|---------|-------|
-| `EMAIL_FROM` | Sender address | For verification/password reset |
-| `EMAIL_API_KEY` | Email service API key | Resend recommended |
-
-## Common Customisations
-
-### Adding a New Database Table
-
-1. Add schema in `src/server/db/schema.ts`
-2. Generate migration: `pnpm db:generate`
-3. Apply locally: `pnpm db:migrate:local`
-4. Apply to production: `pnpm db:migrate:remote`
-
-### Adding a New API Route
-
-1. Create route file in `src/server/routes/`
-2. Register in `src/server/index.ts`
-3. Add TanStack Query hook in `src/client/hooks/`
-
-### Changing Auth Providers
-
-better-auth supports multiple providers. Edit `src/server/auth.ts`:
-- Add provider to `socialProviders`
-- Add credentials to `.dev.vars` and production secrets
-- Update client-side login buttons
-
-### Custom Theme
-
-Edit Tailwind theme in `src/client/index.css`:
-- Update CSS variables in `:root` and `.dark`
-- Use `tailwind-theme-builder` skill for guided setup
-
-### Feature Flags
-
-Control features via environment variables:
-- `VITE_FEATURE_STYLE_GUIDE=true` — enable style guide page
-- `VITE_FEATURE_COMPONENTS=true` — enable component showcase
-- Add your own in `src/client/lib/features.ts`
-
-## Production Deployment Checklist
-
-- [ ] `BETTER_AUTH_SECRET` set (different from dev!)
-- [ ] `BETTER_AUTH_URL` matches actual Worker URL
-- [ ] `TRUSTED_ORIGINS` includes all valid URLs
-- [ ] Google OAuth redirect URI includes production URL
-- [ ] Remote database migrated (`pnpm db:migrate:remote`)
-- [ ] No `vite-flare-starter` references in config files
-- [ ] Favicon replaced
-- [ ] CLAUDE.md updated
-- [ ] `.dev.vars` is NOT committed (check `.gitignore`)
-
-## Common Mistakes
-
-### 1. TRUSTED_ORIGINS Not Set
-
-**Symptom**: User signs in but gets redirected to homepage (auth cookie not accepted).
-
-**Fix**:
-```bash
-echo "http://localhost:5173,https://your-app.workers.dev" | npx wrangler secret put TRUSTED_ORIGINS
-```
-
-### 2. BETTER_AUTH_URL Mismatch
-
-**Symptom**: Auth fails in production but works locally.
-
-**Fix**: The URL must match exactly — including protocol (`https://`) and no trailing slash.
-
-### 3. Database Migrations Not Applied
-
-**Symptom**: API returns 500 errors on database operations.
-
-**Fix**: Run both local and remote migrations:
-```bash
-pnpm db:migrate:local
-pnpm db:migrate:remote
-```
-
-### 4. Secrets Set But Not Deployed
-
-**Symptom**: Changes to secrets don't take effect.
-
-**Fix**: Setting a secret via `wrangler secret put` does NOT automatically redeploy. Run `pnpm deploy` after.
-
-### 5. Google OAuth Redirect URI Missing
-
-**Symptom**: "Error 400: redirect_uri_mismatch" when signing in with Google.
-
-**Fix**: Add your production URL to Google Cloud Console > OAuth Client > Authorised redirect URIs:
-```
-https://your-app.workers.dev/api/auth/callback/google
-```
diff --git a/plugins/cloudflare/skills/vite-flare-starter/references/setup-pattern.md b/plugins/cloudflare/skills/vite-flare-starter/references/setup-pattern.md
deleted file mode 100644
index 5eac7228..00000000
--- a/plugins/cloudflare/skills/vite-flare-starter/references/setup-pattern.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# Vite Flare Starter Setup Pattern
-
-Reference for the operations Claude performs when scaffolding a new project from
-vite-flare-starter. Adapt to the user's environment.
-
-## Step 1: Clone and Clean
-
-```bash
-git clone https://github.com/jezweb/vite-flare-starter.git PROJECT_DIR --depth 1
-cd PROJECT_DIR
-rm -rf .git
-git init
-```
-
-## Step 2: Find-Replace Targets
-
-Replace `vite-flare-starter` with the project name in these locations:
-
-| File | Target | Replace with | Notes |
-|------|--------|-------------|-------|
-| `wrangler.jsonc` | `"vite-flare-starter"` (worker name) | `"PROJECT_NAME"` | |
-| `wrangler.jsonc` | `vite-flare-starter-db` | `PROJECT_NAME-db` | Database name |
-| `wrangler.jsonc` | `vite-flare-starter-avatars` | `PROJECT_NAME-avatars` | R2 bucket |
-| `wrangler.jsonc` | `vite-flare-starter-files` | `PROJECT_NAME-files` | R2 bucket |
-| `package.json` | `"name": "vite-flare-starter"` | `"name": "PROJECT_NAME"` | |
-| `package.json` | `vite-flare-starter-db` | `PROJECT_NAME-db` | In scripts |
-| `index.html` | `<title>` content | App display name | Title Case |
-
-Also in `wrangler.jsonc`:
-- **Remove** hardcoded `account_id` line (let wrangler prompt or use env var)
-- **Replace** `database_id` value with `REPLACE_WITH_YOUR_DATABASE_ID`
-- **Reset** `package.json` version to `"0.1.0"`
-
-## Step 3: Generate Auth Secret
-
-```bash
-# Prefer openssl, fall back to Python
-BETTER_AUTH_SECRET=$(openssl rand -hex 32 2>/dev/null || python3 -c "import secrets; print(secrets.token_hex(32))")
-```
-
-## Step 4: Create .dev.vars
-
-Convert kebab-case project name to display name and app ID:
-- `my-cool-app` → Display: `My Cool App`, ID: `my_cool_app`
-
-```
-# Local Development Environment Variables
-# DO NOT COMMIT THIS FILE TO GIT
-
-# Authentication (better-auth)
-BETTER_AUTH_SECRET=<generated>
-BETTER_AUTH_URL=http://localhost:5173
-
-# Google OAuth (optional)
-GOOGLE_CLIENT_ID=
-GOOGLE_CLIENT_SECRET=
-
-# Email Auth Control (disabled by default)
-# ENABLE_EMAIL_LOGIN=true
-# ENABLE_EMAIL_SIGNUP=true
-
-# Application Configuration
-APP_NAME=<Display Name>
-VITE_APP_NAME=<Display Name>
-VITE_APP_ID=<app_id>
-VITE_TOKEN_PREFIX=<app_id>_
-VITE_GITHUB_URL=
-VITE_FOOTER_TEXT=
-
-NODE_ENV=development
-```
-
-## Step 5: Update index.html
-
-Replace `<title>` and meta description content with the display name.
-
-## Step 6: Create Cloudflare Resources (Optional)
-
-```bash
-# D1 database
-npx wrangler d1 create PROJECT_NAME-db
-# Extract database_id from output, update wrangler.jsonc
-
-# R2 buckets
-npx wrangler r2 bucket create PROJECT_NAME-avatars
-npx wrangler r2 bucket create PROJECT_NAME-files
-```
-
-## Step 7: Install and Migrate
-
-```bash
-pnpm install
-pnpm run db:migrate:local
-```
-
-## Step 8: Initial Commit
-
-```bash
-git add -A
-git commit -m "Initial commit from vite-flare-starter"
-```
-
-## macOS sed Note
-
-macOS `sed -i` requires an extension argument: `sed -i '' 's/old/new/g' file`.
-GNU `sed -i` does not. Claude should detect the platform and adjust, or use
-the Edit tool directly (preferred — avoids sed entirely).
diff --git a/plugins/cloudflare/skills/vite-flare-starter/references/tech-stack.md b/plugins/cloudflare/skills/vite-flare-starter/references/tech-stack.md
deleted file mode 100644
index 1b5794fa..00000000
--- a/plugins/cloudflare/skills/vite-flare-starter/references/tech-stack.md
+++ /dev/null
@@ -1,91 +0,0 @@
-# Tech Stack Reference
-
-Complete dependency list for vite-flare-starter.
-
-## Core Stack
-
-| Technology | Version | Purpose |
-|-----------|---------|---------|
-| React | 19 | UI framework |
-| Vite | 6.x | Build tool + dev server |
-| Hono | 4.x | Backend API framework (on Workers) |
-| Cloudflare Workers | — | Runtime + deployment |
-| D1 | — | Edge SQLite database |
-| Drizzle ORM | 0.38+ | Type-safe database queries |
-| better-auth | latest | Authentication (Google OAuth + email/password) |
-| Tailwind CSS | v4 | Styling |
-| shadcn/ui | latest | UI component library |
-| TanStack Query | v5 | Server state management |
-
-## Runtime Dependencies
-
-| Package | Purpose |
-|---------|---------|
-| `react`, `react-dom` | UI rendering |
-| `hono` | API routes and middleware |
-| `better-auth` | Auth (server + client) |
-| `drizzle-orm` | Database ORM |
-| `@tanstack/react-query` | Data fetching + caching |
-| `react-hook-form` | Form handling |
-| `@hookform/resolvers` | Form validation |
-| `zod` | Schema validation |
-| `react-router-dom` | Client-side routing |
-| `@radix-ui/*` | Headless UI primitives (shadcn/ui) |
-| `tailwind-merge` | Tailwind class merging |
-| `class-variance-authority` | Variant styling |
-| `clsx` | Conditional classnames |
-| `lucide-react` | Icon library |
-| `sonner` | Toast notifications |
-| `date-fns` | Date formatting |
-
-## Dev Dependencies
-
-| Package | Purpose |
-|---------|---------|
-| `@cloudflare/vite-plugin` | Workers + Vite integration |
-| `wrangler` | Cloudflare CLI |
-| `drizzle-kit` | Database migrations |
-| `typescript` | Type checking |
-| `@tailwindcss/vite` | Tailwind v4 Vite plugin |
-| `vitest` | Testing |
-| `eslint` | Linting |
-
-## Cloudflare Bindings
-
-| Binding | Type | Purpose |
-|---------|------|---------|
-| `DB` | D1 Database | Primary application database |
-| `AVATARS` | R2 Bucket | User avatar storage |
-| `FILES` | R2 Bucket | General file uploads |
-| `AI` | Workers AI | AI model inference |
-
-## Project Structure
-
-```
-src/
-├── client/ # React frontend
-│ ├── components/ # UI components
-│ ├── hooks/ # Custom hooks + TanStack Query
-│ ├── pages/ # Route pages
-│ ├── lib/ # Utilities (auth client, etc.)
-│ └── main.tsx # App entry point
-├── server/ # Hono backend
-│ ├── index.ts # Worker entry point
-│ ├── routes/ # API routes
-│ ├── middleware/ # Auth, CORS, etc.
-│ └── db/ # Drizzle schema + queries
-└── shared/ # Shared types between client/server
-```
-
-## Key Commands
-
-| Command | Purpose |
-|---------|---------|
-| `pnpm dev` | Start local dev server |
-| `pnpm build` | Production build |
-| `pnpm deploy` | Deploy to Cloudflare |
-| `pnpm db:migrate:local` | Apply migrations locally |
-| `pnpm db:migrate:remote` | Apply migrations to production |
-| `pnpm db:generate` | Generate migration from schema changes |
-| `pnpm test` | Run tests |
-| `pnpm lint` | Run linter |
diff --git a/plugins/frontend/skills/design-loop/SKILL.md b/plugins/frontend/skills/design-loop/SKILL.md
index 54ef8a1c..bf866f78 100644
--- a/plugins/frontend/skills/design-loop/SKILL.md
+++ b/plugins/frontend/skills/design-loop/SKILL.md
@@ -33,8 +33,6 @@ This is orchestration-agnostic. The loop can be driven by:
## Generation Backends
-The loop supports two generation backends:
-
| Backend | Setup | Quality | Speed | Best for |
|---------|-------|---------|-------|----------|
| **Claude** (default) | Zero dependencies | Great — production-ready HTML/Tailwind | Fast | Most projects, full code control |
@@ -50,32 +48,42 @@ At the start of each loop, check if Stitch is available:
If all three are present, use Stitch. Otherwise, fall back to Claude generation.
-### Using Stitch SDK
+### Stitch SDK Reference
-See `references/stitch-sdk.md` for the full SDK reference. Quick usage:
+Install: `npm install @google/stitch-sdk`. Set `STITCH_API_KEY` in environment or `.dev.vars`.
```typescript
import { stitch } from "@google/stitch-sdk";
-// Create or reference a project
-const project = stitch.project(projectId);
+// Create a project
+const result = await stitch.callTool("create_project", { title: "My Site" });
+
+// Reference an existing project
+const project = stitch.project("4044680601076201931");
-// Generate a screen from the baton prompt
-const screen = await project.generate(batonPrompt, "DESKTOP");
+// Generate a screen
+const screen = await project.generate("A modern landing page with hero section", "DESKTOP");
-// Get the HTML and screenshot
-const htmlUrl = await screen.getHtml();
-const imageUrl = await screen.getImage();
+// Get assets
+const htmlUrl = await screen.getHtml(); // Download URL for HTML
+const imageUrl = await screen.getImage(); // Download URL for screenshot
-// Download both
-// HTML → .design/designs/{page}.html → then process into site/public/{page}.html
-// Screenshot → .design/screenshots/{page}.png
+// Edit an existing screen (prefer this for refinements)
+const edited = await screen.edit("Make the background dark and enlarge the CTA button");
+
+// Generate variants
+const variants = await screen.variants("Try different colour schemes", {
+ variantCount: 3,
+ creativeRange: "EXPLORE", // "REFINE" | "EXPLORE" | "REIMAGINE"
+ aspects: ["COLOR_SCHEME"], // "LAYOUT" | "COLOR_SCHEME" | "IMAGES" | "TEXT_FONT" | "TEXT_CONTENT"
+});
```
-When using Stitch, the generated HTML may need post-processing:
-- Extract and reuse your project's header/nav/footer (Stitch generates standalone pages)
-- Ensure Tailwind config matches your DESIGN.md
-- Wire internal navigation links
+Device types: `"MOBILE"` | `"DESKTOP"` | `"TABLET"` | `"AGNOSTIC"`. Model selection: pass `"GEMINI_3_PRO"` | `"GEMINI_3_FLASH"` as third arg to `generate()`.
+
+Other operations: `stitch.projects()` lists projects, `project.screens()` lists screens, `project.getScreen("id")` fetches one.
+
+`getHtml()` and `getImage()` return download URLs. Append `=w1280` to image URLs for full resolution. Auth: `STITCH_API_KEY` required (or `STITCH_ACCESS_TOKEN` + `GOOGLE_CLOUD_PROJECT` for OAuth). Errors throw `StitchError` with codes: `AUTH_FAILED`, `NOT_FOUND`, `RATE_LIMITED`.
### Stitch Project Persistence
@@ -91,7 +99,11 @@ Save Stitch identifiers to `.design/metadata.json` so future iterations can refe
}
```
-Use `screen.edit(prompt)` for iterative refinements on existing screens rather than regenerating from scratch.
+Stitch integration tips:
+1. Persist project ID in `.design/metadata.json` — don't create a new project each iteration
+2. Use `screen.edit()` for refinements rather than full regeneration
+3. Post-process Stitch HTML — replace headers/footers with your shared elements
+4. Include DESIGN.md context in prompts — Stitch generates better results with explicit design system instructions
## Getting Started
@@ -118,7 +130,7 @@ project/
└── public/ # Production pages live here
```
-3. **Write SITE.md** from the template in `references/site-template.md`
+3. **Write SITE.md** from the template in the "SITE.md Template" section below
4. **Write DESIGN.md** — either manually from user input, or use the `design-system` skill to extract from an existing site
5. **Write the first baton** (`.design/next-prompt.md`) for the homepage
@@ -197,8 +209,8 @@ If Stitch SDK is available:
1. Build the prompt by combining the baton body with the DESIGN.md system block
2. Call `project.generate(prompt, deviceType)` to generate the screen
-3. Download the HTML from `screen.getHtml()` → save to `.design/designs/{page}.html`
-4. Download the screenshot from `screen.getImage()` → save to `.design/screenshots/{page}.png`
+3. Download the HTML from `screen.getHtml()` to `.design/designs/{page}.html`
+4. Download the screenshot from `screen.getImage()` to `.design/screenshots/{page}.png`
5. Post-process the Stitch HTML:
- Replace the header/nav/footer with your project's shared elements
- Ensure consistent Tailwind config
@@ -283,6 +295,212 @@ The #1 risk in multi-page generation is **drift** — pages looking slightly dif
| **Font imports** | Same Google Fonts `<link>` tag across all pages |
| **Spacing scale** | Consistent padding/margin values (document in DESIGN.md) |
+## Design Mappings
+
+Use these to transform vague user requests into precise design instructions when writing baton prompts.
+
+### UI/UX Keyword Refinement
+
+| Vague Term | Professional Terminology |
+|:---|:---|
+| "menu at the top" | "sticky navigation bar with logo and menu items" |
+| "big photo" | "full-width hero section with focal-point imagery" |
+| "list of things" | "responsive card grid with hover states and subtle elevation" |
+| "button" | "primary call-to-action button with hover transition" |
+| "form" | "form with labelled input fields, validation states, and submit button" |
+| "picture area" | "hero section with background image or video" |
+| "sidebar" | "collapsible side navigation with icon-label pairings" |
+| "popup" | "modal dialog with overlay and smooth entry animation" |
+| "footer stuff" | "footer with sitemap links, contact info, and legal notices" |
+| "cards" | "content cards with consistent padding, rounded corners, and shadow" |
+| "tabs" | "tabbed interface with active indicator and smooth content transition" |
+| "search" | "search input with icon, placeholder text, and results dropdown" |
+| "pricing" | "pricing comparison cards with highlighted recommended tier" |
+| "testimonials" | "testimonial carousel or grid with avatar, quote, and attribution" |
+
+### Atmosphere and Vibe Descriptors
+
+| Basic Vibe | Enhanced Description |
+|:---|:---|
+| "Modern" | "Clean, minimal, generous whitespace, high-contrast typography" |
+| "Professional" | "Sophisticated, trustworthy, subtle shadows, restricted premium palette" |
+| "Fun / Playful" | "Vibrant, rounded corners, bold accent colours, bouncy animations" |
+| "Dark Mode" | "High-contrast accents on deep slate or near-black backgrounds" |
+| "Luxury" | "Elegant, spacious, fine lines, serif headers, high-fidelity photography" |
+| "Tech / Cyber" | "Futuristic, neon accents, glassmorphism, monospaced typography" |
+| "Warm / Friendly" | "Soft colours, rounded shapes, handwritten accents, inviting imagery" |
+| "Bold / Industrial" | "Strong typography, high contrast, geometric shapes, dark backgrounds" |
+| "Organic / Natural" | "Earth tones, soft textures, organic shapes, nature photography" |
+| "Editorial" | "Magazine-like layouts, strong typographic hierarchy, generous leading" |
+
+### Geometry, Depth, and Spacing
+
+| Description | Tailwind | Visual Effect |
+|:---|:---|:---|
+| Pill-shaped | `rounded-full` | Buttons, tags, badges |
+| Softly rounded | `rounded-xl` | Cards, containers, modals |
+| Gently rounded | `rounded-lg` | Inputs, smaller elements |
+| Sharp / precise | `rounded-none` or `rounded-sm` | Technical, brutalist aesthetic |
+| Glassmorphism | `backdrop-blur-md bg-white/10 border border-white/20` | Overlays, nav bars |
+| Frosted | `backdrop-blur-sm bg-white/80` | Subtle glass effect |
+
+| Elevation | Description | Tailwind |
+|:---|:---|:---|
+| Flat | No shadows, colour blocking and borders | `shadow-none` |
+| Whisper-soft | Diffused, barely visible lift | `shadow-sm` |
+| Subtle | Gentle shadow for card elevation | `shadow-md` |
+| Floating | High-offset, soft shadow | `shadow-lg` or `shadow-xl` |
+| Dramatic | Strong shadow for hero elements or modals | `shadow-2xl` |
+| Inset | Inner shadow for pressed or nested elements | `shadow-inner` |
+
+| Section Density | Description | Tailwind |
+|:---|:---|:---|
+| Tight | Compact, information-dense | `py-8 md:py-12` |
+| Balanced | Standard section spacing | `py-12 md:py-16` |
+| Generous | Breathing room, premium feel | `py-16 md:py-24` |
+| Dramatic | Statement spacing, luxury/editorial | `py-24 md:py-32` |
+
+## SITE.md Template
+
+Use this when bootstrapping a new project. Write to `.design/SITE.md`:
+
+```markdown
+# Project Vision
+
+> **AGENT INSTRUCTION:** Read this file before every iteration. It is the project's long-term memory.
+
+## 1. Core Identity
+
+| Field | Value |
+|-------|-------|
+| **Project Name** | [Name] |
+| **Mission** | [What the site achieves] |
+| **Target Audience** | [Who uses this site] |
+| **Voice & Tone** | [Personality descriptors — warm, professional, playful, etc.] |
+| **Region** | [Australia / US / UK — affects spelling, phone format, imagery] |
+
+## 2. Visual Language
+
+Reference these when writing baton prompts.
+
+- **Primary Vibe**: [Main aesthetic — e.g. "Clean and modern"]
+- **Secondary Vibe**: [Supporting aesthetic — e.g. "Warm and approachable"]
+- **Anti-Vibes**: [What to avoid — e.g. "Not corporate, not cluttered"]
+
+## 3. Technical Setup
+
+- **Output Directory**: `site/public/`
+- **CSS**: Tailwind CSS via CDN (no build step)
+- **Dark Mode**: [Yes/No] — if yes, via class toggle
+- **Fonts**: [Google Fonts import URL]
+
+## 4. Live Sitemap
+
+Update this when a page is successfully generated.
+
+- [x] `index.html` — Homepage with hero, features, CTA
+- [ ] `about.html` — Company story and team
+- [ ] `services.html` — Service offerings with pricing
+- [ ] `contact.html` — Contact form and location map
+
+## 5. Roadmap (Backlog)
+
+Pick the next task from here. Remove items as they're completed.
+
+### High Priority
+- [ ] Build about page with team section
+- [ ] Build services page with pricing cards
+
+### Medium Priority
+- [ ] Build contact page with form
+- [ ] Build FAQ page
+
+### Low Priority
+- [ ] Blog index page
+- [ ] Individual blog post template
+
+## 6. Creative Freedom
+
+When the roadmap is empty, follow these guidelines to add pages:
+
+1. **Stay on-brand** — new pages must fit the established vibe
+2. **Enhance the core** — support the site mission
+3. **Naming convention** — lowercase, descriptive filenames (e.g. `team.html`)
+
+### Ideas to Explore
+- [ ] `testimonials.html` — Customer reviews and case studies
+- [ ] `gallery.html` — Project portfolio with image grid
+- [ ] `faq.html` — Frequently asked questions with accordion
+
+## 7. Rules of Engagement
+
+1. Do NOT recreate pages already marked `[x]` in Section 4
+2. ALWAYS update `.design/next-prompt.md` before completing an iteration
+3. Remove consumed ideas from Section 6
+4. Copy header/nav/footer from existing pages — never regenerate
+5. All internal links must point to real pages
+```
+
+## DESIGN.md Template
+
+Generate using the `design-system` skill, or create manually. Write to `.design/DESIGN.md`:
+
+```markdown
+# Design System: [Project Name]
+
+## 1. Visual Theme & Atmosphere
+
+[Describe the mood, density, and aesthetic philosophy. Use evocative language.]
+
+## 2. Colour Palette & Roles
+
+| Role | Name | Value | Usage |
+|------|------|-------|-------|
+| Primary | [Name] | `#hexcode` | Buttons, links, active states |
+| Primary Foreground | [Name] | `#hexcode` | Text on primary backgrounds |
+| Secondary | [Name] | `#hexcode` | Supporting elements, badges |
+| Background | [Name] | `#hexcode` | Page background |
+| Surface | [Name] | `#hexcode` | Cards, containers |
+| Text Primary | [Name] | `#hexcode` | Headings, body text |
+| Text Secondary | [Name] | `#hexcode` | Captions, metadata |
+| Border | [Name] | `#hexcode` | Dividers, input borders |
+| Accent | [Name] | `#hexcode` | Highlights, notifications |
+
+## 3. Typography
+
+| Element | Font | Weight | Size | Line Height |
+|---------|------|--------|------|-------------|
+| H1 | [Font] | 700 | 3rem | 1.1 |
+| H2 | [Font] | 600 | 2rem | 1.2 |
+| H3 | [Font] | 600 | 1.5rem | 1.3 |
+| Body | [Font] | 400 | 1rem | 1.6 |
+| Small | [Font] | 400 | 0.875rem | 1.5 |
+
+## 4. Component Styles
+
+Document each component: Buttons (primary, secondary, hover), Cards (bg, border, radius, shadow, padding), Navigation (sticky/static, active indicator, mobile pattern), Forms (input style, labels, validation colours).
+
+## 5. Layout Principles
+
+Max content width, section padding, grid system, whitespace philosophy.
+
+## 6. Design System Notes for Generation
+
+**Copy this entire block into every baton prompt:**
+
+**DESIGN SYSTEM (REQUIRED):**
+- Platform: Web, Desktop-first, responsive
+- Theme: [Light/Dark], [descriptors]
+- Background: [Description] (#hex)
+- Surface: [Description] (#hex)
+- Primary: [Description] (#hex) for [role]
+- Text: [Description] (#hex)
+- Font: [Font name] via Google Fonts
+- Corners: [Description]
+- Shadows: [Description]
+- Spacing: [Description]
+```
+
## File Structure
```
@@ -291,17 +509,10 @@ project/
│ ├── SITE.md # Project vision, sitemap, roadmap
│ ├── DESIGN.md # Visual design system (source of truth)
│ ├── next-prompt.md # The baton — current/next task
+│ ├── metadata.json # Stitch project/screen IDs (if using Stitch)
│ └── screenshots/ # Visual verification captures
-│ ├── index-desktop.png
-│ ├── index-mobile.png
-│ ├── about-desktop.png
-│ └── about-mobile.png
├── site/
│ └── public/ # Production pages
-│ ├── index.html
-│ ├── about.html
-│ ├── services.html
-│ └── contact.html
└── .gitignore # Add .design/screenshots/
```
@@ -316,9 +527,9 @@ project/
## Common Pitfalls
-- ❌ Forgetting to update `.design/next-prompt.md` (breaks the loop)
-- ❌ Recreating a page that already exists in the sitemap
-- ❌ Regenerating the header/nav instead of copying from existing pages
-- ❌ Not including the design system block in the baton prompt
-- ❌ Leaving `href="#"` placeholder links instead of real page URLs
-- ❌ Inconsistent Tailwind config across pages
+- Forgetting to update `.design/next-prompt.md` (breaks the loop)
+- Recreating a page that already exists in the sitemap
+- Regenerating the header/nav instead of copying from existing pages
+- Not including the design system block in the baton prompt
+- Leaving `href="#"` placeholder links instead of real page URLs
+- Inconsistent Tailwind config across pages
diff --git a/plugins/frontend/skills/design-loop/references/design-mappings.md b/plugins/frontend/skills/design-loop/references/design-mappings.md
deleted file mode 100644
index b9854f26..00000000
--- a/plugins/frontend/skills/design-loop/references/design-mappings.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# Design Mappings & Descriptors
-
-Use these mappings to transform vague user requests into precise design instructions.
-
-## UI/UX Keyword Refinement
-
-| Vague Term | Professional Terminology |
-|:---|:---|
-| "menu at the top" | "sticky navigation bar with logo and menu items" |
-| "big photo" | "full-width hero section with focal-point imagery" |
-| "list of things" | "responsive card grid with hover states and subtle elevation" |
-| "button" | "primary call-to-action button with hover transition" |
-| "form" | "form with labelled input fields, validation states, and submit button" |
-| "picture area" | "hero section with background image or video" |
-| "sidebar" | "collapsible side navigation with icon-label pairings" |
-| "popup" | "modal dialog with overlay and smooth entry animation" |
-| "footer stuff" | "footer with sitemap links, contact info, and legal notices" |
-| "cards" | "content cards with consistent padding, rounded corners, and shadow" |
-| "tabs" | "tabbed interface with active indicator and smooth content transition" |
-| "search" | "search input with icon, placeholder text, and results dropdown" |
-| "pricing" | "pricing comparison cards with highlighted recommended tier" |
-| "testimonials" | "testimonial carousel or grid with avatar, quote, and attribution" |
-
-## Atmosphere & Vibe Descriptors
-
-| Basic Vibe | Enhanced Description |
-|:---|:---|
-| "Modern" | "Clean, minimal, generous whitespace, high-contrast typography" |
-| "Professional" | "Sophisticated, trustworthy, subtle shadows, restricted premium palette" |
-| "Fun / Playful" | "Vibrant, rounded corners, bold accent colours, bouncy animations" |
-| "Dark Mode" | "High-contrast accents on deep slate or near-black backgrounds" |
-| "Luxury" | "Elegant, spacious, fine lines, serif headers, high-fidelity photography" |
-| "Tech / Cyber" | "Futuristic, neon accents, glassmorphism, monospaced typography" |
-| "Warm / Friendly" | "Soft colours, rounded shapes, handwritten accents, inviting imagery" |
-| "Bold / Industrial" | "Strong typography, high contrast, geometric shapes, dark backgrounds" |
-| "Organic / Natural" | "Earth tones, soft textures, organic shapes, nature photography" |
-| "Editorial" | "Magazine-like layouts, strong typographic hierarchy, generous leading" |
-
-## Geometry & Shape Language
-
-| Description | Tailwind Class | Visual Effect |
-|:---|:---|:---|
-| Pill-shaped | `rounded-full` | Buttons, tags, badges |
-| Softly rounded | `rounded-xl` (12px) | Cards, containers, modals |
-| Gently rounded | `rounded-lg` (8px) | Inputs, smaller elements |
-| Sharp / precise | `rounded-none` or `rounded-sm` | Technical, brutalist aesthetic |
-| Glassmorphism | `backdrop-blur-md bg-white/10 border border-white/20` | Overlays, nav bars |
-| Frosted | `backdrop-blur-sm bg-white/80` | Subtle glass effect |
-
-## Depth & Elevation
-
-| Level | Description | Tailwind |
-|:---|:---|:---|
-| Flat | No shadows, focus on colour blocking and borders | `shadow-none` |
-| Whisper-soft | Diffused, barely visible lift | `shadow-sm` |
-| Subtle | Gentle shadow for card elevation | `shadow-md` |
-| Floating | High-offset, soft shadow — element appears lifted | `shadow-lg` or `shadow-xl` |
-| Dramatic | Strong shadow for hero elements or modals | `shadow-2xl` |
-| Inset | Inner shadow for pressed or nested elements | `shadow-inner` |
-
-## Section Spacing Scale
-
-| Density | Description | Tailwind |
-|:---|:---|:---|
-| Tight | Compact, information-dense | `py-8 md:py-12` |
-| Balanced | Standard section spacing | `py-12 md:py-16` |
-| Generous | Breathing room, premium feel | `py-16 md:py-24` |
-| Dramatic | Statement spacing, luxury/editorial | `py-24 md:py-32` |
diff --git a/plugins/frontend/skills/design-loop/references/site-template.md b/plugins/frontend/skills/design-loop/references/site-template.md
deleted file mode 100644
index cb1d4478..00000000
--- a/plugins/frontend/skills/design-loop/references/site-template.md
+++ /dev/null
@@ -1,182 +0,0 @@
-# Site Template
-
-Use these templates when bootstrapping a new design loop project.
-
-## SITE.md Template
-
-```markdown
-# Project Vision
-
-> **AGENT INSTRUCTION:** Read this file before every iteration. It is the project's long-term memory.
-
-## 1. Core Identity
-
-| Field | Value |
-|-------|-------|
-| **Project Name** | [Name] |
-| **Mission** | [What the site achieves] |
-| **Target Audience** | [Who uses this site] |
-| **Voice & Tone** | [Personality descriptors — warm, professional, playful, etc.] |
-| **Region** | [Australia / US / UK — affects spelling, phone format, imagery] |
-
-## 2. Visual Language
-
-Reference these when writing baton prompts.
-
-- **Primary Vibe**: [Main aesthetic — e.g. "Clean and modern"]
-- **Secondary Vibe**: [Supporting aesthetic — e.g. "Warm and approachable"]
-- **Anti-Vibes**: [What to avoid — e.g. "Not corporate, not cluttered"]
-
-## 3. Technical Setup
-
-- **Output Directory**: `site/public/`
-- **CSS**: Tailwind CSS via CDN (no build step)
-- **Dark Mode**: [Yes/No] — if yes, via class toggle
-- **Fonts**: [Google Fonts import URL]
-
-## 4. Live Sitemap
-
-Update this when a page is successfully generated.
-
-- [x] `index.html` — Homepage with hero, features, CTA
-- [ ] `about.html` — Company story and team
-- [ ] `services.html` — Service offerings with pricing
-- [ ] `contact.html` — Contact form and location map
-
-## 5. Roadmap (Backlog)
-
-Pick the next task from here. Remove items as they're completed.
-
-### High Priority
-- [ ] Build about page with team section
-- [ ] Build services page with pricing cards
-
-### Medium Priority
-- [ ] Build contact page with form
-- [ ] Build FAQ page
-
-### Low Priority
-- [ ] Blog index page
-- [ ] Individual blog post template
-
-## 6. Creative Freedom
-
-When the roadmap is empty, follow these guidelines to add pages:
-
-1. **Stay on-brand** — new pages must fit the established vibe
-2. **Enhance the core** — support the site mission
-3. **Naming convention** — lowercase, descriptive filenames (e.g. `team.html`)
-
-### Ideas to Explore
-- [ ] `testimonials.html` — Customer reviews and case studies
-- [ ] `gallery.html` — Project portfolio with image grid
-- [ ] `faq.html` — Frequently asked questions with accordion
-
-## 7. Rules of Engagement
-
-1. Do NOT recreate pages already marked `[x]` in Section 4
-2. ALWAYS update `.design/next-prompt.md` before completing an iteration
-3. Remove consumed ideas from Section 6
-4. Copy header/nav/footer from existing pages — never regenerate
-5. All internal links must point to real pages
-```
-
-## DESIGN.md Template
-
-Generate this using the `design-system` skill, or create manually:
-
-```markdown
-# Design System: [Project Name]
-
-## 1. Visual Theme & Atmosphere
-
-[Describe the mood, density, and aesthetic philosophy. Use evocative language.]
-
-Example: "Airy and modern with generous whitespace. Warm undertones soften the
-minimal layout. Typography does the heavy lifting — large, confident headings
-with understated body text."
-
-## 2. Colour Palette & Roles
-
-| Role | Name | Value | Usage |
-|------|------|-------|-------|
-| Primary | [Descriptive Name] | `#hexcode` | Buttons, links, active states |
-| Primary Foreground | [Name] | `#hexcode` | Text on primary backgrounds |
-| Secondary | [Name] | `#hexcode` | Supporting elements, badges |
-| Background | [Name] | `#hexcode` | Page background |
-| Surface | [Name] | `#hexcode` | Cards, containers |
-| Text Primary | [Name] | `#hexcode` | Headings, body text |
-| Text Secondary | [Name] | `#hexcode` | Captions, metadata |
-| Border | [Name] | `#hexcode` | Dividers, input borders |
-| Accent | [Name] | `#hexcode` | Highlights, notifications |
-
-### Dark Mode (if applicable)
-
-| Role | Light Value | Dark Value |
-|------|-------------|------------|
-| Background | `#hexcode` | `#hexcode` |
-| Surface | `#hexcode` | `#hexcode` |
-| Text Primary | `#hexcode` | `#hexcode` |
-
-## 3. Typography
-
-| Element | Font | Weight | Size | Line Height |
-|---------|------|--------|------|-------------|
-| H1 | [Font Family] | 700 | 3rem / 48px | 1.1 |
-| H2 | [Font Family] | 600 | 2rem / 32px | 1.2 |
-| H3 | [Font Family] | 600 | 1.5rem / 24px | 1.3 |
-| Body | [Font Family] | 400 | 1rem / 16px | 1.6 |
-| Small | [Font Family] | 400 | 0.875rem / 14px | 1.5 |
-
-Google Fonts import:
-```html
-<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
-```
-
-## 4. Component Styles
-
-### Buttons
-- **Primary**: [Background colour], [text colour], [border-radius], [padding]
-- **Secondary**: [Outline style], [hover behaviour]
-- **Hover**: [Transition description — e.g. "darken 10%, subtle lift shadow"]
-
-### Cards
-- **Background**: [Surface colour]
-- **Border**: [1px border-colour or none]
-- **Border Radius**: [e.g. 12px / rounded-xl]
-- **Shadow**: [e.g. "whisper-soft diffused shadow" or "none"]
-- **Padding**: [e.g. 1.5rem]
-
-### Navigation
-- **Style**: [Sticky/static], [background treatment]
-- **Active indicator**: [Underline, background, colour change]
-- **Mobile**: [Hamburger menu, slide-out drawer, bottom nav]
-
-### Forms
-- **Input style**: [Border, background, border-radius, focus ring]
-- **Labels**: [Position, weight, colour]
-- **Validation**: [Error colour, success colour, message placement]
-
-## 5. Layout Principles
-
-- **Max content width**: [e.g. 1200px / max-w-7xl]
-- **Section padding**: [e.g. py-16 md:py-24]
-- **Grid**: [e.g. 12-column, gap-8]
-- **Whitespace philosophy**: [Generous / compact / balanced]
-
-## 6. Design System Notes for Generation
-
-**Copy this entire block into every baton prompt:**
-
-**DESIGN SYSTEM (REQUIRED):**
-- Platform: Web, Desktop-first, responsive
-- Theme: [Light/Dark], [descriptors]
-- Background: [Description] (#hex)
-- Surface: [Description] (#hex)
-- Primary: [Description] (#hex) for [role]
-- Text: [Description] (#hex)
-- Font: [Font name] via Google Fonts
-- Corners: [Description — e.g. "Softly rounded, 12px"]
-- Shadows: [Description — e.g. "Whisper-soft diffused shadows"]
-- Spacing: [Description — e.g. "Generous whitespace, py-16 sections"]
-```
diff --git a/plugins/frontend/skills/design-loop/references/stitch-sdk.md b/plugins/frontend/skills/design-loop/references/stitch-sdk.md
deleted file mode 100644
index 7c85b388..00000000
--- a/plugins/frontend/skills/design-loop/references/stitch-sdk.md
+++ /dev/null
@@ -1,139 +0,0 @@
-# Google Stitch SDK Reference
-
-`@google/stitch-sdk` — generate UI screens from text prompts and extract HTML + screenshots.
-
-## Install
-
-```bash
-npm install @google/stitch-sdk
-```
-
-Set `STITCH_API_KEY` in your environment or `.dev.vars`.
-
-## Quick Start
-
-```typescript
-import { stitch } from "@google/stitch-sdk";
-
-// Create a project
-const result = await stitch.callTool("create_project", { title: "My Site" });
-
-// Reference an existing project
-const project = stitch.project("4044680601076201931");
-
-// Generate a screen
-const screen = await project.generate("A modern landing page with hero section", "DESKTOP");
-
-// Get assets
-const htmlUrl = await screen.getHtml(); // Download URL for HTML
-const imageUrl = await screen.getImage(); // Download URL for screenshot
-
-// Edit an existing screen
-const edited = await screen.edit("Make the background dark and enlarge the CTA button");
-
-// Generate variants
-const variants = await screen.variants("Try different colour schemes", {
- variantCount: 3,
- creativeRange: "EXPLORE", // "REFINE" | "EXPLORE" | "REIMAGINE"
- aspects: ["COLOR_SCHEME"], // "LAYOUT" | "COLOR_SCHEME" | "IMAGES" | "TEXT_FONT" | "TEXT_CONTENT"
-});
-```
-
-## Device Types
-
-`"MOBILE"` | `"DESKTOP"` | `"TABLET"` | `"AGNOSTIC"`
-
-## Model Selection
-
-```typescript
-// Default model
-const screen = await project.generate(prompt, "DESKTOP");
-
-// Specific model
-const screen = await project.generate(prompt, "DESKTOP", "GEMINI_3_PRO");
-// Options: "GEMINI_3_PRO" | "GEMINI_3_FLASH"
-```
-
-## Project Management
-
-```typescript
-// List all projects
-const projects = await stitch.projects();
-
-// Get screens in a project
-const screens = await project.screens();
-
-// Get a specific screen
-const screen = await project.getScreen("screenId");
-```
-
-## Tool Client (Low-Level)
-
-For direct MCP tool access:
-
-```typescript
-const tools = await stitch.listTools();
-const result = await stitch.callTool("generate_screen_from_text", {
- projectId: "123",
- prompt: "A dashboard with charts",
- deviceType: "DESKTOP",
-});
-```
-
-## Downloading Assets
-
-The `getHtml()` and `getImage()` methods return download URLs. Fetch with curl or node:
-
-```bash
-# Download HTML
-curl -L -o .design/designs/index.html "$(htmlUrl)"
-
-# Download screenshot (append =w{width} for full resolution)
-curl -L -o .design/screenshots/index.png "${imageUrl}=w1280"
-```
-
-## Authentication
-
-| Variable | Required | Description |
-|----------|----------|-------------|
-| `STITCH_API_KEY` | Yes (or OAuth) | API key |
-| `STITCH_ACCESS_TOKEN` | No | OAuth access token (alternative) |
-| `GOOGLE_CLOUD_PROJECT` | With OAuth | GCP project ID |
-
-## Error Handling
-
-```typescript
-import { StitchError } from "@google/stitch-sdk";
-
-try {
- const screen = await project.generate(prompt);
-} catch (error) {
- if (error instanceof StitchError) {
- console.error(error.code); // AUTH_FAILED, NOT_FOUND, RATE_LIMITED, etc.
- console.error(error.message);
- }
-}
-```
-
-## Vercel AI SDK Integration
-
-```typescript
-import { generateText, stepCountIs } from "ai";
-import { google } from "@ai-sdk/google";
-import { stitchTools } from "@google/stitch-sdk/ai";
-
-const { text, steps } = await generateText({
- model: google("gemini-2.5-flash"),
- tools: stitchTools(),
- prompt: "Create a project and generate a modern dashboard",
- stopWhen: stepCountIs(5),
-});
-```
-
-## Tips for Design Loop Integration
-
-1. **Persist project ID** in `.design/metadata.json` — don't create a new project each iteration
-2. **Use `screen.edit()`** for refinements rather than full regeneration
-3. **Post-process Stitch HTML** — replace headers/footers with your shared elements
-4. **Screenshot URLs need width suffix** — append `=w1280` for full resolution (Google CDN serves thumbnails by default)
-5. **Include DESIGN.md context in prompts** — Stitch generates better results with explicit design system instructions
diff --git a/plugins/integrations/skills/google-chat-messages/SKILL.md b/plugins/integrations/skills/google-chat-messages/SKILL.md
index c1467a8b..27b3c3e0 100644
--- a/plugins/integrations/skills/google-chat-messages/SKILL.md
+++ b/plugins/integrations/skills/google-chat-messages/SKILL.md
@@ -88,48 +88,222 @@ const message = {
};
```
-### Widget Types
+## Widget Reference
+
+All widget types available in cardsV2 sections.
+
+### textParagraph
+
+Formatted text block. Supports Google Chat formatting (`*bold*`, `_italic_`, `<url|text>`).
-**Text paragraph** — formatted text block:
```typescript
-{ textParagraph: { text: '*Bold* and _italic_ text' } }
+{
+ textParagraph: {
+ text: '*Status*: All systems operational\n_Last checked_: 5 minutes ago'
+ }
+}
```
-**Decorated text** — label + value with optional icon:
+### decoratedText
+
+Labelled value with optional icons. Most versatile widget for key-value data.
+
+**Basic:**
+```typescript
+{
+ decoratedText: {
+ topLabel: 'Environment',
+ text: 'Production',
+ bottomLabel: 'Last deployed 2h ago'
+ }
+}
+```
+
+**With start icon:**
```typescript
{
decoratedText: {
topLabel: 'Status',
- text: 'Deployed',
+ text: 'Healthy',
startIcon: { knownIcon: 'STAR' }
}
}
```
-**Button list** — action buttons:
+**With custom icon URL:**
+```typescript
+{
+ decoratedText: {
+ topLabel: 'GitHub',
+ text: 'PR #142 merged',
+ startIcon: {
+ iconUrl: 'https://github.githubassets.com/favicons/favicon.svg',
+ altText: 'GitHub'
+ }
+ }
+}
+```
+
+**With button:**
+```typescript
+{
+ decoratedText: {
+ topLabel: 'Alert',
+ text: 'CPU at 95%',
+ button: {
+ text: 'View',
+ onClick: { openLink: { url: 'https://monitoring.example.com' } }
+ }
+ }
+}
+```
+
+**Clickable (whole widget):**
+```typescript
+{
+ decoratedText: {
+ text: 'View full report',
+ wrapText: true,
+ onClick: { openLink: { url: 'https://reports.example.com' } }
+ }
+}
+```
+
+**With wrap text:**
+```typescript
+{
+ decoratedText: {
+ topLabel: 'Description',
+ text: 'This is a longer description that should wrap to multiple lines instead of being truncated',
+ wrapText: true
+ }
+}
+```
+
+### buttonList
+
+One or more action buttons. Buttons open URLs or trigger actions.
+
+**Single button:**
```typescript
{
buttonList: {
buttons: [{
- text: 'View Dashboard',
+ text: 'Open Dashboard',
onClick: { openLink: { url: 'https://dashboard.example.com' } }
}]
}
}
```
-**Image** — standalone image:
+**Multiple buttons:**
+```typescript
+{
+ buttonList: {
+ buttons: [
+ {
+ text: 'Approve',
+ onClick: { openLink: { url: 'https://app.example.com/approve/123' } },
+ color: { red: 0, green: 0.5, blue: 0, alpha: 1 }
+ },
+ {
+ text: 'Reject',
+ onClick: { openLink: { url: 'https://app.example.com/reject/123' } }
+ }
+ ]
+ }
+}
+```
+
+**Button with icon:**
+```typescript
+{
+ buttonList: {
+ buttons: [{
+ text: 'View on GitHub',
+ icon: { knownIcon: 'BOOKMARK' },
+ onClick: { openLink: { url: 'https://github.com/org/repo/pull/42' } }
+ }]
+ }
+}
+```
+
+### image
+
+Standalone image widget.
+
```typescript
-{ image: { imageUrl: 'https://example.com/chart.png', altText: 'Usage chart' } }
+{
+ image: {
+ imageUrl: 'https://example.com/chart.png',
+ altText: 'Monthly usage chart'
+ }
+}
```
-**Divider** — horizontal separator:
+### divider
+
+Horizontal line separator between widgets.
+
```typescript
{ divider: {} }
```
-See `references/widget-reference.md` for all widget types with full examples.
-See `references/icon-list.md` for all available knownIcon values.
+### Collapsible Sections
+
+Sections can be collapsed with only the first N widgets visible:
+
+```typescript
+{
+ header: 'Details',
+ collapsible: true,
+ uncollapsibleWidgetsCount: 2, // Show first 2, collapse rest
+ widgets: [
+ { decoratedText: { topLabel: 'Status', text: 'Active' } },
+ { decoratedText: { topLabel: 'Region', text: 'AU' } },
+ // These start collapsed
+ { decoratedText: { topLabel: 'Instance', text: 'prod-01' } },
+ { decoratedText: { topLabel: 'Memory', text: '2.1 GB' } },
+ { decoratedText: { topLabel: 'CPU', text: '45%' } }
+ ]
+}
+```
+
+## Known Icons
+
+Icons available via `knownIcon` in decoratedText and button widgets.
+
+```typescript
+{ startIcon: { knownIcon: 'STAR' } }
+// or
+{ icon: { knownIcon: 'EMAIL' } }
+```
+
+| Icon Name | Use For |
+|-----------|---------|
+| `AIRPLANE` | Travel, flights |
+| `BOOKMARK` | Save, reference, links |
+| `BUS` | Transport, transit |
+| `CAR` | Driving, transport |
+| `CLOCK` | Time, duration, schedule |
+| `CONFIRMATION_NUMBER_ICON` | Tickets, bookings |
+| `DESCRIPTION` | Documents, files |
+| `DOLLAR` | Money, pricing, cost |
+| `EMAIL` | Email, messages |
+| `INVITE` | Invitations |
+| `MAP_PIN` | Location, address |
+| `MEMBERSHIP` | Members, users |
+| `MULTIPLE_PEOPLE` | Teams, groups |
+| `OFFER` | Deals, promotions |
+| `PERSON` | Individual user |
+| `PHONE` | Phone number, calls |
+| `SHOPPING_CART` | Commerce, purchases |
+| `STAR` | Rating, favourite, important |
+| `STORE` | Shop, retail |
+| `TICKET` | Tickets, events |
+| `VIDEO_CAMERA` | Video, meetings |
+
+For icons not in the list, use `iconUrl` with any publicly accessible image (square, ideally 24x24 or 48x48 pixels).
## Threading
@@ -199,12 +373,6 @@ const digest = buildCard({
});
```
-### Simple Text Alert
-
-```typescript
-await sendText(webhookUrl, `*Alert*: CPU usage above 90% on \`worker-prod-1\`\n<${alertUrl}|View Alert>`);
-```
-
## Error Prevention
| Mistake | Fix |
diff --git a/plugins/integrations/skills/google-chat-messages/references/icon-list.md b/plugins/integrations/skills/google-chat-messages/references/icon-list.md
deleted file mode 100644
index 80f417e6..00000000
--- a/plugins/integrations/skills/google-chat-messages/references/icon-list.md
+++ /dev/null
@@ -1,65 +0,0 @@
-# Google Chat Known Icons
-
-Icons available via `knownIcon` in decoratedText and button widgets.
-
-## Usage
-
-```typescript
-{ startIcon: { knownIcon: 'STAR' } }
-// or
-{ icon: { knownIcon: 'EMAIL' } }
-```
-
-## Available Icons
-
-| Icon Name | Use For |
-|-----------|---------|
-| `AIRPLANE` | Travel, flights |
-| `BOOKMARK` | Save, reference, links |
-| `BUS` | Transport, transit |
-| `CAR` | Driving, transport |
-| `CLOCK` | Time, duration, schedule |
-| `CONFIRMATION_NUMBER_ICON` | Tickets, bookings |
-| `DESCRIPTION` | Documents, files |
-| `DOLLAR` | Money, pricing, cost |
-| `EMAIL` | Email, messages |
-| `EVENT_PERFORMER` | People, performers |
-| `EVENT_SEAT` | Seating, capacity |
-| `FLIGHT_ARRIVAL` | Arrivals, incoming |
-| `FLIGHT_DEPARTURE` | Departures, outgoing |
-| `HOTEL` | Accommodation |
-| `HOTEL_ROOM_TYPE` | Room types |
-| `INVITE` | Invitations |
-| `MAP_PIN` | Location, address |
-| `MEMBERSHIP` | Members, users |
-| `MULTIPLE_PEOPLE` | Teams, groups |
-| `OFFER` | Deals, promotions |
-| `PERSON` | Individual user |
-| `PHONE` | Phone number, calls |
-| `RESTAURANT_ICON` | Food, dining |
-| `SHOPPING_CART` | Commerce, purchases |
-| `STAR` | Rating, favourite, important |
-| `STORE` | Shop, retail |
-| `TICKET` | Tickets, events |
-| `TRAIN` | Rail transport |
-| `VIDEO_CAMERA` | Video, meetings |
-| `VIDEO_PLAY` | Play, media |
-
-## Custom Icons
-
-For icons not in the list, use `iconUrl` with any publicly accessible image:
-
-```typescript
-{
- startIcon: {
- iconUrl: 'https://example.com/custom-icon.png',
- altText: 'Custom icon description'
- }
-}
-```
-
-Icon images should be square, ideally 24x24 or 48x48 pixels.
-
-## Material Design Icons
-
-Google Chat's knownIcons are a subset of Material Design icons. For a broader selection, use `iconUrl` pointing to Material Design icon SVGs or your own icon assets.
diff --git a/plugins/integrations/skills/google-chat-messages/references/widget-reference.md b/plugins/integrations/skills/google-chat-messages/references/widget-reference.md
deleted file mode 100644
index 0e413515..00000000
--- a/plugins/integrations/skills/google-chat-messages/references/widget-reference.md
+++ /dev/null
@@ -1,212 +0,0 @@
-# Google Chat Widget Reference
-
-All widget types available in cardsV2 sections.
-
-## textParagraph
-
-Formatted text block. Supports Google Chat formatting (`*bold*`, `_italic_`, `<url|text>`).
-
-```typescript
-{
- textParagraph: {
- text: '*Status*: All systems operational\n_Last checked_: 5 minutes ago'
- }
-}
-```
-
-## decoratedText
-
-Labelled value with optional icons. Most versatile widget for key-value data.
-
-### Basic
-
-```typescript
-{
- decoratedText: {
- topLabel: 'Environment',
- text: 'Production',
- bottomLabel: 'Last deployed 2h ago'
- }
-}
-```
-
-### With Start Icon
-
-```typescript
-{
- decoratedText: {
- topLabel: 'Status',
- text: 'Healthy',
- startIcon: { knownIcon: 'STAR' }
- }
-}
-```
-
-### With Custom Icon URL
-
-```typescript
-{
- decoratedText: {
- topLabel: 'GitHub',
- text: 'PR #142 merged',
- startIcon: {
- iconUrl: 'https://github.githubassets.com/favicons/favicon.svg',
- altText: 'GitHub'
- }
- }
-}
-```
-
-### With Button
-
-```typescript
-{
- decoratedText: {
- topLabel: 'Alert',
- text: 'CPU at 95%',
- button: {
- text: 'View',
- onClick: { openLink: { url: 'https://monitoring.example.com' } }
- }
- }
-}
-```
-
-### Clickable (Whole Widget)
-
-```typescript
-{
- decoratedText: {
- text: 'View full report',
- wrapText: true,
- onClick: { openLink: { url: 'https://reports.example.com' } }
- }
-}
-```
-
-### With Wrap Text
-
-```typescript
-{
- decoratedText: {
- topLabel: 'Description',
- text: 'This is a longer description that should wrap to multiple lines instead of being truncated',
- wrapText: true
- }
-}
-```
-
-## buttonList
-
-One or more action buttons. Buttons open URLs or trigger actions.
-
-### Single Button
-
-```typescript
-{
- buttonList: {
- buttons: [{
- text: 'Open Dashboard',
- onClick: { openLink: { url: 'https://dashboard.example.com' } }
- }]
- }
-}
-```
-
-### Multiple Buttons
-
-```typescript
-{
- buttonList: {
- buttons: [
- {
- text: 'Approve',
- onClick: { openLink: { url: 'https://app.example.com/approve/123' } },
- color: { red: 0, green: 0.5, blue: 0, alpha: 1 }
- },
- {
- text: 'Reject',
- onClick: { openLink: { url: 'https://app.example.com/reject/123' } }
- }
- ]
- }
-}
-```
-
-### Button with Icon
-
-```typescript
-{
- buttonList: {
- buttons: [{
- text: 'View on GitHub',
- icon: { knownIcon: 'BOOKMARK' },
- onClick: { openLink: { url: 'https://github.com/org/repo/pull/42' } }
- }]
- }
-}
-```
-
-## image
-
-Standalone image widget.
-
-```typescript
-{
- image: {
- imageUrl: 'https://example.com/chart.png',
- altText: 'Monthly usage chart'
- }
-}
-```
-
-## divider
-
-Horizontal line separator between widgets.
-
-```typescript
-{ divider: {} }
-```
-
-## Collapsible Sections
-
-Sections can be collapsed with only the first N widgets visible:
-
-```typescript
-{
- header: 'Details',
- collapsible: true,
- uncollapsibleWidgetsCount: 2, // Show first 2, collapse rest
- widgets: [
- // First 2 always visible
- { decoratedText: { topLabel: 'Status', text: 'Active' } },
- { decoratedText: { topLabel: 'Region', text: 'AU' } },
- // These start collapsed
- { decoratedText: { topLabel: 'Instance', text: 'prod-01' } },
- { decoratedText: { topLabel: 'Memory', text: '2.1 GB' } },
- { decoratedText: { topLabel: 'CPU', text: '45%' } }
- ]
-}
-```
-
-## Combining Widgets
-
-A typical card section combining multiple widget types:
-
-```typescript
-{
- header: 'Deployment Summary',
- widgets: [
- { textParagraph: { text: '*Production deployment complete*' } },
- { divider: {} },
- { decoratedText: { topLabel: 'Version', text: 'v2.3.1', startIcon: { knownIcon: 'STAR' } } },
- { decoratedText: { topLabel: 'Duration', text: '2m 34s', startIcon: { knownIcon: 'CLOCK' } } },
- { decoratedText: { topLabel: 'Commit', text: '`abc1234` Fix auth redirect' } },
- { divider: {} },
- { buttonList: { buttons: [
- { text: 'View Logs', onClick: { openLink: { url: 'https://logs.example.com' } } },
- { text: 'Rollback', onClick: { openLink: { url: 'https://deploy.example.com/rollback' } } }
- ]}}
- ]
-}
-```