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/dafthunk-com/dafthunkWrote 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/dafthunk-com/dafthunk/07-database-development)<a href="https://agentmods.dev/rules/dafthunk-com/dafthunk/07-database-development"><img src="https://agentmods.dev/badge/rules/dafthunk-com/dafthunk/07-database-development/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/dafthunk-com/dafthunk/07-database-development"><img src="https://agentmods.dev/badge/rules/dafthunk-com/dafthunk/07-database-development.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.00000 | $0.00536 |
| Opus 5.5 | $0.00000 | $0.00214 |
| Sonnet 5.5 | $0.00000 | $0.00107 |
| Haiku 4.5 | $0.00000 | $0.00054 |
Grade A, and why
07-database-development 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 — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Database Design Best Practices
Use SQL-Compatible Types
- Cloudflare D1 uses SQLite under the hood.
- Use Drizzle's SQLite helpers (
integer(),text(),sqliteTable(), etc.). - Be mindful of SQLite's flexible typing and ensure type safety using Drizzle.
export const users = sqliteTable("users", {
id: integer("id").primaryKey({ autoIncrement: true }),
email: text("email").notNull().unique(),
createdAt: text("created_at").default(sql`CURRENT_TIMESTAMP`),
});
Model Relationships Carefully
- D1 (SQLite) does support foreign keys, but indexing is crucial for performance.
- Use
.references()in Drizzle to define relationships explicitly.
export const posts = sqliteTable("posts", {
id: integer("id").primaryKey({ autoIncrement: true }),
authorId: integer("author_id").references(() => users.id),
title: text("title").notNull(),
});
Use Enums Where Needed (with Caution)
- SQLite does not have native enum support.
- Instead, constrain values manually in your application or through custom Zod validation.
Use snake_case for SQL Fields
- Stick to
snake_casein table and column names. - Use
camelCasein TypeScript withInferModel.
export const tasks = sqliteTable("tasks", {
createdAt: text("created_at"),
});
Timestamps & Defaults
- Use SQL-level defaults like
CURRENT_TIMESTAMPto avoid time zone mismatches. - Avoid setting defaults in TypeScript for critical database fields.
Type Inference
- Always use Drizzle's
InferModelto export consistent types.
export type User = InferModel<typeof users>;
export type NewUser = InferModel<typeof users, "insert">;
Migrations
- Use
drizzle-kitto generate and run migrations. - Keep migrations version-controlled and consistent across environments.
- Don't mutate tables manually in production.
Avoid Nullable Unless Necessary
- Prefer strict types to nullable columns.
- Design schema around clear assumptions; nulls can be a source of bugs.
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 First seen · 72 lines · 0 tokens per session scan A 512f03c3cc9c
07-database-development is a cursor rule published in the GitHub repository dafthunk-com/dafthunk (137 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 536 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
data-engineer
AIOX agent @data-engineer - Database Architect & Operations Engineer.
cpp
Name methods (casing, etc) like "isvalid", "streamtext".
ai_docs
There is a folder called aidocs it contains useful resources for reference.
run-scripts
when running any thing in scripts dir do "uv run ".
simplicity
Simplicity - smallest correct diff; reuse, platform, installed deps before new code; no speculative abstraction.
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.