vybekiit 0.7.4 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +10483 -1704
- package/dist/global-skills/aws-cdk/SKILL.md +2 -1
- package/dist/global-skills/aws-cloudformation/SKILL.md +2 -1
- package/dist/global-skills/aws-serverless/SKILL.md +45 -44
- package/dist/global-skills/aws-serverless/assets/powertools-handler.py +2 -1
- package/dist/global-skills/aws-serverless/references/api-gateway.md +50 -470
- package/dist/global-skills/aws-serverless/references/architecture.md +47 -186
- package/dist/global-skills/aws-serverless/references/concurrency.md +44 -158
- package/dist/global-skills/aws-serverless/references/deployment.md +1 -1
- package/dist/global-skills/aws-serverless/references/event-sources.md +72 -391
- package/dist/global-skills/aws-serverless/references/lambda.md +69 -428
- package/dist/global-skills/aws-serverless/references/orchestration.md +65 -384
- package/dist/global-skills/aws-serverless/references/production.md +78 -415
- package/dist/global-skills/aws-serverless/references/troubleshooting.md +92 -619
- package/dist/global-skills/claimable-postgres/SKILL.md +60 -49
- package/dist/global-skills/design-my-data/SKILL.md +2 -0
- package/dist/global-skills/eas-app-stores/SKILL.md +8 -0
- package/dist/global-skills/eas-app-stores/references/play-store.md +2 -0
- package/dist/global-skills/eas-hosting/SKILL.md +8 -0
- package/dist/global-skills/eas-observe/SKILL.md +30 -8
- package/dist/global-skills/eas-observe/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-observe/references/metrics.md +54 -3
- package/dist/global-skills/eas-observe/references/queries.md +78 -17
- package/dist/global-skills/eas-observe/references/setup.md +164 -5
- package/dist/global-skills/eas-observe/references/third-party.md +136 -0
- package/dist/global-skills/eas-simulator/SKILL.md +63 -11
- package/dist/global-skills/eas-simulator/references/controllers.md +21 -2
- package/dist/global-skills/eas-simulator/references/run-your-app.md +16 -11
- package/dist/global-skills/eas-simulator/references/troubleshooting.md +8 -5
- package/dist/global-skills/eas-update-insights/SKILL.md +8 -0
- package/dist/global-skills/eas-workflows/SKILL.md +15 -10
- package/dist/global-skills/eas-workflows/scripts/package.json +2 -7
- package/dist/global-skills/email-best-practices/.github/workflows/sync-skills.yml +30 -0
- package/dist/global-skills/email-best-practices/README.md +63 -0
- package/dist/global-skills/email-best-practices/references/accessibility.md +189 -0
- package/dist/global-skills/email-best-practices/references/compliance.md +125 -0
- package/dist/global-skills/email-best-practices/references/deliverability.md +121 -0
- package/dist/global-skills/email-best-practices/references/email-capture.md +129 -0
- package/dist/global-skills/email-best-practices/references/email-types.md +173 -0
- package/dist/global-skills/email-best-practices/references/list-management.md +157 -0
- package/dist/global-skills/email-best-practices/references/marketing-emails.md +115 -0
- package/dist/global-skills/email-best-practices/references/sending-reliability.md +155 -0
- package/dist/global-skills/email-best-practices/references/transactional-email-catalog.md +418 -0
- package/dist/global-skills/email-best-practices/references/transactional-emails.md +92 -0
- package/dist/global-skills/email-best-practices/references/webhooks-events.md +167 -0
- package/dist/global-skills/email-best-practices/tests/README.md +35 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/01-spam-deliverability.md +46 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/02-multi-region-compliance.md +48 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/03-retry-idempotency.md +36 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/04-webhook-bounce-handling.md +52 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/05-new-saas-email-plan.md +51 -0
- package/dist/global-skills/expo-animation/LICENSE +21 -0
- package/dist/global-skills/expo-animation/RECIPES.md +385 -0
- package/dist/global-skills/expo-animation/SKILL.md +267 -0
- package/dist/global-skills/expo-animation/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-app-clip/SKILL.md +8 -0
- package/dist/global-skills/expo-brownfield/SKILL.md +8 -0
- package/dist/global-skills/expo-brownfield/references/brownfield-isolated.md +53 -4
- package/dist/global-skills/expo-data-fetching/SKILL.md +8 -0
- package/dist/global-skills/expo-design-system/SKILL.md +356 -0
- package/dist/global-skills/expo-design-system/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-design-system/references/audit.md +185 -0
- package/dist/global-skills/expo-dev-client/SKILL.md +8 -0
- package/dist/global-skills/expo-dom/SKILL.md +8 -0
- package/dist/global-skills/expo-examples/SKILL.md +8 -0
- package/dist/global-skills/expo-migrate-module/SKILL.md +113 -0
- package/dist/global-skills/expo-migrate-module/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-migrate-module/references/compatibility.md +73 -0
- package/dist/global-skills/expo-migrate-module/references/example.md +212 -0
- package/dist/global-skills/expo-migrate-module/references/migration-map.md +306 -0
- package/dist/global-skills/expo-module/SKILL.md +11 -1
- package/dist/global-skills/expo-native-ui/SKILL.md +8 -0
- package/dist/global-skills/expo-project-structure/SKILL.md +114 -0
- package/dist/global-skills/expo-project-structure/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-router/SKILL.md +8 -0
- package/dist/global-skills/expo-skill-feedback/SKILL.md +66 -33
- package/dist/global-skills/expo-skill-feedback/agents/openai.yaml +2 -2
- package/dist/global-skills/expo-tailwind-setup/SKILL.md +8 -0
- package/dist/global-skills/expo-ui/SKILL.md +8 -0
- package/dist/global-skills/expo-upgrade/SKILL.md +15 -1
- package/dist/global-skills/expo-web-to-native/SKILL.md +8 -0
- package/dist/global-skills/extension-to-functions-codebase/SKILL.md +129 -0
- package/dist/global-skills/extension-to-functions-codebase/references/configuration-migration.md +161 -0
- package/dist/global-skills/extension-to-functions-codebase/references/destructuring-shim.md +122 -0
- package/dist/global-skills/extension-to-functions-codebase/references/signature-mapping.md +84 -0
- package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +61 -19
- package/dist/global-skills/firebase-ai-logic-basics/references/flutter_setup.md +6 -3
- package/dist/global-skills/firebase-app-hosting-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-auth-basics/SKILL.md +4 -2
- package/dist/global-skills/firebase-basics/SKILL.md +5 -5
- package/dist/global-skills/firebase-crashlytics/SKILL.md +2 -0
- package/dist/global-skills/firebase-data-connect/SKILL.md +2 -0
- package/dist/global-skills/firebase-firestore/SKILL.md +3 -6
- package/dist/global-skills/firebase-hosting-basics/SKILL.md +4 -1
- package/dist/global-skills/firebase-remote-config-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +4 -1
- package/dist/global-skills/harden/SKILL.md +2 -1
- package/dist/global-skills/instrument-feature-flags/SKILL.md +1 -0
- package/dist/global-skills/instrument-feature-flags/references/COMMANDMENTS.md +5 -0
- package/dist/global-skills/instrument-feature-flags/references/adding-feature-flag-code.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/android.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/api.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/best-practices.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/django.md +38 -5
- package/dist/global-skills/instrument-feature-flags/references/dotnet.md +10 -4
- package/dist/global-skills/instrument-feature-flags/references/elixir.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/flask.md +17 -5
- package/dist/global-skills/instrument-feature-flags/references/flutter.md +7 -5
- package/dist/global-skills/instrument-feature-flags/references/go.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ios.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/java.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/laravel.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/next-js.md +74 -8
- package/dist/global-skills/instrument-feature-flags/references/nodejs.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/php.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/python.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/react-native.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/react.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ruby-on-rails.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ruby.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/rust.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/usage.md +41 -4
- package/dist/global-skills/instrument-feature-flags/references/web.md +7 -5
- package/dist/global-skills/instrument-product-analytics/SKILL.md +2 -1
- package/dist/global-skills/instrument-product-analytics/references/COMMANDMENTS.md +5 -0
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-hybrid.md +12 -14
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-ssr.md +25 -21
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-django.md +75 -55
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-fastapi.md +3 -6
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-flask.md +26 -16
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-3-6.md +8 -5
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-4.md +4 -4
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-react-react-router-7-framework.md +3 -3
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-ruby-on-rails.md +8 -4
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-tanstack-start.md +20 -8
- package/dist/global-skills/instrument-product-analytics/references/android.md +46 -4
- package/dist/global-skills/instrument-product-analytics/references/angular.md +41 -5
- package/dist/global-skills/instrument-product-analytics/references/astro.md +41 -5
- package/dist/global-skills/instrument-product-analytics/references/configuration.md +7 -4
- package/dist/global-skills/instrument-product-analytics/references/django.md +38 -5
- package/dist/global-skills/instrument-product-analytics/references/dotnet.md +10 -4
- package/dist/global-skills/instrument-product-analytics/references/elixir.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/flask.md +17 -5
- package/dist/global-skills/instrument-product-analytics/references/flutter.md +49 -4
- package/dist/global-skills/instrument-product-analytics/references/go.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/identify-users.md +38 -7
- package/dist/global-skills/instrument-product-analytics/references/ios.md +14 -4
- package/dist/global-skills/instrument-product-analytics/references/laravel.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/next-js.md +74 -8
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js-3-6.md +39 -7
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js.md +40 -4
- package/dist/global-skills/instrument-product-analytics/references/php.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +21 -17
- package/dist/global-skills/instrument-product-analytics/references/python.md +15 -5
- package/dist/global-skills/instrument-product-analytics/references/react-native.md +41 -7
- package/dist/global-skills/instrument-product-analytics/references/react-router-v6.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-data-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-declarative-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-framework-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/ruby-on-rails.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/ruby.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/svelte.md +42 -6
- package/dist/global-skills/instrument-product-analytics/references/tanstack-start.md +31 -7
- package/dist/global-skills/instrument-product-analytics/references/usage.md +41 -4
- package/dist/global-skills/instrument-product-analytics/references/vue-js.md +42 -6
- package/dist/global-skills/manifest.json +6 -1
- package/dist/global-skills/neon/SKILL.md +235 -121
- package/dist/global-skills/neon-ai-gateway/SKILL.md +95 -16
- package/dist/global-skills/neon-functions/SKILL.md +242 -152
- package/dist/global-skills/neon-functions/references/ai-sdk.md +9 -3
- package/dist/global-skills/neon-functions/references/mastra-studio.md +1 -1
- package/dist/global-skills/neon-functions/references/mcp.md +13 -4
- package/dist/global-skills/neon-functions/references/sentry.md +165 -52
- package/dist/global-skills/neon-functions/references/sse.md +23 -6
- package/dist/global-skills/neon-object-storage/SKILL.md +40 -16
- package/dist/global-skills/neon-postgres/SKILL.md +63 -262
- package/dist/global-skills/neon-postgres-branches/SKILL.md +61 -50
- package/dist/global-skills/neon-postgres-egress-optimizer/SKILL.md +22 -3
- package/dist/global-skills/resend/SKILL.md +6 -6
- package/dist/global-skills/resend/references/automations.md +2 -2
- package/dist/global-skills/resend/references/broadcasts.md +11 -3
- package/dist/global-skills/resend/references/domains.md +25 -3
- package/dist/global-skills/resend/references/installation.md +7 -7
- package/dist/global-skills/setup-payments/SKILL.md +4 -5
- package/dist/global-skills/stripe-best-practices/SKILL.md +32 -7
- package/dist/global-skills/stripe-best-practices/references/billing.md +11 -1
- package/dist/global-skills/stripe-best-practices/references/payments.md +23 -2
- package/dist/global-skills/stripe-best-practices/references/security.md +21 -11
- package/dist/global-skills/stripe-best-practices/references/tax.md +116 -11
- package/dist/global-skills/supabase/CHANGELOG.md +25 -0
- package/dist/global-skills/supabase/SKILL.md +5 -1
- package/dist/global-skills/supabase-postgres-best-practices/CHANGELOG.md +30 -0
- package/dist/global-skills/supabase-postgres-best-practices/SKILL.md +1 -1
- package/dist/global-skills/use-kit-mcp/SKILL.md +5 -5
- package/dist/global-skills/use-railway/SKILL.md +4 -4
- package/dist/global-skills/use-railway/references/iac.md +206 -57
- package/dist/global-skills/use-railway/scripts/railway-api.sh +7 -2
- package/dist/global-skills/xcode-project-setup/SKILL.md +2 -0
- package/package.json +12 -9
- package/LICENSE.md +0 -47
- package/dist/global-skills/eas-workflows/scripts/validate.js +0 -84
- package/dist/global-skills/expo-skill-feedback/scripts/skill-feedback.cjs +0 -118
- package/dist/global-skills/neon-functions/references/hono-websockets.md +0 -145
|
@@ -1,284 +1,74 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: neon-postgres
|
|
3
3
|
description: >-
|
|
4
|
-
Guides and best practices for working with
|
|
5
|
-
Covers setup, connection methods
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
Guides and best practices for working with Lakebase Postgres, the database
|
|
5
|
+
behind Neon. Covers setup, connection methods and drivers, pooled vs direct
|
|
6
|
+
connections, branching, schema migrations, autoscaling, scale-to-zero, instant
|
|
7
|
+
restore, read replicas, connection pooling, IP allow lists, and logical
|
|
8
|
+
replication.
|
|
9
|
+
Use when users ask about "Lakebase Postgres", "Neon setup", "connect to Neon",
|
|
10
|
+
"Neon project", "DATABASE_URL", "serverless Postgres", "Neon CLI", "neon", "Neon MCP",
|
|
10
11
|
"Neon Auth", "@neondatabase/serverless", "@neondatabase/neon-js",
|
|
11
|
-
"scale to zero", "Neon autoscaling", "Neon read replica",
|
|
12
|
-
"Neon connection pooling".
|
|
12
|
+
"scale to zero", "Neon autoscaling", "Neon read replica",
|
|
13
|
+
"Neon connection pooling", or "schema migrations".
|
|
14
|
+
metadata:
|
|
15
|
+
parent: neon
|
|
16
|
+
source: https://github.com/neondatabase/agent-skills/tree/main/skills/neon-postgres
|
|
13
17
|
---
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
**FIRST**: Use the parent `neon` skill for a Neon overview, getting started with Neon, Neon development best practices, and more.
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
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.
|
|
20
|
-
|
|
21
|
-
## Neon Documentation
|
|
22
|
-
|
|
23
|
-
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.
|
|
24
|
-
|
|
25
|
-
### Fetching Docs as Markdown
|
|
26
|
-
|
|
27
|
-
Any Neon doc page can be fetched as markdown in two ways:
|
|
28
|
-
|
|
29
|
-
1. **Append `.md` to the URL** (simplest): https://neon.com/docs/introduction/branching.md
|
|
30
|
-
2. **Request `text/markdown`** on the standard URL: `curl -H "Accept: text/markdown" https://neon.com/docs/introduction/branching`
|
|
31
|
-
|
|
32
|
-
Both return the same markdown content. Use whichever method your tools support.
|
|
33
|
-
|
|
34
|
-
### Finding the Right Page
|
|
35
|
-
|
|
36
|
-
The docs index lists every available page with its URL and a short description:
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
https://neon.com/docs/llms.txt
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
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.
|
|
43
|
-
|
|
44
|
-
## What Is Neon
|
|
45
|
-
|
|
46
|
-
Use this for architecture explanations and terminology (organizations, projects, branches, endpoints) before giving implementation advice.
|
|
47
|
-
|
|
48
|
-
Link: https://neon.com/docs/introduction/architecture-overview.md
|
|
49
|
-
|
|
50
|
-
## Getting Started
|
|
51
|
-
|
|
52
|
-
Use this section when guiding a user through first-time Neon setup.
|
|
53
|
-
|
|
54
|
-
### Check Status Quo
|
|
55
|
-
|
|
56
|
-
Before starting setup, inspect the user's codebase and environment:
|
|
57
|
-
|
|
58
|
-
- Existing database connection code
|
|
59
|
-
- Existing Neon MCP server or Neon CLI configuration
|
|
60
|
-
- Existence of a `.env` file and `DATABASE_URL` environment variable
|
|
61
|
-
- Existing ORM (Prisma, Drizzle, TypeORM) configuration
|
|
62
|
-
|
|
63
|
-
### Self-Driving Setup With Neon's CLI or MCP Server
|
|
64
|
-
|
|
65
|
-
Offer 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.
|
|
21
|
+
If the `neon` skill is not installed, fetch it from https://neon.com/docs/ai/skills/neon/SKILL.md or install it with:
|
|
66
22
|
|
|
67
23
|
```bash
|
|
68
|
-
npx
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Supported `--agent` values: `cursor`, `copilot`, `claude`, `claude-desktop`, `codex`, `opencode`, `cline`, `gemini-cli`, `goose`, `zed`.
|
|
72
|
-
|
|
73
|
-
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.
|
|
74
|
-
|
|
75
|
-
If `init` is not suitable, the individual steps can be run non-interactively:
|
|
76
|
-
|
|
77
|
-
- **Extension:** `cursor --install-extension databricks.neon-local-connect`
|
|
78
|
-
- **MCP server:** `npx -y add-mcp https://mcp.neon.tech/mcp -g -n Neon -y -a <agent-name>`
|
|
79
|
-
- **Agent skill:** `npx skills add neondatabase/agent-skills --skill neon-postgres --agent <agent-name> -y`
|
|
80
|
-
|
|
81
|
-
For full CLI installation options, see https://neon.com/docs/reference/cli-install.md
|
|
82
|
-
|
|
83
|
-
### Setup Flow
|
|
84
|
-
|
|
85
|
-
**1. Select Organization and Project**
|
|
86
|
-
|
|
87
|
-
Use MCP server or CLI to list organizations and projects. Let the user select an existing project or create a new one.
|
|
88
|
-
|
|
89
|
-
**2. Get Connection String**
|
|
90
|
-
|
|
91
|
-
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.
|
|
92
|
-
|
|
93
|
-
**3. Pick Connection Method & Driver**
|
|
94
|
-
|
|
95
|
-
Refer to the connection methods guide to pick the correct driver based on deployment platform: https://neon.com/docs/connect/choose-connection.md
|
|
96
|
-
|
|
97
|
-
**4. User Authentication with Neon Auth (if needed)**
|
|
98
|
-
|
|
99
|
-
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).
|
|
100
|
-
|
|
101
|
-
**5. ORM Setup (optional)**
|
|
102
|
-
|
|
103
|
-
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.
|
|
104
|
-
|
|
105
|
-
**6. Schema Setup**
|
|
106
|
-
|
|
107
|
-
- Check for existing migration files or ORM schemas
|
|
108
|
-
- If none: offer to create an example schema or design one together
|
|
109
|
-
|
|
110
|
-
### Resume Support
|
|
111
|
-
|
|
112
|
-
If resuming setup, check what's already configured (MCP connection, `.env` with `DATABASE_URL`, dependencies, schema) and continue from the next incomplete step.
|
|
113
|
-
|
|
114
|
-
### Security Reminders
|
|
115
|
-
|
|
116
|
-
Remind users to use environment variables for credentials, never commit connection strings, and use least-privilege database roles.
|
|
117
|
-
|
|
118
|
-
## Connection Methods & Drivers
|
|
119
|
-
|
|
120
|
-
Use this when you need to pick the correct transport and driver based on runtime constraints (TCP, HTTP, WebSocket, edge, serverless, long-running).
|
|
121
|
-
|
|
122
|
-
Link: https://neon.com/docs/connect/choose-connection.md
|
|
123
|
-
|
|
124
|
-
### Recommended: Drizzle + the right driver for your runtime
|
|
125
|
-
|
|
126
|
-
Always pair Neon with an ORM such as **Drizzle** for easy schema management and migrations. Pick the driver based on how the runtime treats your code:
|
|
127
|
-
|
|
128
|
-
- **Long-running or shared-runtime environments → node-postgres (`pg`).** Neon Functions, and any host where the function runtime is shared across requests / runs on fluid compute (e.g. **Vercel** with Fluid compute), keep a module-scope process alive across many requests. Open a `pg` pool **once at module scope** and reuse it across requests.
|
|
129
|
-
- **Fully isolated serverless (Lambda-style) → Neon's serverless driver (`@neondatabase/serverless`).** Hosts like **Netlify** spin up a fresh, isolated instance per request, so a persistent TCP pool can't be reused; the serverless driver queries over HTTP and is built for this.
|
|
130
|
-
|
|
131
|
-
**Neon Functions / Vercel / fluid compute — Drizzle + node-postgres:**
|
|
132
|
-
|
|
133
|
-
```typescript
|
|
134
|
-
import { drizzle } from "drizzle-orm/node-postgres";
|
|
135
|
-
import { Pool } from "pg";
|
|
136
|
-
import * as schema from "./schema";
|
|
137
|
-
|
|
138
|
-
// Created once at module scope; reused by every request the instance handles.
|
|
139
|
-
const pool = new Pool({ connectionString: process.env.DATABASE_URL, max: 5 });
|
|
140
|
-
const db = drizzle({ client: pool, schema });
|
|
24
|
+
npx skills add neondatabase/agent-skills --skill neon
|
|
141
25
|
```
|
|
142
26
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
import { drizzle } from "drizzle-orm/node-postgres";
|
|
147
|
-
import { Pool } from "pg";
|
|
148
|
-
import { attachDatabasePool } from "@vercel/functions";
|
|
149
|
-
import * as schema from "./schema";
|
|
150
|
-
|
|
151
|
-
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
152
|
-
attachDatabasePool(pool); // let the Vercel runtime manage the pooled connections
|
|
153
|
-
const db = drizzle({ client: pool, schema });
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
**Netlify and other fully-isolated serverless — Drizzle + Neon serverless driver:**
|
|
157
|
-
|
|
158
|
-
```typescript
|
|
159
|
-
import { drizzle } from "drizzle-orm/neon-http";
|
|
160
|
-
import { neon } from "@neondatabase/serverless";
|
|
161
|
-
|
|
162
|
-
const sql = neon(process.env.DATABASE_URL!);
|
|
163
|
-
const db = drizzle({ client: sql });
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Serverless Driver
|
|
167
|
-
|
|
168
|
-
Use this for `@neondatabase/serverless` patterns, including HTTP queries, WebSocket transactions, and runtime-specific optimizations.
|
|
27
|
+
# Lakebase Postgres
|
|
169
28
|
|
|
170
|
-
|
|
29
|
+
Lakebase Postgres is the database at the core of Neon. It runs on the lakebase architecture — OLTP built directly on cloud object storage — which decouples storage from compute 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.
|
|
171
30
|
|
|
172
|
-
|
|
31
|
+
It is the same database whether you reach it through Neon or through Databricks; this skill covers the Neon access path.
|
|
173
32
|
|
|
174
|
-
|
|
33
|
+
## Setup Flow
|
|
175
34
|
|
|
176
|
-
|
|
35
|
+
### 1. Select the organization and project
|
|
177
36
|
|
|
178
|
-
|
|
37
|
+
Use the CLI (default) or MCP server to list organizations and projects. Let the user select an existing project or create a new one. Check the `.neon` file for an existing linked project or branch.
|
|
179
38
|
|
|
180
|
-
|
|
39
|
+
### 2. Get the connection string
|
|
181
40
|
|
|
182
|
-
|
|
183
|
-
| ---------------- | ----------------------------------------------- |
|
|
184
|
-
| CLI Init Command | https://neon.com/docs/reference/cli-init.md |
|
|
185
|
-
| VSCode Extension | https://neon.com/docs/local/vscode-extension.md |
|
|
186
|
-
| MCP Server | https://neon.com/docs/ai/neon-mcp-server.md |
|
|
187
|
-
| Neon CLI | https://neon.com/docs/reference/neon-cli.md |
|
|
41
|
+
Use the CLI (default), `neon env pull`, or the MCP server to get the connection string. Store it in `.env` as `DATABASE_URL`. Read the file first before modifying it, to avoid overwriting existing values.
|
|
188
42
|
|
|
189
|
-
|
|
43
|
+
#### When to use pooled vs direct connections
|
|
190
44
|
|
|
191
|
-
Use
|
|
45
|
+
| Use case | Connection type |
|
|
46
|
+
| ---------------------------------------- | ---------------- |
|
|
47
|
+
| Web applications, serverless functions | Pooled (-pooler) |
|
|
48
|
+
| Schema migrations | Direct |
|
|
49
|
+
| pg_dump / pg_restore | Direct |
|
|
50
|
+
| Logical replication | Direct |
|
|
51
|
+
| Long-running analytics with temp tables | Direct |
|
|
52
|
+
| Admin tasks needing SET or session state | Direct |
|
|
53
|
+
| LISTEN / NOTIFY | Direct |
|
|
192
54
|
|
|
193
|
-
|
|
55
|
+
### 3. Pick the connection method and driver
|
|
194
56
|
|
|
195
|
-
|
|
57
|
+
Always pair Neon with an ORM such as **Drizzle** for easy schema management and migrations. Refer to the connection methods guide to pick the correct driver based on how the runtime treats your code: https://neon.com/docs/connect/choose-connection.md.
|
|
196
58
|
|
|
197
|
-
|
|
59
|
+
Recommendations:
|
|
198
60
|
|
|
199
|
-
|
|
61
|
+
- Drizzle as ORM (see https://neon.com/docs/guides/drizzle.md)
|
|
62
|
+
- On Vercel, use `node-postgres` (`npm install pg`) with Vercel Fluid compute and `import { attachDatabasePool } from "@vercel/functions";`
|
|
63
|
+
- On Cloudflare, use `node-postgres` with Cloudflare Hyperdrive
|
|
64
|
+
- On Neon Functions, use `node-postgres`, as the functions are long-running and reuse the pool across requests.
|
|
65
|
+
- Use the `@neondatabase/serverless` driver for serverless and edge environments (for example, when using Netlify) — HTTP transport for one-shot queries, WebSocket for transaction support. Link: https://neon.com/docs/serverless/serverless-driver.md
|
|
200
66
|
|
|
201
|
-
|
|
67
|
+
### 4. Set up the schema
|
|
202
68
|
|
|
203
|
-
|
|
69
|
+
Manage schemas and migrations as code. Avoid running ad hoc schema migrations against your database, since they're hard to manage.
|
|
204
70
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
Use this when implementing typed programmatic control of Neon resources in TypeScript via `@neon/sdk` (the fetch-based, zero-dependency successor to `@neondatabase/api-client`).
|
|
208
|
-
|
|
209
|
-
Link: https://neon.com/docs/reference/typescript-sdk.md
|
|
210
|
-
|
|
211
|
-
### Neon Python SDK
|
|
212
|
-
|
|
213
|
-
Use this when implementing programmatic Neon management in Python with the `neon-api` package.
|
|
214
|
-
|
|
215
|
-
Link: https://neon.com/docs/reference/python-sdk.md
|
|
216
|
-
|
|
217
|
-
## Neon Auth
|
|
218
|
-
|
|
219
|
-
Use this for managed user authentication setup, UI components, auth methods, and Neon Auth integration pitfalls in Next.js and React apps.
|
|
220
|
-
|
|
221
|
-
Link: https://neon.com/docs/auth/overview.md
|
|
222
|
-
|
|
223
|
-
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.
|
|
224
|
-
|
|
225
|
-
## Neon Infrastructure as Code (`neon.ts`)
|
|
226
|
-
|
|
227
|
-
`neon.ts` is Neon's branch config and infrastructure-as-code file: declare which services your branches have, get type-safe env vars, and program per-branch compute — all in TypeScript (see the `neon` skill for the full reference). Postgres always exists on every branch, so you never declare the database itself; what you codify here is the Postgres-adjacent surface — Neon Auth, the Data API, and per-branch compute settings (autoscaling and scale-to-zero).
|
|
228
|
-
|
|
229
|
-
Add it with `@neon/config`:
|
|
230
|
-
|
|
231
|
-
```bash
|
|
232
|
-
npm i @neon/config
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
```typescript
|
|
236
|
-
// neon.ts
|
|
237
|
-
import { defineConfig } from "@neon/config/v1";
|
|
238
|
-
|
|
239
|
-
export default defineConfig({
|
|
240
|
-
auth: true, // Neon Auth (adds NEON_AUTH_* env vars)
|
|
241
|
-
dataApi: true, // Data API (adds NEON_DATA_API_URL); requires auth: true (or an external IdP)
|
|
242
|
-
// Postgres exists on every branch; tune its compute per branch:
|
|
243
|
-
branch: (branch) => {
|
|
244
|
-
if (branch.exists) return {}; // leave existing branches untouched
|
|
245
|
-
if (branch.isDefault) return { protected: true }; // prod keeps default compute
|
|
246
|
-
return {
|
|
247
|
-
ttl: "7d", // non-prod branches auto-expire (max 30d)
|
|
248
|
-
postgres: {
|
|
249
|
-
computeSettings: {
|
|
250
|
-
autoscalingLimitMinCu: 0.25, // scale to zero
|
|
251
|
-
autoscalingLimitMaxCu: 1, // keep dev/preview cheap
|
|
252
|
-
suspendTimeout: "5m",
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
},
|
|
257
|
-
});
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
Reconcile the declaration from the CLI — the Neon equivalent of `terraform plan` / `apply`:
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
neon config status # print the branch's live config
|
|
264
|
-
neon config plan # dry-run diff of what apply would change
|
|
265
|
-
neon config apply # provision the declared services / settings
|
|
266
|
-
neon deploy # alias for `neon config apply`
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
Because `neon checkout` applies the policy as it **creates** a branch, a fresh branch comes up with these compute settings (and Auth / Data API) already in place. Checking out an _existing_ branch never reconciles it — run `neon deploy` to apply changes.
|
|
270
|
-
|
|
271
|
-
Since `neon.ts` is TypeScript, invalid combinations fail to compile with an actionable message: the Data API verifies requests with Neon Auth by default, so `dataApi: true` without `auth: true` is a type error (the fix — `auth: true`, or `authProvider: 'external'` with a `jwksUrl` — is in the message). See the `neon` skill's type-safe config note.
|
|
272
|
-
|
|
273
|
-
Read the resulting env back, typed and validated against the policy, with `parseEnv` from `@neon/env`:
|
|
274
|
-
|
|
275
|
-
```typescript
|
|
276
|
-
import { parseEnv } from "@neon/env";
|
|
277
|
-
import config from "./neon";
|
|
278
|
-
|
|
279
|
-
const env = parseEnv(config);
|
|
280
|
-
env.postgres.databaseUrl; // typed; enabling auth / dataApi above surfaces env.auth / env.dataApi
|
|
281
|
-
```
|
|
71
|
+
If you're using an ORM, follow your ORM's best practices to manage schemas and migrations. For example, if using Drizzle, only use Drizzle for schema and migration management unless instructed otherwise.
|
|
282
72
|
|
|
283
73
|
## Branching
|
|
284
74
|
|
|
@@ -292,18 +82,18 @@ Key points:
|
|
|
292
82
|
|
|
293
83
|
Link: https://neon.com/docs/introduction/branching.md
|
|
294
84
|
|
|
295
|
-
For detailed branch creation workflows (normal vs schema-only branches, reset-from-parent, CLI/MCP selection), use the `neon-postgres-branches` skill
|
|
296
|
-
|
|
297
|
-
Or fetch the full branching skill from the following URL:
|
|
298
|
-
|
|
299
|
-
https://neon.com/docs/ai/skills/neon-postgres-branches/SKILL.md
|
|
300
|
-
|
|
301
|
-
If this skill is not installed you can use the following command to install it:
|
|
85
|
+
For detailed branch creation workflows (normal vs schema-only branches, reset-from-parent, CLI/MCP selection), use the `neon-postgres-branches` skill. If it isn't installed, fetch it from https://neon.com/docs/ai/skills/neon-postgres-branches/SKILL.md or install it with:
|
|
302
86
|
|
|
303
87
|
```bash
|
|
304
88
|
npx skills add neondatabase/agent-skills --skill neon-postgres-branches
|
|
305
89
|
```
|
|
306
90
|
|
|
91
|
+
## Migrations
|
|
92
|
+
|
|
93
|
+
Test a migration on a branch of production, against production-like data, before applying it to production.
|
|
94
|
+
|
|
95
|
+
Use a **direct (non-pooled)** connection string when you run the migration, not a pooled one. `neon connection-string` returns the direct string by default; make sure the hostname does not include the `-pooler` suffix.
|
|
96
|
+
|
|
307
97
|
## Autoscaling
|
|
308
98
|
|
|
309
99
|
Use this when the user needs compute to scale automatically with workload and wants guidance on CU sizing and runtime behavior.
|
|
@@ -316,7 +106,7 @@ Use this when optimizing idle costs and discussing suspend/resume behavior, incl
|
|
|
316
106
|
|
|
317
107
|
Key points:
|
|
318
108
|
|
|
319
|
-
- Idle computes suspend automatically
|
|
109
|
+
- Idle computes suspend automatically after a default of 5 minutes; the timeout is configurable, and suspension can only be disabled on the Launch and Scale plans.
|
|
320
110
|
- First query after suspend typically has a cold-start penalty (around hundreds of ms)
|
|
321
111
|
- Storage remains active while compute is suspended.
|
|
322
112
|
|
|
@@ -374,3 +164,14 @@ Key points:
|
|
|
374
164
|
- Useful for replicating to/from external Postgres systems.
|
|
375
165
|
|
|
376
166
|
Link: https://neon.com/docs/guides/logical-replication-guide.md
|
|
167
|
+
|
|
168
|
+
## Gotchas
|
|
169
|
+
|
|
170
|
+
### Pooled vs direct connections: use the direct URL for migrations, dumps, and replication
|
|
171
|
+
|
|
172
|
+
Neon gives you two connection strings for the same database: a **pooled** one (hostname with the `-pooler` suffix) and a **direct/unpooled** one (no `-pooler` suffix). `neon env pull` writes them as `DATABASE_URL` and `DATABASE_URL_UNPOOLED`. The pooled connection routes through PgBouncer in transaction mode, which doesn't support session-level operations. Choose the right one:
|
|
173
|
+
|
|
174
|
+
- **Pooled (`DATABASE_URL`)** — your application's normal query traffic, especially serverless and connection-per-request workloads.
|
|
175
|
+
- **Direct (`DATABASE_URL_UNPOOLED`)** — schema migrations (Prisma Migrate, Drizzle Kit, Alembic, and others), `pg_dump` / `pg_restore`, logical replication, `LISTEN`/`NOTIFY`, and anything relying on `SET` or other session state.
|
|
176
|
+
|
|
177
|
+
Running migrations, dumps, or replication over the pooled connection can fail, and never in a way that names pooling: `prepared statement "s0" already exists` from Prisma Migrate, a `SET search_path` that doesn't persist past its own transaction so the next query reports `relation "mytable" does not exist`, or a write intermittently hitting a read-only transaction (`SQLSTATE 25006`) that a pooled backend inherited from an earlier client. Migration tools generally take both strings at once — Prisma's `directUrl` alongside `url` — so point that at the direct one rather than swapping `DATABASE_URL` and losing pooling for the application. See https://neon.com/docs/connect/connection-pooling.md.
|
|
@@ -4,15 +4,27 @@ description: >-
|
|
|
4
4
|
Choose and create the right Neon branch type for testing and development.
|
|
5
5
|
Use when users ask about Neon branching, migration testing with real data,
|
|
6
6
|
isolated test environments, schema-only branch workflows for sensitive data,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
7
|
+
resetting a branch from its parent, branch expiration and CI/CD branch
|
|
8
|
+
lifecycles, or branch creation via Neon CLI or Neon MCP. Triggers include
|
|
9
|
+
"Neon branch", "test migrations safely", "branch production data",
|
|
10
|
+
"schema-only branch", "reset branch", "branch per PR" and
|
|
11
|
+
"sensitive data testing".
|
|
12
|
+
metadata:
|
|
13
|
+
parent: neon
|
|
14
|
+
source: https://github.com/neondatabase/agent-skills/tree/main/skills/neon-postgres-branches
|
|
10
15
|
---
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
**FIRST**: Use the parent `neon` skill for a Neon overview, getting started with Neon, Neon development best practices, and more.
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
If the `neon` skill is not installed, fetch it from https://neon.com/docs/ai/skills/neon/SKILL.md or install it with:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx skills add neondatabase/agent-skills --skill neon
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
# Lakebase Postgres Branching
|
|
26
|
+
|
|
27
|
+
**Outcome:** a created Neon branch — or a clear, actionable next step if creation cannot proceed. Choose the correct branch type, then execute branch creation with the CLI (or MCP where the CLI isn't usable).
|
|
16
28
|
|
|
17
29
|
- **Normal branch** for realistic migration and query testing with real data.
|
|
18
30
|
- **Schema-only branch (Beta)** for sensitive data workflows where structure is needed without copying rows.
|
|
@@ -29,21 +41,20 @@ If the request is ambiguous, ask one clarifying question:
|
|
|
29
41
|
|
|
30
42
|
## Tool Selection: CLI or MCP
|
|
31
43
|
|
|
32
|
-
|
|
44
|
+
Support both the Neon CLI and the Neon MCP server, but **default to the CLI**. Use MCP only when the CLI is unavailable or blocked in your environment, cannot be authenticated, or the user explicitly asks for MCP.
|
|
33
45
|
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
- CLI link: https://neon.com/docs/cli/quickstart.md
|
|
47
|
+
- MCP link: https://neon.com/docs/ai/neon-mcp-server.md
|
|
36
48
|
|
|
37
49
|
### Selection order
|
|
38
50
|
|
|
39
|
-
1. Check
|
|
40
|
-
-
|
|
41
|
-
2. If MCP is unavailable or not authenticated, check CLI:
|
|
42
|
-
- Run `neon --version` to confirm CLI is installed.
|
|
51
|
+
1. Check the CLI first:
|
|
52
|
+
- Run `neon --version` to confirm the CLI is installed.
|
|
43
53
|
- Run `neon projects list` to confirm auth/context.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
2. If the CLI is missing, direct installation via quickstart.
|
|
55
|
+
3. If the CLI is installed but not authenticated, guide the user through `neon auth` (or API key auth), then continue.
|
|
56
|
+
4. Switch to MCP when the CLI cannot be used — no CLI access in the environment, execution blocked, or authentication not possible — or when the user explicitly asks for MCP. Confirm Neon MCP tools are available and authenticated (for example, listing projects works), then follow the MCP branch flow below.
|
|
57
|
+
5. If neither path is successful, use the Neon REST API:
|
|
47
58
|
- https://neon.com/docs/guides/branching-neon-api.md
|
|
48
59
|
|
|
49
60
|
### MCP branch flow
|
|
@@ -62,22 +73,22 @@ Link: https://neon.com/docs/introduction/branching.md
|
|
|
62
73
|
|
|
63
74
|
### Steps
|
|
64
75
|
|
|
65
|
-
1.
|
|
76
|
+
1. Settle the tool path first (see [Selection order](#selection-order)): verify the CLI with `neon --version`, and fall back to MCP only if the CLI isn't usable.
|
|
66
77
|
2. Ensure project context is set (`neon set-context --project-id <your-project-id>`) or include `--project-id` on commands.
|
|
67
|
-
3. Create branch:
|
|
78
|
+
3. Create the branch:
|
|
68
79
|
|
|
69
|
-
```bash
|
|
70
|
-
neon branches create \
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
```
|
|
80
|
+
```bash
|
|
81
|
+
neon branches create \
|
|
82
|
+
--name <branch-name> \
|
|
83
|
+
--parent <parent-branch-id-or-name> \
|
|
84
|
+
--expires-at 2026-12-15T18:02:16Z
|
|
85
|
+
```
|
|
75
86
|
|
|
76
87
|
4. Optionally fetch a connection string for the new branch:
|
|
77
88
|
|
|
78
|
-
```bash
|
|
79
|
-
neon connection-string <branch-name>
|
|
80
|
-
```
|
|
89
|
+
```bash
|
|
90
|
+
neon connection-string <branch-name>
|
|
91
|
+
```
|
|
81
92
|
|
|
82
93
|
## Create a Schema-Only Branch (Beta, Sensitive Data)
|
|
83
94
|
|
|
@@ -87,27 +98,27 @@ Link: https://neon.com/docs/guides/branching-schema-only.md
|
|
|
87
98
|
|
|
88
99
|
### Steps
|
|
89
100
|
|
|
90
|
-
1.
|
|
91
|
-
2. Create schema-only branch:
|
|
101
|
+
1. Settle the tool path first (see [Selection order](#selection-order)): verify the CLI with `neon --version`, and fall back to MCP only if the CLI isn't usable.
|
|
102
|
+
2. Create the schema-only branch:
|
|
92
103
|
|
|
93
|
-
```bash
|
|
94
|
-
neon branches create \
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
```
|
|
104
|
+
```bash
|
|
105
|
+
neon branches create \
|
|
106
|
+
--name <schema-only-branch-name> \
|
|
107
|
+
--parent <parent-branch-id-or-name> \
|
|
108
|
+
--schema-only \
|
|
109
|
+
--expires-at 2026-12-15T18:02:16Z
|
|
110
|
+
```
|
|
100
111
|
|
|
101
|
-
If multiple projects exist, include
|
|
112
|
+
If multiple projects exist, include `--project-id`:
|
|
102
113
|
|
|
103
|
-
```bash
|
|
104
|
-
neon branches create \
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
```
|
|
114
|
+
```bash
|
|
115
|
+
neon branches create \
|
|
116
|
+
--name <schema-only-branch-name> \
|
|
117
|
+
--parent <parent-branch-id-or-name> \
|
|
118
|
+
--schema-only \
|
|
119
|
+
--project-id <your-project-id> \
|
|
120
|
+
--expires-at 2026-12-15T18:02:16Z
|
|
121
|
+
```
|
|
111
122
|
|
|
112
123
|
### Beta Support Guidance (Mandatory)
|
|
113
124
|
|
|
@@ -118,7 +129,7 @@ Schema-only branching is in Beta. If users report unexpected behavior, errors, o
|
|
|
118
129
|
2. Recommend opening a support conversation in the Neon Discord:
|
|
119
130
|
- https://discord.gg/92vNTzKDGp
|
|
120
131
|
|
|
121
|
-
## Reset from
|
|
132
|
+
## Reset from Parent
|
|
122
133
|
|
|
123
134
|
Use this when a child branch has drifted and the user wants a clean refresh from the parent branch's latest schema and data.
|
|
124
135
|
|
|
@@ -149,7 +160,7 @@ Link: https://neon.com/docs/guides/reset-from-parent.md
|
|
|
149
160
|
neon branches reset <id|name> --parent --preserve-under-name <backup-branch-name>
|
|
150
161
|
```
|
|
151
162
|
|
|
152
|
-
If project context is not already set, include project ID:
|
|
163
|
+
If project context is not already set, include the project ID:
|
|
153
164
|
|
|
154
165
|
```bash
|
|
155
166
|
neon branches reset <id|name> --parent --preserve-under-name <backup-branch-name> --project-id <project-id>
|
|
@@ -253,7 +264,7 @@ Common CI/CD use cases for Neon branches:
|
|
|
253
264
|
|
|
254
265
|
1. Recommend a normal branch and explain why.
|
|
255
266
|
2. Share docs link: https://neon.com/docs/introduction/branching
|
|
256
|
-
3. Check the
|
|
267
|
+
3. Check the tool path first (CLI with `neon --version`; MCP only if the CLI isn't usable).
|
|
257
268
|
4. Provide commands:
|
|
258
269
|
- `neon branches create --name migration-test --parent main --expires-at 2026-12-15T18:02:16Z`
|
|
259
270
|
- `neon connection-string migration-test`
|
|
@@ -266,14 +277,14 @@ Common CI/CD use cases for Neon branches:
|
|
|
266
277
|
|
|
267
278
|
1. Recommend schema-only branch and explain why.
|
|
268
279
|
2. Share docs link: https://neon.com/docs/guides/branching-schema-only
|
|
269
|
-
3. Check the
|
|
280
|
+
3. Check the tool path first (CLI with `neon --version`; MCP only if the CLI isn't usable).
|
|
270
281
|
4. Provide command:
|
|
271
282
|
- `neon branches create --name compliance-dev --parent main --schema-only --project-id <your-project-id> --expires-at 2026-12-15T18:02:16Z`
|
|
272
283
|
5. Mention Beta support path:
|
|
273
284
|
- https://console.neon.tech/app/projects?modal=feedback
|
|
274
285
|
- https://discord.gg/92vNTzKDGp
|
|
275
286
|
|
|
276
|
-
## Further
|
|
287
|
+
## Further Reading
|
|
277
288
|
|
|
278
289
|
- https://neon.com/docs/guides/branch-expiration.md
|
|
279
290
|
- https://neon.com/docs/guides/neon-github-integration.md
|
|
@@ -9,12 +9,25 @@ description: >-
|
|
|
9
9
|
from their database to their application. Also use when reviewing query
|
|
10
10
|
patterns for cost efficiency, even if the user doesn't explicitly mention
|
|
11
11
|
egress or data transfer.
|
|
12
|
+
metadata:
|
|
13
|
+
parent: neon
|
|
14
|
+
source: https://github.com/neondatabase/agent-skills/tree/main/skills/neon-postgres-egress-optimizer
|
|
12
15
|
---
|
|
13
16
|
|
|
17
|
+
**FIRST**: Use the parent `neon` skill for a Neon overview, getting started with Neon, Neon development best practices, and more.
|
|
18
|
+
|
|
19
|
+
If the `neon` skill is not installed, fetch it from https://neon.com/docs/ai/skills/neon/SKILL.md or install it with:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx skills add neondatabase/agent-skills --skill neon
|
|
23
|
+
```
|
|
24
|
+
|
|
14
25
|
# Postgres Egress Optimizer
|
|
15
26
|
|
|
16
27
|
Guide the user through diagnosing and fixing application-side query patterns that cause excessive data transfer (egress) from their Postgres database. Most high egress bills come from the application fetching more data than it uses.
|
|
17
28
|
|
|
29
|
+
Work the four steps in order: **diagnose** which queries transfer the most data, **analyze** the codebase behind them, **fix** the anti-patterns, then **verify** nothing broke and the transfer actually dropped.
|
|
30
|
+
|
|
18
31
|
## Step 1: Diagnose
|
|
19
32
|
|
|
20
33
|
Identify which queries transfer the most data. The primary tool is the `pg_stat_statements` extension.
|
|
@@ -31,7 +44,7 @@ If this errors, the extension needs to be created:
|
|
|
31
44
|
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
|
|
32
45
|
```
|
|
33
46
|
|
|
34
|
-
On Neon
|
|
47
|
+
On Neon the extension is available by default, but it may still need this CREATE EXTENSION step.
|
|
35
48
|
|
|
36
49
|
### Handle empty stats
|
|
37
50
|
|
|
@@ -96,7 +109,7 @@ Rank findings by estimated egress impact:
|
|
|
96
109
|
- **Extreme call frequency** on even small queries adds up. A query called 50,000 times/day returning 10 rows each = 500,000 rows/day.
|
|
97
110
|
- **Cross-reference with the schema** to identify which columns are wide. Look for JSONB, TEXT, BYTEA, and large VARCHAR columns.
|
|
98
111
|
|
|
99
|
-
## Step 2: Analyze
|
|
112
|
+
## Step 2: Analyze the Codebase
|
|
100
113
|
|
|
101
114
|
For each query identified in Step 1, or for each database query in the codebase if no stats are available, check:
|
|
102
115
|
|
|
@@ -114,6 +127,8 @@ Apply the appropriate fix for each problem found. Below are the most common egre
|
|
|
114
127
|
|
|
115
128
|
**Problem:** The query fetches all columns but the application only uses a few. Large columns (JSONB blobs, TEXT fields) get transferred over the wire and discarded.
|
|
116
129
|
|
|
130
|
+
**Fix:** Name only the columns the response needs.
|
|
131
|
+
|
|
117
132
|
**Before:**
|
|
118
133
|
|
|
119
134
|
```sql
|
|
@@ -132,6 +147,8 @@ SELECT id, name, price, image_urls FROM products;
|
|
|
132
147
|
|
|
133
148
|
This is easy to miss because the application may work fine with small datasets. But at scale, an unpaginated endpoint returning 10,000 rows with even moderate column widths can transfer hundreds of megabytes per day.
|
|
134
149
|
|
|
150
|
+
**Fix:** Bound the result set with `ORDER BY` plus `LIMIT`/`OFFSET`.
|
|
151
|
+
|
|
135
152
|
**Before:**
|
|
136
153
|
|
|
137
154
|
```sql
|
|
@@ -181,6 +198,8 @@ GROUP BY p.category_id;
|
|
|
181
198
|
|
|
182
199
|
This is distinct from the SELECT \* problem. Even if you select only needed columns, a JOIN still repeats the parent data for every child row. The fix is structural: avoid the join entirely.
|
|
183
200
|
|
|
201
|
+
**Fix:** Split the join into two queries, one per table.
|
|
202
|
+
|
|
184
203
|
**Before:**
|
|
185
204
|
|
|
186
205
|
```sql
|
|
@@ -241,7 +260,7 @@ neon config apply # apply to the current branch (neon deploy is an alias)
|
|
|
241
260
|
|
|
242
261
|
This is complementary, not a substitute: query-pattern fixes are what actually reduce egress charges, while these settings keep non-production compute and storage from quietly inflating the same bill. Because `neon checkout` applies the policy when it creates a branch, new dev/preview branches inherit the cheap profile automatically.
|
|
243
262
|
|
|
244
|
-
## Further
|
|
263
|
+
## Further Reading
|
|
245
264
|
|
|
246
265
|
- https://neon.com/docs/introduction/network-transfer.md
|
|
247
266
|
- https://neon.com/docs/introduction/cost-optimization.md
|