database-design
Database schema design, optimization, and migration patterns for PostgreSQL, MySQL, and NoSQL databases.
Skill by MoizIbnYousaf
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/moizibnyousaf-database-design
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, backend, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/database-design
What's inside
- Skill name
database-design- Description
- Database schema design, optimization, and migration patterns for PostgreSQL, MySQL, and NoSQL databases. Use for designing schemas, writing migrations, or optimizing queries.
- License
- MIT
- Instructions
- 172 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Database Design ## Schema Design Principles ### Normalization Guidelines ```sql -- 1NF: Atomic values, no repeating groups -- 2NF: No partial dependencies on composite keys -- 3NF: No transitive dependencies -- Users table (normalized) CREATE TABLE users ( id SERIAL PRIMARY KEY, email VARCHAR(255) UNIQUE NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW() ); -- Addresses table (separate entity) CREATE TABLE addresses ( id SERIAL PRIMARY KEY, user_id INTEGER REFERENCES users(id) ON DELETE CASCADE, street VARCHAR(255), city VARCHAR(100), country VARCHAR(100), is_primary BOOLEAN DEFAULT false ); ``` ### Denormalization for Performance ```sql -- When read performance matters more than write consistency CREATE TABLE order_summaries ( id SERIAL PRIMARY KEY, order_id INTEGER REFERENCES orders(id), customer_name VARCHAR(255), -- Denormalized from customers total_amount DECIMAL(10,2), item_count INTEGER, last_updated TIMESTAMPTZ DEFAULT NOW() ); ``` ## Index Design ### Common Index Patterns ```sql -- B-tree (default) for equality and range queries CREATE INDEX idx_users_email ON users(email); -- Composite index (order matters!) CREATE INDEX idx_orders_user_date ON orders(user_id, created_at DESC); -- Partial index for specific conditions CREATE INDEX idx_active_users ON users(email) WHERE deleted_at IS NULL; -- GIN index for array/JSONB columns CREATE INDEX idx_posts_tags ON posts USING GIN(tags); -- Covering index (includes additional columns) CREATE INDEX idx_orders_covering ON orders(user_id) INCLUDE (total, status); ``` ### Index Analysis ```sql -- Check index usage SELECT schemaname, tablename, indexname, idx_scan, idx_tup_read, idx_tup_fetch FROM pg_stat_user_indexes ORDER BY idx_scan DESC; -- Find missing indexes SELECT relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch FROM pg_stat_user_tables WHERE seq_scan > idx_scan ORDER BY seq_tup_read DESC; ``` ## Migration Patterns ### Safe Migration Template ```sql -- Always use transactions BEGIN; -- Add column with default (non-blocking in PG 11+) ALTER TABLE users ADD COLUMN status VARCHAR(20) DEFAULT 'active'; -- Create index concurrently (doesn't lock table) CREATE INDEX CONCURRENTLY idx_users_status ON users(status); -- Backfill data in batches UPDATE users SET status = 'active' WHERE status IS NULL AND id BETWEEN 1 AND 10000; COMMIT; ``` ### Zero-Downtime Migrations ``` 1. Add new column (nullable) 2. Deploy code that writes to both columns 3. Backfill old data 4. Deploy code that reads from new column 5. Remove old column ``` ## Query Optimization ### EXPLAIN Analysis ```sql -- Always use EXPLAIN ANALYZE EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT * FROM orders WHERE user_id = 123 AND status = 'pending'; -- Key metrics to watch: -- - Seq Scan vs Index Scan -- - Actual rows vs Estimated rows -- - Buffers: shared hit vs read
From MoizIbnYousaf/ai-agent-skills, MIT.
More from MoizIbnYousaf/ai-agent-skills
- 0.743score
verification-agent
MoizIbnYousaf
Verify claims, quotations, citations and references against live primary sources, and produce a reproducible audit record instead of an assertion.
SkillBFreshness: B★ 1.2KClaude Code +9 - 0.689score
best-practices
MoizIbnYousaf
Transforms vague prompts into optimized Claude Code prompts.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
audit-library-health
MoizIbnYousaf
Use when checking the overall health of a skills library.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
review-a-skill
MoizIbnYousaf
Use when evaluating whether a skill belongs in a library.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
curate-a-team-library
MoizIbnYousaf
Use when building a managed team skills library for a real stack.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
migrate-skills-between-libraries
MoizIbnYousaf
Use when moving skills between library workspaces or upgrading from a personal library to a team library.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
share-a-library
MoizIbnYousaf
Use when a managed library is ready to publish to GitHub and hand to teammates as an install command.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
update-installed-skills
MoizIbnYousaf
Use when syncing or updating previously installed skills to their latest version.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
build-workspace-docs
MoizIbnYousaf
Use when regenerating README.md and WORK_AREAS.md in a managed library workspace.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
browse-and-evaluate
MoizIbnYousaf
Use when exploring the ai-agent-skills catalog to find, compare, and evaluate skills before installing.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
install-from-remote-library
MoizIbnYousaf
Use when installing skills from a shared ai-agent-skills library repo.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.683score
backend-development
MoizIbnYousaf
Backend API design, database architecture, microservices patterns, and test-driven development.
SkillCFreshness: C★ 1.2KClaude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 1,153
- Forks
- 135
- Open issues
- 1
- Last commit (this folder)
- Mar 31, 2026 (7 months ago)
- Last release
- May 3, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/MoizIbnYousaf/ai-agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from MoizIbnYousaf
- 0.743score
verification-agent
MoizIbnYousaf
Verify claims, quotations, citations and references against live primary sources, and produce a reproducible audit record instead of an assertion.
SkillBFreshness: B★ 1.2KClaude Code +9 - 0.689score
best-practices
MoizIbnYousaf
Transforms vague prompts into optimized Claude Code prompts.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
browse-and-evaluate
MoizIbnYousaf
Use when exploring the ai-agent-skills catalog to find, compare, and evaluate skills before installing.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
audit-library-health
MoizIbnYousaf
Use when checking the overall health of a skills library.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
build-workspace-docs
MoizIbnYousaf
Use when regenerating README.md and WORK_AREAS.md in a managed library workspace.
SkillCFreshness: C★ 1.2KClaude Code +9 - 0.687score
curate-a-team-library
MoizIbnYousaf
Use when building a managed team skills library for a real stack.
SkillCFreshness: C★ 1.2KClaude Code +9
Cite this page
database-design skill. Agent Mart. https://agentmart.dev/skills/moizibnyousaf-database-design (last updated 2026-10-24)