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.
git clone --depth 1 https://github.com/kok-o/koko-contextos-agentsWrote 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/kok-o/koko-contextos-agents/database)<a href="https://agentmods.dev/rules/kok-o/koko-contextos-agents/database"><img src="https://agentmods.dev/badge/rules/kok-o/koko-contextos-agents/database/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/kok-o/koko-contextos-agents/database"><img src="https://agentmods.dev/badge/rules/kok-o/koko-contextos-agents/database.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.00024 | $0.01672 |
| Opus 5.5 | $0.00010 | $0.00669 |
| Sonnet 5.5 | $0.00005 | $0.00334 |
| Haiku 4.5 | $0.00002 | $0.00167 |
Grade A, and why
database 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 1mo 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 — 200 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Skill: database
database
Overview
Relational database design, query optimization, migration safety, connection pooling in serverless environments, and ORM usage across PostgreSQL, Prisma, and Drizzle.
When to Use
Activate for tasks involving database schema design, migrations, indexing, relational models, ORM queries, transactions, or query performance tuning.
Rules & Patterns
Negative Constraints (What NOT to Do)
- NEVER do
SELECT *in production: Always select explicit columns required by the caller to minimize memory bandwidth and lock footprint. - NEVER run destructive migrations without backward compatibility: Always follow expand-and-contract (Phase 1: add new column as nullable; Phase 2: backfill; Phase 3: make non-nullable & remove old column).
- NEVER execute queries in loops (The N+1 Anti-Pattern): Always use batch loading (
inArray,DataLoader, or relationalinclude/JOIN). - NEVER leave foreign keys without indexes: In PostgreSQL/MySQL, child foreign key columns must always have an index to prevent table-level locking on cascade deletes.
- NEVER perform multi-entity writes without a database transaction: Any operation touching multiple records must use
prisma.$transactionordb.transaction. - NEVER open unpooled database connections in Serverless / Edge functions: Serverless scale-outs will instantly exhaust PostgreSQL's
max_connections.
Zero-Downtime Migrations (Expand-and-Contract)
When modifying schemas with zero downtime:
- Phase 1 (Expand): Add the new column as
NULLABLE(or with a default value). Deploy the application code that reads from old column and writes to both old and new. - Phase 2 (Backfill): Run an asynchronous batch migration job in chunks (e.g. 1000 rows at a time) to populate data from old column to new column.
- Phase 3 (Contract): Update application code to read and write exclusively from the new column.
- Phase 4 (Cleanup): Once traffic is fully shifted, remove the old column and mark the new column as
NOT NULLin a separate migration.
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.
- 1mo ago Changed · +52 lines 88362f614439
- 1mo ago First seen · 148 lines · 24 tokens per session scan A f054b03483d1
database is a cursor rule published in the GitHub repository kok-o/koko-contextos-agents (2 stars, last pushed 1mo ago), licensed MIT. It adds 24 tokens to every session and 1,672 once invoked, about $0.0001 per session on Opus 5.5. 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-31.
Other cursor rules, from other repositories
planning-and-delegation
Plan every task first, parallelise independent work, and staff each task with the cheapest model that can do it well.
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.
30-database-postgres
PostgreSQL and persistence rules.
neon-drizzle
Use this rules when integrating Neon (serverless Postgres) with Drizzle ORM.