database-design
Skill4 starsChanged 40 days agoMITView on GitHub
General database design principles: modeling, normalization, indexing, naming conventions, migrations, and query optimization. Trigger: Database design, data modeling, schema design, table design, or migration planning.
58 other projects use a version of this.
Adopted by
Most recently taken up by
- chaunsin/agent-skillstheir own version, first seen Nov 8, 2026
- kinhluan/skillstheir own version, first seen Nov 8, 2026
- ishandutta2007/Awesome-Claude-Skillstheir own version, first seen Nov 8, 2026
- mahdy-gribkov/arcanatheir own version, first seen Nov 8, 2026
- KbWen/agentic-ostheir own version, first seen Nov 7, 2026
- its-ash/skillstheir own version, first seen Nov 1, 2026
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.
SKB3002Skillintelligent-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
xenitV1Skillbash-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
xenitV1Skillred-team-tactics
Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.
Also in 7 projects that use this
pepebot-spaceSkillllm-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
Other versions58 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 58
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- CloudAI-X/claude-workflow★ 1.4ksame name
- CloudAI-X/claude-workflow-v2★ 1.4ksame name
- MoizIbnYousaf/Ai-Agent-Skills★ 1.1ksame name
- skillcreatorai/Ai-Agent-Skills★ 1.1ksame name
- MoizIbnYousaf/ai-agent-skills★ 1.1ksame name
- KbWen/agentic-os★ 229same name
- kid-sid/claude-spellbook★ 190same name
- xenitV1/Antigravity-Workflows★ 130same name
48 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- api-designSkill
- changelog-maintenanceSkill
- code-mentorSkill
- create-readmeSkill
- dockerSkill
- frontend-design-anti-slopSkill
- frontend-engineeringSkill
- git-commitSkill
- github-essentialsSkill
- java-junitSkill
- java-springbootSkill
- java-springboot-testingSkill
- latexSkill
- solution-designSkill
- ui-componentsSkill
- update-readmeSkill
- vault-tech-noteSkill
- web-mvcSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 7 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 55 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Before writing any DDL, map the business entities and their relationships.
- Distinctive: line 47
Denormalize only: when query performance demands it, and *document why*
- Distinctive: line 51
Use the smallest type that fits the data range
- Very specific: line 52
Prefer standardized types: TIMESTAMPTZ over TIMESTAMP, UUID or IDENTITY over natural keys
- Very specific: line 53
Avoid TEXT/VARCHAR(255) as a default — size columns appropriately
- Very specific: line 54
Use DECIMAL for money, not FLOAT
- Distinctive: line 67
Prefer database constraints over application-level validation:
- Very specific: line 78
Every migration must be reversible (have a down/rollback)
- Distinctive: line 80
Never modify a migration that has already been applied to production
- Very specific: line 81
Use timestamp-based or sequential naming: 20250531_create_users.sql
- Distinctive: line 86
Use EXPLAIN ANALYZE before optimizing
- Distinctive: line 87
Prefer set-based operations over row-by-row (cursors)
- Very specific: line 88
Use LIMIT / OFFSET for pagination, but prefer keyset pagination for large datasets
“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.
Files
When to Use
- Designing a new database schema
- Reviewing or refactoring existing schemas
- Planning migrations or data model changes
- Choosing data types, indexes, or constraints
- Defining naming conventions for tables, columns, or relationships
Instructions
1. Understand the Domain First
Before writing any DDL, map the business entities and their relationships. Use the conceptual → logical → physical flow:
- Conceptual: Entities, relationships, business rules (ER diagram)
- Logical: Attributes, keys, normal forms (independent of technology)
- Physical: Data types, indexes, partitions, engine-specific features
2. Naming Conventions
| Element | Convention | Example |
| Tables | snake_case, plural | users, order_items |
| Columns | snake_case, singular | created_at, email |
| PK | id | id BIGSERIAL PRIMARY KEY |
| FK | {singular_table}_id | user_id, order_id |
| Join table | {table1}_{table2} | users_roles |
| Indexes | idx_{table}_{column(s)} | idx_users_email |
| Unique constraint | uq_{table}_{column(s)} | uq_users_email |
3. Normalization Quick Reference
- 1NF: Atomic columns, no repeating groups
- 2NF: 1NF + all non-key columns depend on the whole PK
- 3NF: 2NF + no transitive dependencies (non-key → non-key)
- Denormalize only when query performance demands it, and document why
4. Data Type Selection
- Use the smallest type that fits the data range
- Prefer standardized types:
TIMESTAMPTZoverTIMESTAMP,UUIDorIDENTITYover natural keys - Avoid
TEXT/VARCHAR(255)as a default — size columns appropriately - Use
DECIMALfor money, notFLOAT - Dialect matters — see references/postgresql.md for pg-specific types (arrays, JSONB, intervals), references/mysql.md / references/mariadb.md for engine quirks, and references/sqlite.md for type affinity rules
5. Indexing Strategy
- PKs and FKs — always index FK columns
- Query-driven — index columns in
WHERE,JOIN,ORDER BY, not arbitrary columns - Composite indexes — leftmost prefix rule applies; order by selectivity
- Covering indexes — include columns to avoid table heap lookups
- Avoid over-indexing — every index slows writes
6. Constraints Over Code
Prefer database constraints over application-level validation:
CHECK (price > 0) -- domain integrity
NOT NULL -- required fields
UNIQUE -- uniqueness
FOREIGN KEY ... ON DELETE -- referential integrity7. Migration Patterns
- Every migration must be reversible (have a
down/rollback) - One migration = one logical change (add column, create table, etc.)
- Never modify a migration that has already been applied to production
- Use timestamp-based or sequential naming:
20250531_create_users.sql
8. Query Design
- Avoid
SELECT *— always name columns - Use EXPLAIN ANALYZE before optimizing
- Prefer set-based operations over row-by-row (cursors)
- Use
LIMIT/OFFSETfor pagination, but prefer keyset pagination for large datasets - See references/query-optimization.md for execution plans, join strategies, CTEs vs subqueries, N+1, and dialect-specific tips
9. Decision Table
| Need | Approach |
| Simple CRUD | Normalized relational model |
| Reporting / analytics | Star schema (fact + dimension tables) |
| Time-series data | Partition by time, consider specialized DB |
| Full-text search | Dedicated index (GIN, or external search) |
| Hierarchical data | Adjacency list, nested sets, or LTREE |
| Multi-tenant | Row-level security or tenant discriminator column |
Commands
# Generate migration
migrate create -ext sql -dir migrations create_users
# Run migrations
migrate -database "$DATABASE_URL" up
# Rollback last migration
migrate -database "$DATABASE_URL" down 1
# Review dry-run
migrate -database "$DATABASE_URL" up 1 --dry-runDialect References
| Database | File | Key Differentiators |
| PostgreSQL | references/postgresql.md | Arrays, JSONB, GIN/GIST, CTEs, window functions, extensions, MVCC |
| MySQL | references/mysql.md | Storage engines, AUTO_INCREMENT, locking quirks, EXPLAIN variants |
| MariaDB | references/mariadb.md | Sequences, WITH optimizations, JSON vs LONGTEXT, thread pool |
| SQLite | references/sqlite.md | Type affinity, no ALTER COLUMN, WAL mode, embedded constraints |
Choose Your Database
| Requirement | Recommended DB |
| Complex queries, analytics, JSON | PostgreSQL |
| High-traffic web app, read-heavy | MySQL / MariaDB |
| Embedded, mobile, testing, local | SQLite |
| Need MariaDB-specific features (sequences, thread pool) | MariaDB |
| Full ACID with advanced indexing | PostgreSQL |
| Minimum ops overhead | SQLite (embedded) or managed MySQL/PostgreSQL |
Anti-Patterns
- EAV (Entity-Attribute-Value) — almost never the right choice; prefer JSONB or separate tables
- Polymorphic associations — breaks referential integrity; use concrete join tables
- Natural keys as PK — they change; use surrogate keys
- One table for everything — violates 1NF; split by entity
- Indexes on every column — write performance degrades
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
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.

