neon-postgres
它能做什么
这个技能为你的 AI 智能体提供在应用中使用 Neon(一种无服务器 Postgres 数据库)的模式。适合将 Prisma 或 Drizzle 连接到 Neon 并处理连接池的开发者。
适用场景
- ✓当你把 Prisma 或 Drizzle 应用连接到 Neon 数据库时。
- ✓当你的无服务器 Neon 应用需要连接池时。
- ✓当你想为开发或测试使用数据库分支时。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/neon-postgres/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请用我的 Neon 数据库设置 Prisma,应用使用连接池连接,迁移使用直连。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会设置两个连接字符串:一个用于应用的连接池连接,一个用于迁移的直连。它还会选择合适的 Neon 驱动,例如单次查询使用 HTTP,事务使用 WebSocket。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Neon Postgres
Patterns
Prisma with Neon Connection
Configure Prisma for Neon with connection pooling.
Use two connection strings:
- DATABASE_URL: Pooled connection for Prisma Client
- DIRECT_URL: Direct connection for Prisma Migrate
The pooled connection uses PgBouncer for up to 10K connections. Direct connection required for migrations (DDL operations).
Drizzle with Neon Serverless Driver
Use Drizzle ORM with Neon's serverless HTTP driver for edge/serverless environments.
Two driver options:
- neon-http: Single queries over HTTP (fastest for one-off queries)
- neon-serverless: WebSocket for transactions and sessions
Connection Pooling with PgBouncer
Neon provides built-in connection pooling via PgBouncer.
Key limits:
- Up to 10,000 concurrent connections to pooler
- Connections still consume underlying Postgres connections
- 7 connections reserved for Neon superuser
Use pooled endpoint for application, direct for migrations.
⚠️ Sharp Edges
| Issue | Severity | Solution |
|---|---|---|
| Issue | high | See docs |
| Issue | high | See docs |
| Issue | high | See docs |
| Issue | medium | See docs |
| Issue | medium | See docs |
| Issue | low | See docs |
| Issue | medium | See docs |
| Issue | high | See docs |
常见问题
为什么有两个连接字符串?
连接池用于应用,而迁移操作需要直连。
哪个驱动处理事务?
该技能说明事务和会话使用 WebSocket 无服务器驱动。
连接池能处理多少连接?
该技能指出连接池最多支持 10000 个并发连接。
详情
作者的原始描述
Expert patterns for Neon serverless Postgres, branching, connection pooling, and Prisma/Drizzle integration Use when: neon database, serverless postgres, database branching, neon postgres, postgres serverless.
热度
- GitHub 星标
- 33k
- 排名
- #8781
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。