agentleFS
Rikinshah787Rikinshah787/agent-skills-production-skills/skills/neon/SKILL.md

neon

Skill2 starsChanged 4 months agoMITView on GitHub

Use to connect an app to serverless Postgres with pooled connections, the HTTP serverless driver, and database branching for previews.

  • Reads credentials

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use when: you want managed Postgres for serverless/edge apps (Vercel, Workers, Lambda).

    line 21
  2. Distinctive:

    Use when: you want a fresh database branch per PR/preview deployment.

    line 22
  3. Very specific:

    Don't use for: workloads needing persistent long-lived sessions with heavy LISTEN/NOTIFY on the pooler.

    line 23
  4. Distinctive:

    Always pass user input through parameters (tagged templates or driver params), never string-concatenated SQL.

    line 94

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Neon — Skillship

Serverless Postgres that separates storage from compute: scales to zero, connects over HTTP from edge/serverless, and gives every branch a full copy-on-write database.

🧭 When to use this skill

  • Use when: you want managed Postgres for serverless/edge apps (Vercel, Workers, Lambda).
  • Use when: you want a fresh database branch per PR/preview deployment.
  • Don't use for: workloads needing persistent long-lived sessions with heavy LISTEN/NOTIFY on the pooler.

⚡ Quickstart

1. Get your connection string

From Project Dashboard → Connect, copy the string. It looks like:

postgresql://user:pass@ep-cool-darkness-a1b2c3d4.us-east-2.aws.neon.tech/dbname?sslmode=require

2. Configure env

# .env — prefer the POOLED host (has "-pooler") for serverless/web apps
DATABASE_URL="postgresql://user:pass@ep-xxxx-pooler.us-east-2.aws.neon.tech/dbname?sslmode=require"

3. Minimal working example (serverless driver — works on edge)

import { neon } from "@neondatabase/serverless";
const sql = neon(process.env.DATABASE_URL!);

const users = await sql`SELECT * FROM users WHERE id = ${id}`; // tagged template = parameterized

🧩 Common recipes

Recipe: Pooled vs direct connection (this is the #1 gotcha)

Direct:  ep-cool-darkness-123456.us-east-2.aws.neon.tech
Pooled:  ep-cool-darkness-123456-pooler.us-east-2.aws.neon.tech   <-- add "-pooler"
Use caseConnection
Serverless functions, web apps, connection-per-requestPooled
Schema migrations, pg_dump, logical replication, session-level SETDirect

Recipe: Use with Prisma

import { neon } from "@neondatabase/serverless";
import { PrismaNeonHTTP } from "@prisma/adapter-neon";
import { PrismaClient } from "@prisma/client";

const sql = neon(process.env.DATABASE_URL!);
const adapter = new PrismaNeonHTTP(sql);
const prisma = new PrismaClient({ adapter });

For migrations with Prisma, use a direct (non-pooler) URL, e.g. a separate DIRECT_URL.

Recipe: Use with Drizzle

import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";

const sql = neon(process.env.DATABASE_URL!);
const db = drizzle(sql);

Recipe: Branch per preview (Vercel)

  • Connect the Neon–Vercel integration so each preview deployment gets its own branch (isolated data, copy-on-write from main). Great for testing migrations before they touch production.

🚀 Ship to production

  • App uses the pooled connection string; migrations use a direct one.
  • sslmode=require present in the connection string.
  • Connection string stored as a host secret, not committed.
  • Understand transaction-mode pooling limits: no session SET, temp tables, or SQL-level PREPARE on the pooler.
  • Add retry/backoff for cold starts (compute may be scaled to zero).
  • Consider a dedicated DIRECT_URL env for tooling (pg_dump, migrations, analytics).

🔐 Security & secrets

  • The connection string contains DB credentials — store in a secret manager / host env.
  • Always pass user input through parameters (tagged templates or driver params), never string-concatenated SQL.

🐛 Common errors & fixes

SymptomLikely causeFix
remaining connection slots are reserved / too many connectionsUsing direct URL from serverlessSwitch to the -pooler host
relation "x" does not exist after a SET search_pathPooler transaction mode drops session stateQualify tables (schema.table) or use a direct connection
Migrations fail on pooled URLTools need session featuresRun migrations against the direct (non-pooler) URL
First request very slowCompute scaled to zero (cold start)Add retries; keep a warmer if latency-critical

💰 Pricing gotchas

  • Compute is billed by active time; scale-to-zero saves money but adds cold-start latency.
  • Many long-lived branches accrue storage — archive/delete stale preview branches.

📚 Sources

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.