home / skills / andrelandgraf / fullstackrecipes / neon-postgres

neon-postgres skill

/.agents/skills/neon-postgres

This skill helps you navigate Neon Serverless Postgres with best practices, setup steps, and tooling guidance for efficient development.

This is most likely a fork of the neon-postgres skill from openclaw
npx playbooks add skill andrelandgraf/fullstackrecipes --skill neon-postgres

Review the files below or copy the command above to add this skill to your agents.

Files (14)
SKILL.md
6.7 KB
---
name: neon-postgres
description: Guides and best practices for working with Neon Serverless Postgres. Covers getting started, local development with Neon, choosing a connection method, Neon features, authentication (@neondatabase/auth), PostgREST-style data API (@neondatabase/neon-js), Neon CLI, and Neon's Platform API/SDKs. Use for any Neon-related questions.
---

# Neon Serverless Postgres

Neon is a serverless Postgres platform that separates compute and storage to offer autoscaling, branching, instant restore, and scale-to-zero. It's fully compatible with Postgres and works with any language, framework, or ORM that supports Postgres.

## Neon Documentation

The Neon documentation is the source of truth for all Neon-related information. Always verify claims against the official docs before responding. Neon features and APIs evolve, so prefer fetching current docs over relying on training data.

### Fetching Docs as Markdown

Any Neon doc page can be fetched as markdown in two ways:

1. **Append `.md` to the URL** (simplest): `https://neon.com/docs/introduction/branching.md`
2. **Request `text/markdown`** on the standard URL: `curl -H "Accept: text/markdown" https://neon.com/docs/introduction/branching`

Both return the same markdown content. Use whichever method your tools support.

### Finding the Right Page

The docs index lists every available page with its URL and a short description:

```
https://neon.com/docs/llms.txt
```

Common doc URLs are organized in the topic links below. If you need a page not listed here, search the [docs index](https://neon.com/docs/llms.txt) — don't guess URLs.

## What Is Neon

Use this for architecture explanations and terminology (organizations, projects, branches, endpoints) before giving implementation advice.

Link: `references/what-is-neon.md`

## Getting Started

Use this for first-time setup: org/project selection, connection strings, driver installation, optional auth, and initial schema setup.

Link: `references/getting-started.md`

## Connection Methods & Drivers

Use this when you need to pick the correct transport and driver based on runtime constraints (TCP, HTTP, WebSocket, edge, serverless, long-running).

Link: `references/connection-methods.md`

### Serverless Driver

Use this for `@neondatabase/serverless` patterns, including HTTP queries, WebSocket transactions, and runtime-specific optimizations.

Link: `references/neon-serverless.md`

### Neon JS SDK

Use this for combined Neon Auth + Data API workflows with PostgREST-style querying and typed client setup.

Link: `references/neon-js.md`

## Developer Tools

Use this for local development enablement with `npx neonctl@latest init`, VSCode extension setup, and Neon MCP server configuration.

Link: `references/devtools.md`

### Neon CLI

Use this for terminal-first workflows, scripts, and CI/CD automation with `neonctl`.

Link: `references/neon-cli.md`

## Neon Admin API

The Neon Admin API can be used to manage Neon resources programmatically. It is used behind the scenes by the Neon CLI and MCP server, but can also be used directly for more complex automation workflows or when embedding Neon in other applications.

### Neon REST API

Use this for direct HTTP automation, endpoint-level control, API key auth, rate-limit handling, and operation polling.

Link: `references/neon-rest-api.md`

### Neon TypeScript SDK

Use this when implementing typed programmatic control of Neon resources in TypeScript via `@neondatabase/api-client`.

Link: `references/neon-typescript-sdk.md`

### Neon Python SDK

Use this when implementing programmatic Neon management in Python with the `neon-api` package.

Link: `references/neon-python-sdk.md`

## Neon Auth

Use this for managed user authentication setup, UI components, auth methods, and Neon Auth integration pitfalls in Next.js and React apps.

Link: `references/neon-auth.md`

Neon Auth is also embedded in the Neon JS SDK - so depending on your use case, you may want to use the Neon JS SDK instead of Neon Auth. See `references/connection-methods.md` for more details.

## Branching

Use this when the user is planning isolated environments, schema migration testing, preview deployments, or branch lifecycle automation.

Key points:

- Branches are instant, copy-on-write clones (no full data copy).
- Each branch has its own compute endpoint.
- Use the neonctl CLI or MCP server to create, inspect, and compare branches.

Link: `references/branching.md`

## Autoscaling

Use this when the user needs compute to scale automatically with workload and wants guidance on CU sizing and runtime behavior.

Link: https://neon.com/docs/introduction/autoscaling.md

## Scale to Zero

Use this when optimizing idle costs and discussing suspend/resume behavior, including cold-start trade-offs.

Key points:

- Idle computes suspend automatically (default 5 minutes, configurable) (unless disabled - launch & scale plan only)
- First query after suspend typically has a cold-start penalty (around hundreds of ms)
- Storage remains active while compute is suspended.

Link: https://neon.com/docs/introduction/scale-to-zero.md

## Instant Restore

Use this when the user needs point-in-time recovery or wants to restore data state without traditional backup restore workflows.

Key points:

- Restore windows depend on plan limits.
- Users can create branches from historical points-in-time.
- Time Travel queries can be used for historical inspection workflows.

Link: https://neon.com/docs/introduction/branch-restore.md

## Read Replicas

Use this for read-heavy workloads where the user needs dedicated read-only compute without duplicating storage.

Key points:

- Replicas are read-only compute endpoints sharing the same storage.
- Creation is fast and scaling is independent from primary compute.
- Typical use cases: analytics, reporting, and read-heavy APIs.

Link: https://neon.com/docs/introduction/read-replicas.md

## Connection Pooling

Use this when the user is in serverless or high-concurrency environments and needs safe, scalable Postgres connection management.

Key points:

- Neon pooling uses PgBouncer.
- Add `-pooler` to endpoint hostnames to use pooled connections.
- Pooling is especially important in serverless runtimes with bursty concurrency.

Link: https://neon.com/docs/connect/connection-pooling.md

## IP Allow Lists

Use this when the user needs to restrict database access by trusted networks, IPs, or CIDR ranges.

Link: https://neon.com/docs/introduction/ip-allow.md

## Logical Replication

Use this when integrating CDC pipelines, external Postgres sync, or replication-based data movement.

Key points:

- Neon supports native logical replication workflows.
- Useful for replicating to/from external Postgres systems.

Link: https://neon.com/docs/guides/logical-replication-guide.md

Overview

This skill provides practical guides and production-ready patterns for working with Neon Serverless Postgres. It covers getting started, local development, connection choices, Neon features (branching, autoscaling, scale-to-zero), and tooling like Neon CLI and SDKs. Use it to answer Neon-specific implementation questions and recommend best practices for full-stack and serverless workflows.

How this skill works

The skill organizes Neon knowledge into topic-focused recipes and reference pages: setup, drivers, auth, local dev, admin APIs, and platform SDKs. It points to canonical Neon docs for live API details and shows concrete patterns for connecting from server, edge, and browser runtimes. It emphasizes when to use Neon JS, serverless drivers, pooling, and Neon Auth based on runtime constraints.

When to use it

  • Setting up Neon for a new project or selecting the right connection method
  • Building local development workflows and CI for Neon databases
  • Implementing serverless-friendly Postgres access (HTTP, WebSocket, or pooled TCP)
  • Designing branch-based testing, preview environments, or point-in-time restores
  • Automating Neon resource management via CLI or TypeScript/Python SDKs

Best practices

  • Always verify API or feature changes against the official Neon docs before acting
  • Choose connection method by runtime: serverless drivers or HTTP in edge/SSR; pooled TCP for long-running backends
  • Use branches for isolated testing and review apps; treat branches as lightweight clones
  • Enable pooling (add -pooler host) for bursty or serverless concurrency to avoid connection exhaustion
  • Use Neon Auth or the Neon JS SDK depending on whether you need integrated auth + typed client workflows

Example use cases

  • Local development with npx neonctl init and a MCP server for fast iteration
  • Using Neon branches to test schema migrations against production-like snapshots
  • Deploying an edge function that queries Neon via the serverless HTTP driver
  • Autoscaling a data API: tune compute units and enable poolers for unpredictable traffic
  • Automating environment creation in CI using the Neon CLI or TypeScript SDK

FAQ

When should I use Neon Auth vs Neon JS SDK?

Use Neon Auth if you only need managed user authentication and UI components. Use the Neon JS SDK when you want an integrated auth + PostgREST-style data client with typed helpers.

How do branches affect performance and cost?

Branches are copy-on-write and fast to create. Each branch has its own compute endpoint, so cost depends on active compute usage. Use scale-to-zero and autoscaling to minimize idle compute costs.