database-design-standards

database-design-standards is a cursor rule for Cursor from j4flmao/agent-skills. It costs 21 tokens per session (596 once invoked), scanned A, original, MIT.

Rules for designing relational databases and writing SQL, Prisma schemas, TypeORM entities, and migrations. They cover identifiers, deletion records, database constraints, and query performance.

In plain words
What is it for?
Use them when designing tables, writing database models, creating migrations, enforcing relationships and validation, or fetching related records.
Why use it?
They help prevent fragmented indexes, unclear deletion history, weak data integrity, and inefficient query patterns.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: positional $N argument.

Good fit Use them when designing tables, writing database models, creating migrations, enforcing relationships and validation, or fetching related records.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/j4flmao/agent-skills/database-design-standards
Install

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.

Clone the repo
git clone --depth 1 https://github.com/j4flmao/agent-skills

Made for: Cursor.

Wrote 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.

agentmods badge for database-design-standards

README.md
[![agentmods](https://agentmods.dev/badge/rules/j4flmao/agent-skills/database-design-standards/github.svg)](https://agentmods.dev/rules/j4flmao/agent-skills/database-design-standards)
Your own site
<a href="https://agentmods.dev/rules/j4flmao/agent-skills/database-design-standards"><img src="https://agentmods.dev/badge/rules/j4flmao/agent-skills/database-design-standards/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.

agentmods 80×15 button for database-design-standards

Your own site · 80×15
<a href="https://agentmods.dev/rules/j4flmao/agent-skills/database-design-standards"><img src="https://agentmods.dev/badge/rules/j4flmao/agent-skills/database-design-standards.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 596 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00021 $0.00596
Opus 5.5 $0.00008 $0.00238
Sonnet 5.5 $0.00004 $0.00119
Haiku 4.5 $0.00002 $0.00060

Measured 1mo ago against content hash 084beba050f7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

database-design-standards 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.

.cursor/rules/database-design-standards.mdc · 27 lines

How it starts

The opening of the file, as written. The whole thing — 27 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Database Design Standards

Cursor/AI MUST follow these rules when writing SQL, Prisma schemas, TypeORM entities, or Database migrations.

1. Primary Key Generation (Avoid Random UUIDv4 by Default)

  • Rule: Do not use fully random UUIDv4 as the primary key of a large, write-heavy relational table unless there is a stated reason.
  • Why: Random keys insert into random B-tree leaf pages, which causes page splits, poor cache locality, and extra WAL/full-page writes. The cost is worst in clustered-index engines (MySQL InnoDB, SQL Server), where the table itself is ordered by the PK.
  • Action: Use BIGINT GENERATED ALWAYS AS IDENTITY (PostgreSQL; preferred over BIGSERIAL), UUIDv7 (time-ordered, RFC 9562; native uuidv7() in PostgreSQL 18+), ULID, or Snowflake-style IDs. If IDs are exposed publicly and must not leak volume or creation time, keep an internal sequential PK and a separate random public ID.

2. Soft Deletes via Timestamps, Not Booleans

  • Rule: Avoid is_deleted BOOLEAN for soft deletes.
  • Action: Use deleted_at TIMESTAMPTZ NULL. It records when the row was deleted and filters with WHERE deleted_at IS NULL. Keep uniqueness correct with a partial index: CREATE UNIQUE INDEX ... ON users (email) WHERE deleted_at IS NULL;.
  • Note: Soft delete is not erasure. Data subject to GDPR/CCPA deletion requests still needs a hard-delete or anonymization path.

3. Rely on the Database for Integrity

  • Rule: Never enforce data integrity only in application code. "Check if the username exists, then insert" is a race condition.
  • Action: Use NOT NULL, UNIQUE, FOREIGN KEY, and CHECK constraints (e.g. CHECK (price > 0)). Handle the conflict atomically (INSERT ... ON CONFLICT, catch the unique-violation error) instead of pre-checking.

4. N+1 Query Prevention

  • Rule: When fetching a list of entities and their children, you MUST batch the child loads: SQL JOINs or WHERE id = ANY($1), ORM eager loading (Prisma include, Django select_related/prefetch_related, SQLAlchemy selectinload, TypeORM relations), or DataLoader in GraphQL resolvers.
  • Rule: Index every foreign key column used in joins or filters. PostgreSQL does not create these indexes automatically.

Read the full file on GitHub · 27 lines

Changes

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.

  1. 1mo ago Changed · +2 lines 084beba050f7
  2. 3mo ago First seen · 25 lines · 21 tokens per session scan A 62a63c0d09da

Subscribe to this mod's changes

database-design-standards is a cursor rule published in the GitHub repository j4flmao/agent-skills (47 stars, last pushed 17d ago), licensed MIT. It adds 21 tokens to every session and 596 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-09-05.

Related

database-design-standards compared with cursor rules from other repositories

database-design-standards next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
database-design-standardsj4flmao/agent-skillsCursor rule4717d agoMITA21Cursor
as-contract-cast-smellprisma/ormCursor rule48ktodayApache-2.0A937Cursor
no-backward-compatibilityprisma/ormCursor rule48ktodayApache-2.0A0Cursor
postgresqlsanjeed5/awesome-cursor-rules-mdcCursor rule3.6k11d agoCC0-1.0A2,337Cursor
ehs-ims-conventionsSafetyMP/Autonomous-EHS-ManagementCursor rule95d agoApache-2.0A722Cursor
sync-timedb-archive-janitor-contractTACC/HPCPerfStatsCursor rule60yesterdayLGPL-2.1A0Cursor
java-springboot-jpa-cursorrules-prompt-fileXD3an/awesome-ai-coding-all-in-oneCursor rule142d agononeA1,006Cursor