init-neon
Skill18 starsChanged 58 days agoMITView on GitHub
Configure the Neon Postgres database for AI Workflow (run registry, dispatch state, workflow definitions) via the Vercel Marketplace. Verifies DATABASE_URL is injected per environment, that environments do not share a branch (the engine canary excepted), and that migrations apply. Use for "set up neon", "set up postgres", "configure database", "fix run registry", "env_marker error".
- Reads credentials
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- packages/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- packages/CLAUDE.mdCLAUDE.md
- artur-releaseSkill
- gate-ladderSkill
- init-agentSkill
- init-envSkill
- init-jiraSkill
- init-slackSkill
- init-vcsSkill
- new-integrationSkill
- ai-workflow-reviewSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
If missing: walk the user through the Marketplace install below.
- Very specific: line 55
If DATABASE_URL is missing or the same value appears across environments, the branch-per-environment option wasn't enabled during install.
- Very specific: line 68
No paste-template needed: DATABASE_URL is auto-injected by Vercel.
- Very specific: line 70
If invoked from init-env, return control.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Initialize Neon Postgres
Walks the user through installing Neon Postgres from the Vercel Marketplace with branch-per-environment enabled so Vercel auto-injects a separate DATABASE_URL per environment, which apps/worker/src/infra/runtime-env.ts requires at boot.
AI Workflow uses Postgres as its run registry and its store for workflow definitions, approvals and telemetry: tracking active workflow runs per ticket, deduplicating dispatch, and locking concurrent cron cycles. Tables are created automatically; migrations run during every deploy's build step (apps/worker/scripts/db-migrate.ts).
Canonical reference: SETUP.md section 4 holds the facts and constraints for the database. This skill is the procedure; when the two disagree, SETUP.md wins and this skill gets updated.
If you want full project setup (Jira + VCS + Agent + Slack + Neon + deploy), invoke
init-envinstead. This skill only handles Neon.
Precondition
apps/worker/.vercel/project.json must exist: the worker is linked from apps/worker (SETUP.md section 3), and this skill's commands run there. If missing:
ERROR: no Vercel project linked. Run `vercel link` first, or invoke `init-env`
for the full first-time setup.Halt.
State detection
vercel env ls | grep DATABASE_URL: if present for all three environments, skip install and go to verification.- If missing: walk the user through the Marketplace install below.
Step 1: Marketplace install
Walk the user through these steps (Vercel dashboard install is faster than CLI):
- Open https://vercel.com/marketplace/neon and click Install.
- Select the team and connect it to the ai-workflow Vercel project.
- Critical: enable branch per environment (development / preview / production) when configuring the integration. Each environment's
DATABASE_URLmust point at its own Neon branch. The build fails with anenv_markererror if two environments share one branch: that guard protects the production run registry from preview deployments. The one exception is an engine canary that declares its owner withDATABASE_SHARED_WITH=production(SETUP.md section 4); a new deployment has none. - Confirm the install. Vercel auto-injects
DATABASE_URLfor all three environments.
CLI alternative: vercel integration add neon
Step 2: Confirm the key landed
Tell the user to confirm in Vercel → Project Settings → Environment Variables that they see DATABASE_URL scoped to all three environments (Production, Preview, Development).
CLI alternative (faster from a terminal):
vercel env ls | grep DATABASE_URLSuccess: DATABASE_URL appears for each of the three environments, with different values (distinct ep-… endpoint hosts confirm branch isolation; ignore any -pooler suffix when comparing hosts, because pooled and direct URLs of the same branch differ textually).
If DATABASE_URL is missing or the same value appears across environments, the branch-per-environment option wasn't enabled during install. Recovery paths:
- Easier: disconnect the Neon integration (Project → Storage → Neon → Disconnect), reinstall with branch-per-environment enabled.
- Manual fix: in the Neon console, create separate branches per environment and update each environment's
DATABASE_URLin Vercel manually. Works but the integration won't keep them in sync automatically.
Verification (all must pass)
vercel env lsshowsDATABASE_URLfor development, preview, and production.- Branch isolation: pull each environment's value and confirm the hosts differ (
vercel env pull --environment=production .env.prodetc., compare theep-…endpoint hosts; ignore any-poolersuffix when comparing hosts, because pooled and direct URLs of the same branch differ textually). Identical hosts across environments mean the build'senv_markerguard will fail: fix the integration's branch settings. - Migrations:
cd apps/worker && vercel env pull .env.local && pnpm db:migrateagainst the development branch: expect "[db-migrate] OK: branch claimed by 'development'." (The script loads.env.localthen.envvia dotenv; vars already set in the shell env are never overridden.)
Step 3: Done
No paste-template needed: DATABASE_URL is auto-injected by Vercel. The init-env Step 8 validator (apps/worker/src/infra/runtime-env.ts) confirms it made it.
If invoked from init-env, return control. If standalone, end.
Troubleshooting
- Build fails with
[db-migrate] FATAL: this Neon branch is already claimed by VERCEL_ENV='production', but this build is VERCEL_ENV='…': two environments share one Neon branch (theenv_markerguard). Reconfigure the integration for branch-per-environment, redeploy. DATABASE_URL undefinedat build: integration not connected to this project, or env var scoped to the wrong environments.- Stale run registry for one ticket (e.g. after a bad deploy or smoke test): run
/ai-workflow redis inspect <KEY>in Slack to see its entries, then/ai-workflow redis reset <KEY>to clear them (integrations/slack/commands.ts). Reset does not cancel a live run; cancel it first with/ai-workflow cancel <KEY>or MCPruns.cancel.
Don'ts
- Don't manually create a Neon database outside the Marketplace. You'd lose the auto-injection benefit and have to manage
DATABASE_URLby hand. The Marketplace integration is the preferred path. - Don't share one Neon branch across environments unless the sharing environment declares
DATABASE_SHARED_WITH(only the engine canary does). Theenv_markerbuild guard will fail: it protects the production run registry from preview deployments polluting it. - Don't skip branch isolation. A preview deploy writing to the production Neon branch corrupts the run registry and can orphan live sandboxes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

