skills/neon-postgres/SKILL.md
Guides and best practices for working with Neon Serverless Postgres. Covers setup, connection methods, branching, autoscaling, scale-to-zero, read replicas, connection pooling, Neon Auth, and the Neon CLI, MCP server, REST API, TypeScript SDK, and Python SDK. Use when users ask about "Neon setup", "connect to Neon", "Neon project", "DATABASE_URL", "serverless Postgres", "Neon CLI", "neonctl", "Neon MCP", "Neon Auth", "@neondatabase/serverless", "@neondatabase/neon-js", "scale to zero", "Neon autoscaling", "Neon read replica", or "Neon connection pooling".
npx skillsauth add neondatabase/agent-skills neon-postgresInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Guide the user through any Neon-related task: setup, connections, branching, and advanced features. Deliver a working Neon connection, a completed feature configuration, or a specific answer from the official Neon docs.
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.
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.
Any Neon doc page can be fetched as markdown in two ways:
.md to the URL (simplest): https://neon.com/docs/introduction/branching.mdtext/markdown on the standard URL: curl -H "Accept: text/markdown" https://neon.com/docs/introduction/branchingBoth return the same markdown content. Use whichever method your tools support.
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.
Use this for architecture explanations and terminology (organizations, projects, branches, endpoints) before giving implementation advice.
Link: https://neon.com/docs/introduction/architecture-overview.md
Use this section when guiding a user through first-time Neon setup.
Before starting setup, inspect the user's codebase and environment:
.env file and DATABASE_URL environment variableOffer to inspect existing connected Neon projects or create new ones using the Neon CLI or MCP server. If neither is set up yet, run init with the --agent flag. Use npx -y to skip the package install prompt. Auth is handled automatically. If the user is not logged in, it opens their browser for OAuth and waits for completion before proceeding.
npx -y neonctl@latest init --agent <agent-name>
Supported --agent values: cursor, copilot, claude, claude-desktop, codex, opencode, cline, gemini-cli, goose, zed.
This installs the Neon extension (for Cursor/VS Code) or MCP server (for other agents), creates an API key, and adds the neon-postgres agent skill to the project.
If init is not suitable, the individual steps can be run non-interactively:
cursor --install-extension databricks.neon-local-connectnpx -y add-mcp https://mcp.neon.tech/mcp -g -n Neon -y -a <agent-name>npx skills add neondatabase/agent-skills --skill neon-postgres --agent <agent-name> -yFor full CLI installation options, see https://neon.com/docs/reference/cli-install.md
1. Select Organization and Project
Use MCP server or CLI to list organizations and projects. Let the user select an existing project or create a new one.
2. Get Connection String
Use MCP server or CLI to get the connection string. Store it in .env as DATABASE_URL. Read the file first before modifying to avoid overwriting existing values.
3. Pick Connection Method & Driver
Refer to the connection methods guide to pick the correct driver based on deployment platform: https://neon.com/docs/connect/choose-connection.md
4. User Authentication with Neon Auth (if needed)
Skip for CLI tools, scripts, or apps without user accounts. If the app needs auth: use MCP server provision_neon_auth tool, then see the auth overview (https://neon.com/docs/auth/overview.md) for setup. For auth + database queries, see the JavaScript SDK reference (https://neon.com/docs/reference/javascript-sdk.md).
5. ORM Setup (optional)
Check for existing ORM (Prisma, Drizzle, TypeORM). If none, ask if they want one. For Drizzle integration, see https://neon.com/docs/guides/drizzle.md.
6. Schema Setup
If resuming setup, check what's already configured (MCP connection, .env with DATABASE_URL, dependencies, schema) and continue from the next incomplete step.
Remind users to use environment variables for credentials, never commit connection strings, and use least-privilege database roles.
Use this when you need to pick the correct transport and driver based on runtime constraints (TCP, HTTP, WebSocket, edge, serverless, long-running).
Link: https://neon.com/docs/connect/choose-connection.md
Use this for @neondatabase/serverless patterns, including HTTP queries, WebSocket transactions, and runtime-specific optimizations.
Link: https://neon.com/docs/serverless/serverless-driver.md
Use this for combined Neon Auth + Data API workflows with PostgREST-style querying and typed client setup.
Link: https://neon.com/docs/reference/javascript-sdk.md
Use this for local development enablement with npx -y neonctl@latest init --agent <agent-name>, VSCode extension setup, and Neon MCP server configuration.
| Tool | URL | | ---------------- | ----------------------------------------------- | | CLI Init Command | https://neon.com/docs/reference/cli-init.md | | VSCode Extension | https://neon.com/docs/local/vscode-extension.md | | MCP Server | https://neon.com/docs/ai/neon-mcp-server.md | | Neon CLI | https://neon.com/docs/reference/neon-cli.md |
Use this for terminal-first workflows, scripts, and CI/CD automation with neonctl.
Link: https://neon.com/docs/reference/neon-cli.md
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.
Use this for direct HTTP automation, endpoint-level control, API key auth, rate-limit handling, and operation polling.
Link: https://neon.com/docs/reference/api-reference.md
Use this when implementing typed programmatic control of Neon resources in TypeScript via @neondatabase/api-client.
Link: https://neon.com/docs/reference/typescript-sdk.md
Use this when implementing programmatic Neon management in Python with the neon-api package.
Link: https://neon.com/docs/reference/python-sdk.md
Use this for managed user authentication setup, UI components, auth methods, and Neon Auth integration pitfalls in Next.js and React apps.
Link: https://neon.com/docs/auth/overview.md
Neon Auth is also embedded in the Neon JS SDK. Depending on your use case, you may want to use the Neon JS SDK instead of Neon Auth alone. See https://neon.com/docs/connect/choose-connection.md for more details.
Use this when the user is planning isolated environments, schema migration testing, preview deployments, or branch lifecycle automation.
Key points:
Link: https://neon.com/docs/introduction/branching.md
For detailed branch creation workflows (normal vs schema-only branches, reset-from-parent, CLI/MCP selection), use the neon-postgres-branches skill if available
Or fetch the full branching skill from the following URL:
https://neon.com/docs/ai/skills/neon-postgres-branches/SKILL.md
If this skill is not installed you can use the following command to install it:
npx skills add neondatabase/agent-skills --skill neon-postgres-branches
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
Use this when optimizing idle costs and discussing suspend/resume behavior, including cold-start trade-offs.
Key points:
Link: https://neon.com/docs/introduction/scale-to-zero.md
Use this when the user needs point-in-time recovery or wants to restore data state without traditional backup restore workflows.
Key points:
Link: https://neon.com/docs/introduction/branch-restore.md
Use this for read-heavy workloads where the user needs dedicated read-only compute without duplicating storage.
Key points:
Link: https://neon.com/docs/introduction/read-replicas.md
Use this when the user is in serverless or high-concurrency environments and needs safe, scalable Postgres connection management.
Key points:
-pooler to endpoint hostnames to use pooled connections.Link: https://neon.com/docs/connect/connection-pooling.md
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
Use this when integrating CDC pipelines, external Postgres sync, or replication-based data movement.
Key points:
Link: https://neon.com/docs/guides/logical-replication-guide.md
tools
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".
tools
Provision instant temporary Postgres databases via Claimable Postgres by Neon (neon.new) with no login, signup, or credit card. Supports REST API, CLI, and SDK. Use when users ask for a quick Postgres environment, a throwaway DATABASE_URL for prototyping/tests, or "just give me a DB now". Triggers include: "quick postgres", "temporary postgres", "no signup database", "no credit card database", "instant DATABASE_URL", "npx neon-new", "neon.new", "neon.new API", "claimable postgres API".
development
Diagnose and fix excessive Postgres egress (network data transfer) in a codebase. Use when a user mentions high database bills, unexpected data transfer costs, network transfer charges, egress spikes, "why is my Neon bill so high", "database costs jumped", SELECT * optimization, query overfetching, reduce Neon costs, optimize database usage, or wants to reduce data sent from their database to their application. Also use when reviewing query patterns for cost efficiency, even if the user doesn't explicitly mention egress or data transfer.
data-ai
--- name: score-eval disable-model-invocation: true --- Score the eval diff at $ARGUMENTS against the eval rubric. 1. Read the diff file at the path provided 2. Read the eval rubric at eval-rubric.md 3. Read the original fixture app in fixtures/hono-drizzle-app/ for comparison 4. For each problem P1-P5, answer the Detected? and Fixed? questions from the rubric as yes or no 5. Append a row to results.csv — fill in all fields you can determine from the diff and context. Leave fields you can't de