Project Bootstrap Orchestrator
Execute bootstrap in strict order. Do not run migrations or development server until project linking and environment verification are complete.
When to Use
Use this skill when:
- Setting up a freshly cloned repository that depends on Vercel-linked resources (Postgres, Auth, Blob, Edge Config, Upstash, etc.).
- Repairing a repo whose environment or database state is broken or incomplete.
- You detect
.env.example,.env.sample,.env.template,drizzle.config.*,prisma/schema.prisma,auth.*, ornext-forgeworkspace markers. - The user asks to "bootstrap", "set up", "link", "pull env", or "get the project running".
- Bash patterns like
vercel link,vercel env pull,npm run db:push, ornpm run devappear in instructions.
Prerequisites
- Vercel CLI installed and authenticated (
vercel --version,vercel whoami). - Node.js runtime available for secret generation (
node -e). - Package manager detected from repo lockfiles (
package-lock.json→ npm,pnpm-workspace.yaml→ pnpm,bun.lockb→ bun,yarn.lock→ yarn). - Windows host (primary): PowerShell is the default shell. Commands below are POSIX-style for cross-platform Vercel CLI and Node; adapt quoting for PowerShell where noted. The library path on the authoring machine is
~\agent-skills\library\bootstrap\SKILL.md.
Procedure
0. Hard Rules (do not violate)
- Never run
db:push,db:migrate,db:seed, ordevuntil Vercel linking is complete and env keys are verified. - Prefer Vercel-managed provisioning (
vercel integration ...) for shared resources. Use provider CLIs only as fallback when the Vercel integration flow is unavailable. - Never echo secret values in terminal output, logs, or summaries. Key names only.
- Never delete
.env.localor.vercel/project.jsonwithout explicit user confirmation. - Use the repository's package manager (
npm,pnpm,bun, oryarn) and run only scripts that exist inpackage.json.
1. Preflight — Vercel CLI & Linkage
- Confirm Vercel CLI is installed and authenticated:
vercel --version
vercel whoami
- Confirm repo linkage by checking
.vercel/project.json:
cat .vercel/project.json
- If not linked, inspect available teams/projects before asking the user to choose:
vercel teams ls
vercel projects ls --scope <team>
vercel link --yes --scope <team> --project <project>
Find the env template in priority order:
.env.example,.env.sample,.env.template.Create local env file if missing:
cp .env.example .env.local
PowerShell note: Use
Copy-Item .env.example .env.localifcpis not aliased.
2. Resource Setup — Postgres (Neon)
Preferred path (Vercel-managed Neon)
- Read integration setup guidance:
vercel integration guide neon
- Add Neon integration to the Vercel scope:
vercel integration add neon --scope <team>
- Verify expected environment variable names exist in Vercel and pull locally:
vercel env ls
vercel env pull .env.local --yes
Fallback path 1 (Dashboard)
- Provision Neon through the Vercel dashboard integration UI.
- Re-run
vercel env pull .env.local --yes.
Fallback path 2 (Neon CLI)
Use Neon CLI only when Vercel-managed provisioning is unavailable. After creating resources, add required env vars in Vercel and pull again:
vercel env pull .env.local --yes
3. AUTH_SECRET Generation
Generate a high-entropy secret without printing it, then store it in Vercel and refresh local env:
AUTH_SECRET="$(node -e "console.log(require('node:crypto').randomBytes(32).toString('base64url'))")"
printf "%s" "$AUTH_SECRET" | vercel env add AUTH_SECRET development preview production
unset AUTH_SECRET
vercel env pull .env.local --yes
PowerShell note: The above uses POSIX subshell syntax. In PowerShell, generate and pipe differently:
$secret = node -e "console.log(require('node:crypto').randomBytes(32).toString('base64url'))" $secret | vercel env add AUTH_SECRET development preview production Remove-Variable secret vercel env pull .env.local --yes
4. Env Verification
Compare required keys from the template file against .env.local keys (names only, never values):
template_file=""
for candidate in .env.example .env.sample .env.template; do
if [ -f "$candidate" ]; then
template_file="$candidate"
break
fi
done
comm -23 \
<(grep -E '^[A-Za-z_][A-Za-z0-9_]*=' "$template_file" | cut -d '=' -f 1 | sort -u) \
<(grep -E '^[A-Za-z_][A-Za-z0-9_]*=' .env.local | cut -d '=' -f 1 | sort -u)
Proceed only when the missing key list is empty. If keys are missing, add them in Vercel and re-pull.
5. App Setup — Database & Dev
After linkage + env verification:
npm run db:push
npm run db:seed
npm run dev
Replace npm with the repo's package manager. Run only scripts that exist in package.json (check db:push, db:seed, db:migrate, db:generate as applicable).
6. UI Baseline for Next.js + shadcn Projects
After linkage and env verification, establish the UI foundation before feature work:
- Add a baseline primitive set:
npx shadcn@latest add button card input label textarea select switch tabs dialog alert-dialog sheet dropdown-menu badge separator skeleton table
- Apply the Geist font fix in
layout.tsxandglobals.css. - Confirm the app shell uses
bg-background text-foreground. - Default to dark mode for product, admin, and AI apps unless the repo is clearly marketing-first.
7. next-forge Projects
If the project was scaffolded with npx next-forge init (detected by pnpm-workspace.yaml + packages/auth + packages/database + @repo/* imports):
- Env files are per-app (
apps/app/.env.local,apps/web/.env.local,apps/api/.env.local) pluspackages/database/.env. - Run
pnpm migrate(notdb:push) — it runsprisma format+prisma generate+prisma db push. - Minimum env vars:
DATABASE_URL,CLERK_SECRET_KEY,NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,NEXT_PUBLIC_APP_URL,NEXT_PUBLIC_WEB_URL,NEXT_PUBLIC_API_URL. - Optional services (Stripe, Resend, PostHog, etc.) can be skipped initially — but remove their
@repo/*imports from appenv.tsfiles to avoid validation errors. - Deploy as 3 separate Vercel projects with root directories
apps/app,apps/api,apps/web.
Related skill:
next-forge— Full next-forge monorepo guide.
Pitfalls
- Running db commands before linking/env verification — violates hard rules; can write to wrong database or fail silently. Always complete steps 1–4 first.
- Echoing secret values — never print
AUTH_SECRETor any secret value. Use key names only in summaries and logs. - Wrong package manager — using
npmin a pnpm/bun workspace causes phantom dependencies and lockfile conflicts. Detect from lockfiles. - next-forge
db:pushvspnpm migrate— next-forge repos must usepnpm migrate; runningdb:pushdirectly skipsprisma formatandprisma generate. - Optional service env validation — next-forge
env.tsfiles validate imported@repo/*packages. If you skip Stripe/Resend/PostHog, remove their imports or the app will crash on boot. - Multiple
.env.localfiles in monorepos — each app needs its own env file; a root.env.localis insufficient. - Vercel integration not available — fall back to dashboard or provider CLI, but always re-run
vercel env pull .env.local --yesafter manual provisioning. - PowerShell quoting — POSIX subshells
$(...)and process substitution<(...)do not work in PowerShell; adapt as noted. - Deleting
.vercel/project.json— never delete without explicit user confirmation; it breaks linkage and requires re-linking.
Verification
Confirm each checkpoint before declaring bootstrap complete:
- Vercel auth:
vercel whoamisucceeds (prints username). - Linkage:
.vercel/project.jsonexists and matches chosen project:
cat .vercel/project.json
- Postgres integration: one path completed (Vercel integration, dashboard, or provider CLI fallback).
- Env pull:
vercel env pull .env.local --yessucceeds (exit code 0). - Required env key diff is empty:
comm -23 \
<(grep -E '^[A-Za-z_][A-Za-z0-9_]*=' .env.example | cut -d '=' -f 1 | sort -u) \
<(grep -E '^[A-Za-z_][A-Za-z0-9_]*=' .env.local | cut -d '=' -f 1 | sort -u)
Output must be empty.
- Database commands: status recorded (
db:push,db:seed,db:migrate,db:generateas applicable). - Dev server:
npm run dev(or equivalent) starts without immediate config/auth/env failure.
If verification fails, stop and report the exact failing step plus remediation guidance.
Summary Format
Return a final bootstrap summary in this format:
## Bootstrap Result
- **Linked Project**: <team>/<project>
- **Resource Path**: vercel-integration-neon | dashboard-neon | neon-cli
- **Env Keys**: <count> required, <count> present, <count> missing
- **Secrets**: AUTH_SECRET set in Vercel (value never shown)
- **Migration Status**: not-run | success | failed (<step>)
- **Dev Result**: not-run | started | failed
Bootstrap Next Steps
- If env keys are still missing, add the missing keys in Vercel and re-run
vercel env pull .env.local --yes. - If DB commands fail, fix connectivity/schema issues and re-run only the failed db step.
- If
devfails, resolve runtime errors, then restart with your package manager'srun dev.