Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aiskillstore avatar

Neon Postgres

  • 1 installs
  • 404 repo stars
  • Updated August 5, 2026
  • aiskillstore/marketplace

neon-postgres is a Claude Code skill for connecting to and managing Neon serverless PostgreSQL with pooling, branching, and the serverless driver.

About

neon-postgres is a Claude Code skill for working with Neon serverless PostgreSQL. A developer uses it to set up connections with the @neondatabase/serverless driver (HTTP for edge/one-shot queries, WebSocket for pooled transactions), integrate Drizzle ORM, and use Neon branching for preview databases. It includes examples for Next.js, edge functions, migrations, and PR-based branch workflows.

  • Connects apps to Neon serverless Postgres via HTTP and WebSocket drivers
  • Covers connection pooling, database branching, autoscaling, and Drizzle ORM integration
  • Includes Next.js, edge-function, migration, and CI/CD branch-per-PR examples

Neon Postgres by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #765 of 911 Databases skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

neon-postgres capabilities & compatibility

Requires a Neon account and DATABASE_URL connection string; Neon offers a serverless free tier and CI needs NEON_API_KEY

Capabilities
database connection · connection pooling · database branching · orm integration
Works with
postgres · vercel · github
Use cases
database · devops
Pricing
Bring your own API key
From the docs

What neon-postgres says it does

Neon PostgreSQL serverless database - connection pooling, branching, serverless driver, and optimization. Use when deploying to Neon or building serverless applications.
SKILL.md
Neon branches are copy-on-write clones of your database.
SKILL.md
npx skills add https://github.com/aiskillstore/marketplace --skill neon-postgres

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars404
Last updatedAugust 5, 2026
Repositoryaiskillstore/marketplace

What it does

Connect and manage Neon serverless Postgres with pooling, branching, and Drizzle in serverless apps.

Who is it for?

Developers building serverless or edge apps on Neon Postgres who need connection and branching guidance.

Skip if: Self-hosted or non-Neon Postgres deployments where serverless drivers and branching do not apply.

When should I use this skill?

You are deploying to Neon or building a serverless application on Postgres.

What you get

A correctly connected Neon Postgres app with pooling, branching, and ORM integration.

  • Database connection setup
  • Drizzle ORM integration
  • Branch-per-PR CI workflow

By the numbers

  • Two connection methods: HTTP (neon) and WebSocket (Pool)
  • Two Drizzle drivers: neon-http and neon-serverless

Files

SKILL.mdMarkdownGitHub ↗

Neon PostgreSQL Skill

Serverless PostgreSQL with branching, autoscaling, and instant provisioning.

Quick Start

Create Database

1. Go to console.neon.tech 2. Create a new project 3. Copy connection string

Installation

# npm
npm install @neondatabase/serverless

# pnpm
pnpm add @neondatabase/serverless

# yarn
yarn add @neondatabase/serverless

# bun
bun add @neondatabase/serverless

Connection Strings

# Direct connection (for migrations, scripts)
DATABASE_URL=postgresql://user:password@ep-xxx.us-east-1.aws.neon.tech/dbname?sslmode=require

# Pooled connection (for application)
DATABASE_URL_POOLED=postgresql://user:password@ep-xxx-pooler.us-east-1.aws.neon.tech/dbname?sslmode=require

Key Concepts

ConceptGuide
Serverless Driverreference/serverless-driver.md
Connection Poolingreference/pooling.md
Branchingreference/branching.md
Autoscalingreference/autoscaling.md

Examples

PatternGuide
Next.js Integrationexamples/nextjs.md
Edge Functionsexamples/edge.md
Migrationsexamples/migrations.md
Branching Workflowexamples/branching-workflow.md

Templates

TemplatePurpose
templates/db.tsDatabase connection
templates/neon.config.tsNeon configuration

Connection Methods

HTTP (Serverless - Recommended)

Best for: Edge functions, serverless, one-shot queries

import { neon } from "@neondatabase/serverless";

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

// Simple query
const posts = await sql`SELECT * FROM posts WHERE published = true`;

// With parameters
const post = await sql`SELECT * FROM posts WHERE id = ${postId}`;

// Insert
await sql`INSERT INTO posts (title, content) VALUES (${title}, ${content})`;

WebSocket (Connection Pooling)

Best for: Long-running connections, transactions

import { Pool } from "@neondatabase/serverless";

const pool = new Pool({ connectionString: process.env.DATABASE_URL });

const client = await pool.connect();
try {
  await client.query("BEGIN");
  await client.query("INSERT INTO posts (title) VALUES ($1)", [title]);
  await client.query("COMMIT");
} catch (e) {
  await client.query("ROLLBACK");
  throw e;
} finally {
  client.release();
}

With Drizzle ORM

HTTP Driver

// src/db/index.ts
import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";
import * as schema from "./schema";

const sql = neon(process.env.DATABASE_URL!);
export const db = drizzle(sql, { schema });

WebSocket Driver

// src/db/index.ts
import { Pool } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-serverless";
import * as schema from "./schema";

const pool = new Pool({ connectionString: process.env.DATABASE_URL });
export const db = drizzle(pool, { schema });

Branching

Neon branches are copy-on-write clones of your database.

CLI Commands

# Install Neon CLI
npm install -g neonctl

# Login
neonctl auth

# List branches
neonctl branches list

# Create branch
neonctl branches create --name feature-x

# Get connection string
neonctl connection-string feature-x

# Delete branch
neonctl branches delete feature-x

Branch Workflow

# Create branch for feature
neonctl branches create --name feature-auth --parent main

# Get connection string for branch
export DATABASE_URL=$(neonctl connection-string feature-auth)

# Work on feature...

# When done, merge via application migrations
neonctl branches delete feature-auth

CI/CD Integration

# .github/workflows/preview.yml
name: Preview
on: pull_request

jobs:
  preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Create Neon Branch
        uses: neondatabase/create-branch-action@v5
        id: branch
        with:
          project_id: ${{ secrets.NEON_PROJECT_ID }}
          api_key: ${{ secrets.NEON_API_KEY }}
          branch_name: preview-${{ github.event.pull_request.number }}

      - name: Run Migrations
        env:
          DATABASE_URL: ${{ steps.branch.outputs.db_url }}
        run: npx drizzle-kit migrate

Connection Pooling

When to Use Pooling

ScenarioConnection Type
Edge/Serverless functionsHTTP (neon)
API routes with transactionsWebSocket Pool
Long-running processesWebSocket Pool
One-shot queriesHTTP (neon)

Pooler URL

# Without pooler (direct)
postgresql://user:pass@ep-xxx.aws.neon.tech/db

# With pooler (add -pooler to endpoint)
postgresql://user:pass@ep-xxx-pooler.aws.neon.tech/db

Autoscaling

Configure in Neon console:

  • Min compute: 0.25 CU (can scale to zero)
  • Max compute: Up to 8 CU
  • Scale to zero delay: 5 minutes (default)

Handle Cold Starts

import { neon } from "@neondatabase/serverless";

const sql = neon(process.env.DATABASE_URL!, {
  fetchOptions: {
    // Increase timeout for cold starts
    signal: AbortSignal.timeout(10000),
  },
});

Best Practices

1. Use HTTP for Serverless

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

// Avoid - Pool in serverless (connection exhaustion)
import { Pool } from "@neondatabase/serverless";
const pool = new Pool({ connectionString: process.env.DATABASE_URL });

2. Connection String per Environment

# .env.development
DATABASE_URL=postgresql://...@ep-dev-branch...

# .env.production
DATABASE_URL=postgresql://...@ep-main...

3. Use Prepared Statements

// Good - parameterized query
const result = await sql`SELECT * FROM users WHERE id = ${userId}`;

// Bad - string interpolation (SQL injection risk)
const result = await sql(`SELECT * FROM users WHERE id = '${userId}'`);

4. Handle Errors

import { neon, NeonDbError } from "@neondatabase/serverless";

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

try {
  await sql`INSERT INTO users (email) VALUES (${email})`;
} catch (error) {
  if (error instanceof NeonDbError) {
    if (error.code === "23505") {
      // Unique violation
      throw new Error("Email already exists");
    }
  }
  throw error;
}

Next.js App Router

// app/posts/page.tsx
import { neon } from "@neondatabase/serverless";

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

export default async function PostsPage() {
  const posts = await sql`SELECT * FROM posts ORDER BY created_at DESC`;

  return (
    <ul>
      {posts.map((post) => (
        <li key={post.id}>{post.title}</li>
      ))}
    </ul>
  );
}

Drizzle + Neon Complete Setup

// src/db/index.ts
import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";
import * as schema from "./schema";

const sql = neon(process.env.DATABASE_URL!);
export const db = drizzle(sql, { schema });

// src/db/schema.ts
import { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";

export const posts = pgTable("posts", {
  id: serial("id").primaryKey(),
  title: text("title").notNull(),
  content: text("content"),
  createdAt: timestamp("created_at").defaultNow().notNull(),
});

// drizzle.config.ts
import { defineConfig } from "drizzle-kit";

export default defineConfig({
  schema: "./src/db/schema.ts",
  out: "./src/db/migrations",
  dialect: "postgresql",
  dbCredentials: {
    url: process.env.DATABASE_URL!,
  },
});

Related skills

FAQ

When should I use the HTTP vs WebSocket driver?

Use the HTTP (neon) driver for edge/serverless functions and one-shot queries, and the WebSocket Pool for long-running connections and transactions.

What is Neon branching used for?

Neon branches are copy-on-write clones of your database, useful for preview environments and PR-based branch-per-preview CI/CD workflows.

Databasesdatabases

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.