skills/neon/SKILL.md
--- name: neon description: Manage Neon serverless Postgres — create project, branches (incl. per-PR preview), wire Drizzle + Neon HTTP driver for Cloudflare Workers, set DATABASE_URL via wrangler secret. Use when user wants Postgres (not SQLite/D1) — needs pgvector / PostGIS / JSONB / preview DB branches / strict types, or when wiring Neon into a TanStack Start + CF Workers app. category: database argument-hint: [install | project <list|create> | branch <list|create|delete> | push-secret] [--pr
npx skillsauth add RonanCodes/ronan-skills skills/neonInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
CLI-first Neon ops via the public API. Covers project/branch management and Drizzle + Neon HTTP driver wiring for TanStack Start on Cloudflare Workers. Chosen because CF Workers does not have native Postgres — Neon's HTTP driver (no TCP) is the idiomatic fit.
/ro:neon install # wire Drizzle + @neondatabase/serverless into current app
/ro:neon project list
/ro:neon project create <name> # creates project + default "main" branch, prints DATABASE_URL
/ro:neon branch list --project <id>
/ro:neon branch create <name> --project <id> # e.g. "preview-pr-42"
/ro:neon branch delete <name> --project <id>
/ro:neon push-secret --project <id> --branch main # write DATABASE_URL to current app's wrangler secret
NEON_API_KEY in ~/.claude/.env — create at https://console.neon.tech/app/settings/api-keyspush-secret: a TanStack Start app with wrangler.toml in the cwd| Need | Use |
|---|---|
| Default — simple CRUD, SQLite is enough, zero ops | D1 |
| pgvector (embeddings, RAG), PostGIS, JSONB ops, window funcs | Neon |
| Preview DB per PR / feature branch | Neon (free-tier branches are cheap, copy-on-write) |
| Strict types (CHECK, DOMAIN), PL/pgSQL | Neon |
| Multi-region reads | Neon (read replicas) |
pnpm add @neondatabase/serverless drizzle-orm
pnpm add -D drizzle-kit
drizzle.config.ts:
import { defineConfig } from "drizzle-kit";
export default defineConfig({
schema: "./src/db/schema.ts",
out: "./drizzle",
dialect: "postgresql",
dbCredentials: { url: process.env.DATABASE_URL! },
});
src/db/index.tsimport { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";
import * as schema from "./schema";
export function createDb(env: { DATABASE_URL: string }) {
const sql = neon(env.DATABASE_URL);
return drizzle(sql, { schema });
}
The Neon HTTP driver works inside Workers because it uses fetch() — no TCP. Do not use @neondatabase/serverless's Pool / Client classes in Workers; only neon() + drizzle-orm/neon-http.
src/db/schema.tsimport { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";
export const users = pgTable("users", {
id: serial("id").primaryKey(),
email: text("email").notNull().unique(),
createdAt: timestamp("created_at").defaultNow().notNull(),
});
(Note: pg-core, not sqlite-core — this is the key diff vs a D1 app.)
wrangler.toml:
# DATABASE_URL is a secret, not a binding — do NOT put it here
# Set via: wrangler secret put DATABASE_URL
Access in Server Routes / Server Functions via env.DATABASE_URL (Workers env), or process.env.DATABASE_URL (local dev via .dev.vars).
.dev.vars:
DATABASE_URL=postgresql://user:[email protected]/main?sslmode=require
Then wrangler dev surfaces this as env.DATABASE_URL.
pnpm drizzle-kit generate # creates ./drizzle/*.sql
pnpm drizzle-kit migrate # applies against DATABASE_URL
For prod: apply against the prod branch's DATABASE_URL before wrangler deploy.
All calls go to https://console.neon.tech/api/v2/ with Authorization: Bearer ${NEON_API_KEY}.
Newer Neon accounts require org_id for the projects endpoint. Find it first:
curl -s "https://console.neon.tech/api/v2/users/me/organizations" \
-H "Authorization: Bearer ${NEON_API_KEY}" \
| jq '.organizations[] | {id, name, plan}'
Export as NEON_ORG_ID in the session or per-app env.
curl -s "https://console.neon.tech/api/v2/projects?org_id=${NEON_ORG_ID}" \
-H "Authorization: Bearer ${NEON_API_KEY}" \
| jq '.projects[] | {id, name, region_id, created_at, pg_version}'
Gotcha: calling /projects without ?org_id= returns {"code":"","message":"org_id is required, you can find it on your organization settings page"} — skill always passes the org id.
curl -s -X POST "https://console.neon.tech/api/v2/projects" \
-H "Authorization: Bearer ${NEON_API_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"project\": {
\"name\": \"my-app\",
\"org_id\": \"${NEON_ORG_ID}\",
\"region_id\": \"aws-eu-central-1\",
\"pg_version\": 17
}
}" | jq '{id: .project.id, connection_uri: .connection_uris[0].connection_uri}'
pg_version: 17 is the current Neon default — bump this as Neon adds majors.
Region IDs: aws-eu-central-1 (Frankfurt), aws-us-east-1 (Virginia), aws-us-east-2 (Ohio), aws-ap-southeast-1 (Singapore). Pick closest to your CF Workers primary region.
The connection_uri in the response is your DATABASE_URL — push it to wrangler (push-secret below).
Branches in Neon are copy-on-write snapshots — cheap, instant, free tier includes 10 branches per project.
curl -s "https://console.neon.tech/api/v2/projects/${PROJECT_ID}/branches" \
-H "Authorization: Bearer ${NEON_API_KEY}" \
| jq '.branches[] | {id, name, primary, created_at, parent_id}'
curl -s -X POST "https://console.neon.tech/api/v2/projects/${PROJECT_ID}/branches" \
-H "Authorization: Bearer ${NEON_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"branch": {"name": "preview-pr-42"}, "endpoints": [{"type": "read_write"}]}' \
| jq '{id: .branch.id, name: .branch.name, connection_uris: .connection_uris}'
curl -s -X DELETE "https://console.neon.tech/api/v2/projects/${PROJECT_ID}/branches/${BRANCH_ID}" \
-H "Authorization: Bearer ${NEON_API_KEY}"
Skill always confirms before delete — branches are not in a trash, deletion is immediate.
# Fetch the connection URI for the specified branch
CONN=$(curl -s "https://console.neon.tech/api/v2/projects/${PROJECT_ID}/connection_uri?branch_id=${BRANCH_ID}&database_name=neondb&role_name=neondb_owner" \
-H "Authorization: Bearer ${NEON_API_KEY}" | jq -r '.uri')
# Push to wrangler (prompts for confirm)
echo "$CONN" | wrangler secret put DATABASE_URL
Wire into CI so each PR gets its own branch:
# .github/workflows/pr-preview.yml
- name: Create preview DB branch
run: |
BRANCH_NAME="preview-pr-${{ github.event.pull_request.number }}"
curl -X POST ".../projects/${{ secrets.NEON_PROJECT_ID }}/branches" \
-H "Authorization: Bearer ${{ secrets.NEON_API_KEY }}" \
-d "{\"branch\":{\"name\":\"$BRANCH_NAME\"},\"endpoints\":[{\"type\":\"read_write\"}]}"
- name: Run migrations against branch
- name: Deploy to Workers preview with branch DATABASE_URL
- name: On PR close — delete branch
Global (~/.claude/.env):
NEON_API_KEY — this skill's management APIPer-app (.dev.vars + wrangler secret):
DATABASE_URL — Neon connection URI for the current branch. Format: postgresql://role:[email protected]/dbname?sslmode=requireCloudflare Workers don't support long-lived TCP sockets. The Neon HTTP driver makes each query a fetch() call, which works in the Workers runtime. For normal Postgres clients, you'd need Cloudflare Hyperdrive (their Postgres pooler), but the Neon HTTP driver skips the pooler — faster cold starts, simpler wiring.
DATABASE_URL is a secret. NEVER commit .dev.vars. NEVER put it in wrangler.toml. Always use wrangler secret put.push-secret./ro:new-tanstack-app --db neon — scaffolds with neon pre-wired (once orchestrator is built)/ro:cf-ship — ships after migrations are appliedtesting
--- name: linear-pipeline description: The Fable orchestrator for a single dispatched Linear ticket. Holds almost no context itself; it receives `--issue <ID> --detached`, decides the stage sequence, and fans out a sub-agent per stage, passing forward only each stage's artifact (never re-derived, never inlined into its own context). Step zero, before any planning or stage routing, is a boundary triage against `canon/security-boundary.md` (#199): a match tags Ronan Connolly and stops the run, no
development
--- name: in-your-face description: Capture a chat-only answer into a durable artifact (markdown + HTML, PDF when cheap) and launch it automatically so the user cannot miss it. Use when user says "in your face", "don't let me lose this", "save that answer", "make that durable", or right after answering a substantive side question (a recipe, comparison, how-to, or generated prompt) that would otherwise die with the context. category: workflow argument-hint: [--no-open] [--vault <short>] [hint of
tools
One-shot headless OpenAI Codex CLI calls for background/admin AI tasks — summaries, classification, extraction, admin glue. The default engine for anything that runs AI constantly in the background (daemon-driven, per-event), because it bills the flat ChatGPT subscription instead of Claude usage or per-token API spend, and it keeps working while Claude is rate-limited. NEVER for coding — coding stays Claude. Use when a skill or daemon needs a cheap always-on AI call, when the user says "use codex", "ask codex", "codex as backup", or when building a background summarizer/classifier into a listener or loop. Reads auth from ~/.codex/auth.json (ChatGPT account, no API key).
research
Turn a warranty rejection, repair quote, or RMA email into a cited decision brief — legal read (NL/EU consumer law), is the part user-serviceable, live part and new-unit prices, repair-vs-DIY-vs-new economics, before-you-send-it checklist, deadlines. Use when the user pastes or screenshots a repair quote, warranty rejection, "not covered" email, onderzoekskosten fee, or asks "should I repair or replace this".