Skip to main content
rule CX Codex

database · first-fluke — Claude Code rule: what it does, how to install

Enforces database schema design, normalization, indexing, and migration standards for SQL, NoSQL, and vector stores. Activates on .sql and .prisma files.

MIT ★ 1,472 updated 2026-10-29

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add first-fluke/oh-my-agent
/plugin install oma@oh-my-agent
Open on GitHub

What database does

The rule triggers on files matching **/*.{sql,prisma} to guide data architecture decisions. For relational databases, it requires 3NF by default; breaking it requires explicit justification. Every critical flow must document transaction boundaries, isolation levels, and locking strategies.

Live schema updates follow the expand-contract pattern: additive changes first, dual-write with batched backfill, and delayed cleanup. DDL operations require lock awareness and timeouts. Vector databases are strictly treated as retrieval infrastructure rather than canonical data stores.

Business policies and triggers must live in application code rather than stored procedures. Query tuning is driven by execution plans and p95 measurements rather than guesswork.

What it helps with

  • enforce 3NF normalization on relational database schemas
  • execute zero-downtime table migrations with the expand-contract pattern
  • configure hybrid search and versioning for vector embeddings
  • tune slow queries based on execution plans and p95 latency

Example prompts for the agent

  • Review schema.prisma against 3NF and verify referential integrity constraints.
  • Draft an expand-contract migration plan with timeouts for users.sql.
  • Analyze this query execution plan and optimize the dominant cost node.

How to install database

1Plugin marketplace

/plugin marketplace add first-fluke/oh-my-agent
/plugin install oma@oh-my-agent

2Manually: put the files in place

.claude/rules/database.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about database

How to install database in Claude Code?

Run /plugin marketplace add first-fluke/oh-my-agent, then run /plugin install oma@oh-my-agent. Alternatively, place the rule file directly at .claude/rules/database.md.

What does the database rule do?

It provides standards for database design, concurrency, indexing, and live table migrations. It also defines guidelines for vector databases and query optimization using p95 metrics.

When does this rule trigger in a project?

It matches any file path covered by **/*.{sql,prisma}. Because alwaysApply is false, it stays inactive when working on unrelated files.

Source text

database.md · MIT
---
description: Database schema design, normalization, indexing, and integrity standards for SQL, NoSQL, and vector databases
globs: "**/*.{sql,prisma}"
alwaysApply: false
---

# Database Standards

## Core Rules

1. Choose model first, engine second: workload, access pattern, consistency, and scale drive DB selection.
2. For relational workloads, enforce at least **3NF** by default. Break 3NF only with explicit performance justification.
3. For distributed/non-relational workloads, model around aggregates and access paths; document **BASE** and consistency tradeoffs.
4. Document **ACID** expectations for relational transactions. For distributed tradeoffs, document consistency compromises explicitly.
5. For schema architecture work, document the relevant schema layers: **external schema**, **conceptual schema**, **internal schema**.
6. Treat integrity as first-class: entity, domain, referential, and business-rule integrity must be explicit.
7. Concurrency is never implicit: define transaction boundaries, locking strategy, and isolation level per critical flow.
8. For new or changed data models, specify: naming, definition, format, allowed values, and validation rules.
9. Update the affected schema decisions and data definitions; add capacity estimates when the task changes capacity requirements.
10. Proactively flag anti-patterns and insecure shortcuts instead of silently implementing them.
11. Vector DBs are retrieval infrastructure, not source-of-truth databases. Store embeddings and metadata there; keep canonical documents elsewhere.
12. Never treat vector search as a drop-in for lexical search. Default to hybrid retrieval when exact match or explainability matters.
13. Embeddings are schema-like assets: version model, dimension, chunking, and preprocessing. Plan re-embedding migrations explicitly.
14. Schema or data changes on live tables follow expand-contract: additive expand, dual-write + batched backfill, verified read switch, delayed contract. Use lock-aware DDL with timeouts; ship destructive steps in a separate deploy after a soak window.
15. Tune queries from measurement and execution plans, never guesswork: measure, explain, nominate the dominant cost node, optimize, re-measure p95.
16. Strongly recommend explicit application ownership of business policies, workflows, and external side effects in both new and existing triggers, stored procedures/functions, views, DB jobs, and ORM hooks. For affected existing logic, give a concrete alternative and transition priority; existing convention alone does not justify retention. Use `.agents/skills/oma-db/resources/anti-patterns.md` §5 for review and technical retention criteria. This is a strong recommendation, not a blanket feature ban or authorization for an unrelated rewrite.
17. Preserve DB integrity constraints, atomic updates, transactions/isolation/locking, RLS and privileges, DB audit, justified dependent cascades, and efficient set-based operations. For an accepted transition, follow `.agents/skills/oma-db/resources/migration-playbook.md` to cover every writer, prevent duplicate side effects, and define rollback.

© First Fluke · MIT · first-fluke/oh-my-agent

Similar IDE rules

All IDE rules for Data and databases →

database by other authors comes first.

database PatrickJS A Cursor rule with database practices for Prisma and Supabase: schemas, migrations, queries, RLS policies. Scoped to database files by glob. CX Codex +1 ★ 41,178repo stars schema-consistency-checker patricio0312rev schema-consistency-checker reads your tables and columns, flags names that break the agreed style, mismatched ID types, nullable critical fields and foreign keys without an index, then hands back a fix list. CX Codex +1 265installs database-schema alinaqi database-schema is a Claude Code skill that checks database schemas before queries or model changes. It activates before database work and around schema, migration, and model files. CX Codex +1 308installs database-design spencerpauly database-design designs relational database schemas, foreign keys, indexes, and constraints from raw requirements, with output tailored for SQL, Prisma, or Drizzle. CX Codex +1 505installs design-database-schema davila7 The design-database-schema command plans database structures around requirements, relationships, and query patterns. Use it to draft a schema or rethink an existing one. CX Codex +1 1,021installs database-schema-designer softaworks The database-schema-designer Claude Code plugin designs SQL and NoSQL database schemas, with guidance on normalization, indexes, and migration patterns. ★ 2,707repo stars database-designer Alireza Rezvani database-designer reviews database schemas, query indexes, and migration plans. Use it when you need to inspect a schema or prepare a change with an expand-contract plan. CX Codex +1 819installs

From the same set69

The whole set →
refactor-engineer refactor-engineer — a subagent that rewrites code while keeping it working. Identifies hot spots, wraps them with safety tests, and applies one atomic transformation at a time. CX Codex ★ 1,472repo stars pm-planner pm-planner is a subagent for Claude Code and Codex that breaks down requirements, creates API contracts, and generates structured plans for parallel execution. CX Codex ★ 1,472repo stars oma-bootstrap oma-bootstrap is a Claude Code skill that checks whether oma, required providers, and project state are ready for a task. It runs before a skill or workflow that needs an oma command. CX Codex +1 ★ 1,472repo stars research-explorer research-explorer — a subagent that answers research questions by searching three planes at once: docs and code, market signals, and academic literature. Returns findings with sources and confidence labels. CX Codex ★ 1,472repo stars docs-curator docs-curator — a subagent that detects documentation drift and updates MD files when code changes. Catches broken references, proposes patches, and keeps docs/**/*.md aligned with the codebase. CX Codex ★ 1,472repo stars i18n-guide The i18n-guide rule sets how agents choose a response language and which project text gets localized. It fits workflows that need consistent language handling across user-facing output and code. CX Codex +1 ★ 1,472repo stars frontend frontend — a rule for React and Next.js projects: shadcn/ui components, Tailwind CSS v4, FSD-lite architecture, Server Components by default. CX Codex +1 ★ 1,472repo stars oma-docs Verifies documentation links, syncs docs against Git diffs, and flags translation drift. Runs through the oma docs CLI or falls back to manual markdown parsing. CX Codex +1 ★ 1,472repo stars

Project sponsors

Companies that keep this analytics open