agentleFS
hemapriyan-rkhemapriyan-rk/claude-rigor-skills/skills/database-design/SKILL.md

database-design

Skill1 starsChanged 49 days agoMITView on GitHub

Design a database schema and storage strategy — normalization vs. denormalization, indexing, SQL vs. NoSQL choice, sharding/replication and consistency model — with every trade-off stated explicitly rather than defaulted by habit or fashion. Use when designing a new schema, choosing a database technology, or reviewing an existing schema for scaling or correctness issues.

58 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use intelligent-routing, bash-linux and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SKB3002Skill

    intelligent-routing

    Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.

    Also in 6 projects that use this

  • xenitV1Skill

    bash-linux

    Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.

    Also in 7 projects that use this

  • xenitV1Skill

    red-team-tactics

    Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.

    Also in 7 projects that use this

  • pepebot-spaceSkill

    llm-application-dev

    Building applications with Large Language Models - prompt engineering, RAG patterns, and LLM integration. Use for AI-powered features, chatbots, or LLM-based automation.

    Also in 4 projects that use this

  • +8 more from xenitV1

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 55 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every denormalized table needs an explicit reason tied to Step 1 (a specific hot query that needs the data pre-joined).

    line 16
  2. Distinctive:

    Every index has a write-cost — only add one that serves a query actually in the Step 1 list.

    line 24
  3. Distinctive:

    Check that schema migrations are backward-compatible with currently-running code during rollout (expand-contract: add the new column/table …

    line 34

“Common” is measured: kept by at least 6 in 10 of the 55 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Database Design

A schema designed from the entity-relationship diagram alone is designed from the wrong input. The ERD describes the domain; the actual read/write access pattern is what should drive the schema, indexing, and technology choice.

Step 1 — Access pattern first

Before drawing tables, list the actual queries this schema needs to serve well: what's read together, what's written together, what's queried by range vs. exact match, what needs to be fast versus what can be slow. Design from this list, not from the domain model in isolation.

Step 2 — Normalization vs. denormalization, with a stated reason

Every denormalized table needs an explicit reason tied to Step 1 (a specific hot query that needs the data pre-joined). Denormalization with no stated reason is pure inconsistency risk with no offsetting benefit — flag it as a problem, not a style choice, when found without justification.

Step 3 — SQL vs. NoSQL as a real trade-off

Decide based on the actual consistency requirement (strong vs. eventual — state this explicitly) and query flexibility need from Step 1, not team familiarity or what's trending. A document store chosen for a workload that's actually relational (many cross-entity joins in the access pattern) creates exactly the joins-in-application-code problem the choice was supposed to avoid.

Step 4 — Indexing tied to the access pattern

Every index has a write-cost — only add one that serves a query actually in the Step 1 list. Check specifically for:

  • Missing indexes on foreign keys / join columns that Step 1's queries actually hit.
  • Indexes added "just in case" that serve no listed query — these slow every write for no read benefit and should be flagged for removal, not just left alone.

Step 5 — Sharding, replication, and consistency model

If scaling past a single node: state the shard key and name the cross-shard query pattern it breaks — there is always at least one, and pretending otherwise just defers the discovery to an incident. For read replicas, state the acceptable replication lag explicitly if any read path can tolerate staleness, and flag any read path that can't but is routed to a replica anyway.

Step 6 — Migration safety

Check that schema migrations are backward-compatible with currently-running code during rollout (expand-contract: add the new column/table first, migrate reads, then remove the old one in a later deploy) rather than a hard cutover that breaks any instance still running the old code mid-deploy.

Output

# Database design: [system]
## Access patterns (the queries this must serve well)
## Schema (with denormalization decisions and their stated reason)
## Technology choice (SQL/NoSQL) and the consistency model that drove it
## Indexes (each tied to a specific query) and any flagged as unjustified
## Sharding/replication strategy, with the cross-shard query pattern that breaks named explicitly
## Migration approach

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.