agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/databases/neon/SKILL.md

neon

Skill15 starsChanged 42 days agoMITView on GitHub

Expert Neon serverless PostgreSQL assistance covering scale-to-zero, instant database branching, connection pooling, and pgvector. Use when setting up serverless Postgres, ephemeral CI/CD databases, or edge apps.

  • Reads credentials

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use neon-auth, neon-postgres-branches and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • jaaklaSkill

    neon-auth

    Add authentication to a new app. Use for "add auth", "add login", Neon Auth (Managed Better Auth), identity routing, sign-up, sign-in, password reset, email OTP, magic links, organizations, phone OTP, OAuth, passkeys, MFA, trusted domains, invalid domain, and @neondatabase/auth. No existing identity: default to Managed Better Auth. Keep working Better Auth, Clerk, Supabase Auth, or another IdP. User asked to migrate from Supabase Auth: Managed Better Auth. A required plugin outside Managed support: self-managed Better Auth on a Neon Function or the existing app host. Also use for auth APIs in @neondatabase/neon-js.

    Also in 5 projects that use this

  • xAISkill

    neon-postgres-branches

    Choose and create the right Neon branch type for testing and development. Use when users ask about Neon branching, migration testing with real data, isolated test environments, schema-only branch workflows for sensitive data, or branch creation via Neon CLI or Neon MCP. Triggers include "Neon branch", "test migrations safely", "branch production data", "schema-only branch", "reset branch" and "sensitive data testing".

    Also in 4 projects that use this

  • jaaklaSkill

    neon-ai-gateway

    One API and one credential for frontier and open-source LLMs, built into your Neon branch and powered by Databricks. Use when a user wants to call an LLM, add AI/chat/an agent to their app, route between model providers (OpenAI, Anthropic, Google/Gemini, Meta, Alibaba, and more), or avoid juggling separate provider API keys and accounts — especially when they already use Neon and want AI requests to branch with their project. Works with the OpenAI SDK, Anthropic SDK, google-genai, the Vercel AI SDK, and Mastra by changing only the base URL. Triggers include "call an LLM", "add AI to my app", "chat completion", "model routing", "LLM proxy/gateway", "one API for all models", "use Claude/GPT/Gemini", "AI SDK", "Mastra agent", "Neon AI Gateway", and "log/rate-limit AI calls".

    Also in 4 projects that use this

  • bergsideSkill

    neobrutalism

    Modern take on brutalism with bold borders, vivid accent colors, and raw, high-contrast layouts on warm surfaces.

    Also in 4 projects that use this

  • bergsideSkill

    ant

    Structured, enterprise-focused design system emphasizing clarity, consistency, and efficiency for data-dense web applications.

    Also in 3 projects that use this

  • +2 more from jaakla
  • +5 more from bergside

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 2

    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:

    Create a disposable copy-on-write branch for each PR or test run:

    line 74
  2. Very specific:

    Use the Serverless HTTP Driver for Edge Functions: Prevent connection starvation using @neondatabase/serverless.

    line 93
  3. Distinctive:

    Keep preview branches alive indefinitely: Automate cleanup of merged pull request database branches via GitHub Actions.

    line 100

“Common” is measured: kept by at least 6 in 10 of the 15 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

Neon is a serverless open-source PostgreSQL database. It separates storage and compute to offer features like "Scale to Zero", "Instant Branching", and "Bottomless Storage".

When to Use

  • Serverless PostgreSQL: Modern PostgreSQL with decoupled storage and compute, scaling down to zero when idle to eliminate costs.
  • Database Branching for Previews: Instantly branching production databases in milliseconds for CI/CD pipelines, staging, and pull requests.
  • Autoscaling Relational Workloads: Automatically scaling compute CPU and RAM dynamically during traffic spikes without connection dropouts.
  • Edge Computing & Serverless Functions: Connecting via WebSockets and HTTP drivers from Cloudflare Workers, Vercel, and AWS Lambda.

Quick Start

// Connect to Neon using the serverless driver over WebSockets / HTTP
import { neon } from "@neondatabase/serverless";

const sql = neon(process.env.DATABASE_URL);

async function getUsers() {
  const users = await sql`SELECT id, name, email FROM users LIMIT 10`;
  return users;
}

Core Concepts

Separation of Compute and Storage Architecture

Stateless PostgreSQL compute nodes query a custom, distributed, multi-tenant storage engine backed by cloud object storage:

[ Stateless Postgres Compute Node ] ──Page Service Protocol──→ [ Distributed Storage Engine ]
                                                                        │ (LSM Tree)
                                                                        ▼
                                                             [ Immutable Cloud S3 ]

Copy-on-Write Database Branching

Creates instant, isolated point-in-time database clones using copy-on-write storage:

# Create a fresh database branch from production using Neon CLI
neon branch create --name pr-415-preview --from main
# Creates an isolated, fully functional Postgres instance in 500ms!

Serverless Driver over WebSockets / HTTP

Bypasses TCP connection handshake overhead from serverless environments:

// Connect via Neon Serverless Driver (Vercel / Cloudflare Workers)
import { neon } from "@neondatabase/serverless";

const sql = neon(process.env.DATABASE_URL!);
const users =
  await sql`SELECT id, email, created_at FROM users WHERE active = true LIMIT 10`;

Common Patterns

Ephemeral Database Branching for CI/CD

Problem: Integration tests running against shared databases cause state collisions and flakiness.

Solution: Create a disposable copy-on-write branch for each PR or test run:

# Create instant branch from staging parent
BRANCH_INFO=$(neon branch create pr-tests-42 --from staging -o json)
BRANCH_CONN=$(echo $BRANCH_INFO | jq -r '.connection_uris[0].connection_uri')

# Run migrations and integration test suite against ephemeral branch
DATABASE_URL=$BRANCH_CONN npm run test:e2e

# Delete branch after test suite completes
neon branch delete pr-tests-42

Best Practices

Do:

  • Integrate Database Branching into GitHub Actions: Spin up isolated preview databases for each pull request; destroy them on merge.
  • Use the Serverless HTTP Driver for Edge Functions: Prevent connection starvation using @neondatabase/serverless.
  • Enable Autosuspend for Non-Production Branches: Configure dev branches to suspend after 5 minutes of inactivity to minimize costs.
  • Leverage Connection Pooling: Connect via the pooled connection string (-pooler) when connecting from serverless backends.

Don't:

  • Open direct TCP connections from thousands of Lambda functions: Direct TCP exhausted Postgres connection limits; use the pooled endpoint.
  • Keep preview branches alive indefinitely: Automate cleanup of merged pull request database branches via GitHub Actions.
  • Omit query parameters in template strings: Always use tagged template literals (sqlSELECT * FROM users WHERE id = ${id}``) to prevent SQLi.

Troubleshooting

ErrorCauseSolution
connection timeout on first request (cold start)Compute was scaled to zero and requires ~500ms to spin up.Use Neon Connection Pooler endpoint (-pooler domain suffix) or keep active compute.
too many clients alreadyConnecting directly to Postgres compute from serverless functions.Use the pooled connection string with PgBouncer enabled.
Branch creation limit reachedExceeded project branch limits on current subscription tier.Automate deletion of merged or stale branches via Neon CLI in CI.

References

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.