neon-netlify
Use when building Netlify apps or APIs with Neon Postgres. Covers Netlify DB, Neon-powered serverless Postgres, branching workflows, pooled connections, query safety, and operational patterns for Netlify Functions.
Works with
--- name: neon-netlify description: Use when building Netlify apps or APIs with Neon Postgres. Covers Netlify DB, Neon-powered serverless Postgres, branching workflows, pooled connections, query safety, and operational patterns for Netlify Functions. license: MIT --- # Neon Netlify Skill Use this skill when a Netlify app uses Neon directly or through Netlify DB, which Netlify documents as a Postgres integration powered by Neon. ## Core goals - Use Neon as a serverless Postgres backend without creating avoidable connection storms. - Choose the right connection style for Netlify Functions. - Keep migrations, branches, and preview environments aligned with the deployment workflow. - Preserve normal Postgres discipline: typed queries, bounded reads, indexed filters, and safe role management. ## Platform facts - Netlify DB is a Netlify-managed Postgres integration powered by Neon. - Neon supports serverless Postgres workflows with branches, multiple databases per branch, and managed compute endpoints. - Neon exposes connection URIs and project management through its API. ## Recommended stack - Use plain SQL or a query builder for thin APIs. - Use Prisma, Drizzle, Kysely, or a similar typed layer only if the repo already uses one or clearly benefits from it. - Use the pooled Neon connection string for Netlify Functions unless the project has a proven reason to use a direct connection. ## Netlify-specific guidance - Put the Neon connection string in a Netlify runtime env var with Functions scope. - Reuse database clients at module scope when the library supports it. - Keep the Netlify function region close to the Neon compute region. - Use Background Functions for slow maintenance jobs, bulk imports, or heavy migrations instead of synchronous request handlers. - Use `netlify-serverless` for function-type choice and `netlify-database-security` for general secret policy. ## Branching workflow - Use Neon branches for preview data or isolated testing environments. - Do not run destructive schema changes directly against production without a migration plan. - Treat branch creation, seeding, and cleanup as part of the deployment workflow if previews depend on branch-specific data. - Keep production credentials separate from preview and development credentials. ## Query rules - Parameterize every query. - Add indexes for frequent filters, joins, and ordering columns. - Keep page sizes bounded. - Prefer one shaped query over multiple request-path round trips. - Run `EXPLAIN` or Neon query tuning before guessing at fixes. ## Reference files ### [`references/connection.md`](references/connection.md) **Neon connection setup** — Module-scope `neon()` SQL executor with `requireEnv()` fail-fast, tagged-template parameterized query examples, pooled vs. direct connection string table (with format and when to use each), transaction pattern using `pg.Pool` + direct string, rules for module-scope initialization and SSL. ### [`references/branching.md`](references/branching.md) **Preview branch workflow** — What a Neon branch is (copy-on-write, instant creation), Neon API `POST /branches` call with endpoint creation, GitHub Actions CI step for branch-per-PR, seeding with migration tooling, branch cleanup script on PR close (list by name → delete by ID), rules for credential separation and lifecycle management. ### [`references/query-patterns.md`](references/query-patterns.md) **Safe queries and optimization** — Tagged-template driver injection safety, bounded pagination with `Math.min` cap and parallel `COUNT` query, `EXPLAIN ANALYZE` output interpretation table, index recommendation patterns (single, compound, partial, GIN full-text), `INSERT … ON CONFLICT DO UPDATE` upsert, rules for EXPLAIN-first optimization. ## External references - [Netlify DB](https://docs.netlify.com/build/data-and-storage/netlify-db/) - [Neon API: create project](https://api-docs.neon.tech/reference/createproject) - [Neon API: create compute endpoint](https://api-docs.neon.tech/reference/createprojectendpoint) - [Neon API: retrieve connection URI](https://api-docs.neon.tech/reference/getconnectionuri) - [Neon API: create database](https://api-docs.neon.tech/reference/createprojectbranchdatabase)
More Database skills
prisma-mongodb-upgrade
prisma/skills
Decision and migration guide for Prisma ORM MongoDB projects on v6, which have no upgrade path to v7. Use when a MongoDB project asks about upgrading Prisma, when "upgrade to prisma 7" comes up in a project with provider = "mongodb", or when evaluating a move to Prisma Next. Triggers on "upgrade prisma mongodb", "prisma 7 mongodb", "mongodb prisma migration", "prisma next mongodb".
azure-upgrade
microsoft/azure-skills
Assess and upgrade Azure workloads between plans, tiers, or SKUs, or modernize Azure SDK dependencies in source code. WHEN: upgrade Consumption to Flex Consumption, upgrade Azure Functions plan, change hosting plan, function app SKU, migrate App Service to Container Apps, modernize legacy Azure Java SDKs (com.microsoft.azure to com.azure), migrate Azure Cache for Redis (ACR/ACRE) to Azure Managed Redis (AMR).
azure-cost-optimization
microsoft/azure-skills
Identify Azure cost savings from usage and spending data. USE FOR: optimize Azure costs, reduce Azure spending/expenses, analyze Azure costs, find cost savings, generate cost optimization report, identify orphaned resources to delete, rightsize VMs, reduce waste, optimize Redis costs, optimize storage costs, AKS cost analysis add-on, namespace cost, cost spike, anomaly, budget alert, AKS cost visibility. DO NOT USE FOR: deploying resources (use azure-deploy), general Azure diagnostics (use azure-diagnostics), security issues (use azure-security)

