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-drizzlegit clone --depth 1 https://github.com/neondatabase/ai-rulesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/neondatabase/ai-rules/neon-drizzle)<a href="https://agentmods.dev/rules/neondatabase/ai-rules/neon-drizzle"><img src="https://agentmods.dev/badge/rules/neondatabase/ai-rules/neon-drizzle.svg" alt="Measured on agentmods" height="20"></a>What 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.02016 |
| Opus 5 | $0.00000 | $0.01008 |
| Sonnet 5 | $0.00000 | $0.00403 |
| Haiku 4.5 | $0.00000 | $0.00202 |
Grade A, and why
neon-drizzle 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 5d 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 — 282 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Neon and Drizzle Integration Guidelines
Overview
This guide covers the specific integration patterns, configurations, and optimizations for using Drizzle ORM with Neon Postgres. Follow these guidelines to ensure efficient, secure, and robust database operations in serverless and traditional environments.
Dependencies
For Neon with Drizzle ORM integration, include these specific dependencies. The ws package is required for persistent WebSocket connections in Node.js environments older than v22.
npm install drizzle-orm @neondatabase/serverless ws
npm install -D drizzle-kit dotenv @types/ws
Neon Connection String
Always use the Neon connection string format and store it in an environment file (.env, .env.local).
DATABASE_URL="postgresql://[user]:[password]@[neon_hostname]/[dbname]?sslmode=require&channel_binding=require"
Connection Setup: Choosing the Right Driver Adapter
Neon's serverless driver offers two connection methods: HTTP and WebSocket. Drizzle has a specific adapter for each.
1. HTTP Adapter (Recommended for Serverless/Edge)
This method is ideal for short-lived, stateless environments like Vercel Edge Functions or AWS Lambda. It uses fetch for each query, resulting in very low latency for single operations.
- Use the
neonclient from@neondatabase/serverless. - Use the
drizzleadapter fromdrizzle-orm/neon-http.
// src/db.ts
import { drizzle } from "drizzle-orm/neon-http";
import { neon } from "@neondatabase/serverless";
import { config } from "dotenv";
config({ path: ".env" });
if (!process.env.DATABASE_URL) {
throw new Error('DATABASE_URL is not defined');
}
const sql = neon(process.env.DATABASE_URL);
export const db = drizzle(sql);
2. WebSocket Adapter (for node-postgres compatibility)
This method is suitable for long-running applications (e.g., a standard Node.js server) or when you need support for interactive transactions. It maintains a persistent WebSocket connection.
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.
- 5d ago First seen · 282 lines · 2,016 tokens per session scan A eb272dc75b8b
neon-drizzle 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,016 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
adapter-features
Database-specific features must be implemented in the specialized adapter only. Base adapters (postgres, mysql, etc.) must remain database-agnostic.
unit-tests-tdd
TDD required for behavior changes; ≥80% package coverage on touched packages; unit-test conventions.
integration-tests
Human-readable integration test requests; helpers vs httptest; suites/ vs per-DB placement.
postgresql
PostgreSQL production rules. Safe migrations, parameterized queries, TIMESTAMPTZ, proper indexing strategy.
postgresql
This guide defines the definitive best practices for writing clean, performant, and maintainable PostgreSQL SQL, focusing on modern conventions and avoiding common pitfalls.
database-access
資料庫存取模式(Supabase client/server 分工).