Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/neondatabase/ai-rules/neon-serverlessgit clone --depth 1 https://github.com/neondatabase/ai-rulesWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02128 |
| Opus 5 | $0.00000 | $0.01064 |
| Sonnet 5 | $0.00000 | $0.00426 |
| Haiku 4.5 | $0.00000 | $0.00213 |
Grade A, and why
neon-serverless scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 295 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Neon Serverless Driver Guidelines
Overview
This guide provides specific patterns and best practices for connecting to Neon databases in serverless environments using the @neondatabase/serverless driver. The driver connects over HTTP for fast, single queries or WebSockets for node-postgres compatibility and interactive transactions. Follow these guidelines to ensure efficient connections and optimal performance.
Installation
Install the Neon Serverless driver with the correct package name:
# Using npm
npm install @neondatabase/serverless
# Using JSR
bunx jsr add @neon/serverless
Note: The driver version 1.0.0 and higher requires Node.js v19 or later.
For projects that depend on pg but want to use Neon's WebSocket-based connection pool:
"dependencies": {
"pg": "npm:@neondatabase/serverless@^0.10.4"
},
"overrides": {
"pg": "npm:@neondatabase/serverless@^0.10.4"
}
Avoid incorrect package names like neon-serverless or pg-neon.
Connection String
Always use environment variables for database connection strings to avoid exposing credentials.
// For HTTP queries
import { neon } from '@neondatabase/serverless';
const sql = neon(process.env.DATABASE_URL!);
// For WebSocket connections
import { Pool } from '@neondatabase/serverless';
const pool = new Pool({ connectionString: process.env.DATABASE_URL! });
Never hardcode credentials in your code:
// AVOID: Hardcoded credentials
const sql = neon('postgres://username:[email protected]/neondb');
Querying with the neon function (HTTP)
The neon() function is ideal for simple, "one-shot" queries in serverless and edge environments as it uses HTTP fetch and is the fastest method for single queries.
Parameterized Queries
Use tagged template literals for safe parameter interpolation. This is the primary defense against SQL injection.
const [post] = await sql`SELECT * FROM posts WHERE id = ${postId}`;
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 295 lines · 2,128 tokens per session scan A 614e037a299c
neon-serverless is a cursor rule published in the GitHub repository neondatabase/ai-rules (86 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,128 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
netlify-database-migration-from-extension
Switching to Netlify Database. Reference for the netlify-database skill.
cursorrules
You are an expert in Ruby on Rails, PostgreSQL, Hotwire (Turbo and Stimulus), and Tailwind CSS.
docker-database
Docker configuration for PostgreSQL database and Elasticsearch.
create-rls-policies
Guidelines for writing Postgres migrations.
supabase-migrations
You are a Postgres Expert who loves creating secure database schemas.
aws-rds-best-practices
AWS RDS PostgreSQL best practices - database configuration, connection management, authentication, backup, and performance optimization standards.