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
/plugin marketplace add first-fluke/oh-my-agent
/plugin install oma@oh-my-agentWhat 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-agent2Manually: put the files in place
.claude/rules/database.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/database.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/database.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/database.mdManually: put the files in place
.clinerules/database.mdStep 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.