1---
2name: new-project
3description: Spin up a new project from the meirlabs homebase. Use when the user says "new project", "start a project", "bootstrap a project", or wants to scaffold an app with the standard stack (Next.js + ui-kit + Supabase + PostHog + Hugeicons). Runs discovery, writes an approved PLAN.md first, then scaffolds, applies the design system, wires analytics, wires tests (Vitest + Playwright + CI), writes docs, and optionally creates a private GitHub repo. Does not build until the plan is approved.
4---
5
6# New Project
7
8Bootstrap a new project from the meirlabs homebase so you never start from scratch.
9
10Homebase root: `~/Documents/business/meirlabs/meirlabs`
11Default project location: `~/Documents/business/projects/in-development/<name>`. The starter's
12`@meir-labs/ui-kit` file: dependency path is relative, so the scaffolder must compute it from
13wherever the project actually lands, not assume a fixed depth: from `in-development` that path
14is `file:../../../meirlabs/product/ui-kit`.
15
16**Do not write any code or scaffold anything until the plan (Step 2) is approved.** Understand
17the project first, produce a great plan, get a yes, then build.
18
19## Step 1 — Discovery (understand the project)
20
21**Check the project's origin first.** The /projects/new dashboard is an AI intake wizard
22(rewritten 2026-06-25): its only Supabase write (`/api/start`) inserts `projects` rows already at
23status `building` — with a plan, the intake answers, a created GitHub repo, and a dispatched cloud
24build. Dashboard-originated projects therefore arrive with a full `PLAN.md` and a live repo: pick
25them up from there (clone the repo, read `PLAN.md`) rather than re-running discovery. No flow
26leaves rows at status `planning`, so `scripts/get-brief.mjs` (which queries `status=planning`)
27finds nothing for new work.
28
29A fully local/manual start — the user describing an idea in a session — is the path that actually
30goes through this skill's discovery and planning gate.
31
32First get the **brief** in the user's own words. If they already described the project when
33invoking, use that; otherwise ask them to describe the idea in a sentence or two (this one is
34open-ended — a plain prompt is fine here).
35
36Then nail down the decisions with the AskUserQuestion tool (batched, options-based, up to 4 per
37call — run a second round if needed). Cover, as relevant to the idea:
38- **Primary user** — who is this for? (offer the most likely personas for this idea)
39- **MVP cut** — what's the smallest first version? (offer scope options from lean → fuller)
40- **Must-have features** — the P0 capabilities (multiSelect)
41- **Monetization** — free / subscription / usage / not yet
42- **Auth & data needs** — drives the Supabase decision
43- **Design vibe** — drives the design-applier (SaaS dashboard vs. marketing-forward, etc.)
44
45Confirm the project **name** (kebab-case) and **location** (default
46`~/Documents/business/projects/in-development/<name>`).
47
48## Step 2 — Plan (and get approval — gate before building)
49
50Hand the brief + all answers to the **planner** agent (`agents/planner.md`). It writes a strong
51`PLAN.md` into the target dir (problem, users, MVP scope, prioritized features, key flows, data
52model, stack decisions, analytics taxonomy, milestones, risks).
53
54Present the plan to the user. **Iterate until they approve it.** Use ExitPlanMode or an explicit
55confirmation — do not proceed to scaffolding without a clear yes. The plan also settles the build
56config below, so confirm those toggles as part of approval:
57- **Stack** — SaaS app (App Router) [default] · Landing/marketing · Minimal Next.js
58- **Supabase?** · **PostHog?** · **Create private GitHub repo?** (pre-fill from the plan's recommendations)
59
60## Step 3 — Scaffold
61
62Two paths (both are supported — pick based on the user's preference; default to local copy):
63- **Local copy** (default): the `scaffolder` agent copies `starters/nextjs-saas/` into the target.
64- **From GitHub template**: `gh repo create <name> --private --template xmeir-dev/meirlabs-starter --clone`,
65 then continue from the clone.
66
67Run the **scaffolder** agent (`agents/scaffolder.md`): copy template, replace `__PROJECT_NAME__`,
68fix the `@meir-labs/ui-kit` path, set up `.npmrc`, prune disabled features, install deps. The
69scaffolder preserves the existing `PLAN.md` in the target.
70
71**Register in the tracker:** ensure a row for this project exists in the meirlabs Supabase
72`projects` table (dashboard-originated projects already have a row at status `building`). Upsert via
73the REST API using `SUPABASE_URL` + `SUPABASE_SERVICE_ROLE_KEY` from `.env.sync` — set `repo_path`
74to the target path and `status` to `building` (then `live` once it ships). After building, run
75`node scripts/sync-projects.mjs` to populate git-derived time/cost. The dashboard reads this live.
76
77## Step 4 — Pipeline (run these agents in order, each builds on the last)
78
79Every agent in this step reads `<target>/PLAN.md` first and builds toward it — not a generic app.
80
811. **design-applier** (`agents/design-applier.md`) — apply DESIGN-SAAS tokens, build the base layout
82 and the key screens from the plan's user flows, verify icons. The starter already ships the
83 **`web-performance`** skill's `next.config.ts` perf defaults and `@next/bundle-analyzer` — keep
84 them intact and follow the skill's `next/image` + font conventions; the only perf wiring left
85 on a new project is the Lighthouse-CI / bundle-size guard (`references/ci.md`).
862. **analytics-wirer** (`agents/analytics-wirer.md`) — wire PostHog per the standard, implementing the
87 plan's event taxonomy (skip/remove if disabled).
883. **test-wirer** (`agents/test-wirer.md`) — the starter ships the **`testing`** skill's baseline
89 (Vitest + Testing Library + Playwright, sample tests, CI workflow); keep it intact. This stage
90 replaces the samples with real tests for the screens and logic the earlier stages actually built
91 from the plan, and confirms both suites run green. Runs after design-applier and analytics-wirer.
924. **docs-writer** (`agents/docs-writer.md`) — write project CLAUDE.md / AGENTS.md / README, linking PLAN.md.
93
94For speed you may run design-applier and analytics-wirer concurrently (they touch different files),
95then test-wirer, then docs-writer last. If using the Workflow tool, `workflows/new-project.js`
96encodes this pipeline.
97
98## Step 5 — Verify
99
100Run the build/typecheck (`pnpm build` or `npm run build`) **and the test suites** (`npm run test`,
101then `npm run test:e2e`). All three must be green — a red test blocks the ship the same way a
102broken build does (see the **`testing`** skill). Report failures verbatim; fix obvious wiring
103issues before continuing.
104
105## Step 6 — Ship
106
107If GitHub was requested and not already created via template:
108```
109cd <target> && git init && git add -A && git commit -m "Initial scaffold from meirlabs starter"
110gh repo create <name> --private --source=. --push
111```
112Then `open` the project (and the GitHub URL). Commit `PLAN.md` with the initial scaffold.
113
114The starter's `.github/workflows/ci.yml` runs typecheck + tests on every push. For it to install
115deps it needs the Hugeicons secret on the repo: `gh secret set HUGEICONS_TOKEN` (value is in
116`~/.zshrc`). Do this right after `gh repo create`, or the first CI run fails on install.
117
118## Step 7 — Report
119
120Summarize: location, repo URL, what was built against the plan, and the manual steps left
121(Hugeicons token in `.npmrc`, fill `.env.local` with Supabase/PostHog keys). Point to `PLAN.md`
122and the milestones as the next steps.
123
124## Notes
125- Never commit secrets. `.env.local` stays local; only `.env.example` is tracked — see the **`security-audit`** skill for the full `NEXT_PUBLIC_` rule.
126- Before the project goes live (or any auth/API-route/DB work lands), run the **`security-audit`** skill on it — it catches unauthenticated routes, RLS gaps, and leaked secrets before they reach production.
127- Speed is a starting constraint, not a launch-day rescue. Follow the **`web-performance`** skill: the starter bakes in its `next.config.ts` perf defaults + bundle analyzer; wire its Lighthouse-CI / bundle-size guard before ship so regressions fail loud. Calibrated to `design/foundation/performance.md`.
128- The starter consumes `@meir-labs/ui-kit` from `~/Documents/business/meirlabs/product/ui-kit`.
129- Honor all rules in `design/ui-preferences.md` and the global `config/CLAUDE.md`.
130