Agent skill

Database Design

by MoizIbnYousaf in MoizIbnYousaf/ai-agent-skills

Database schema design, optimization, and migration patterns for PostgreSQL, MySQL, and NoSQL databases.

MITAuto-check passedDatabases

Install Database Design

skills CLI
$ npx skills add MoizIbnYousaf/ai-agent-skills --skill database-design -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install MoizIbnYousaf/ai-agent-skills database-design --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/MoizIbnYousaf/ai-agent-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/database-design .claude/skills/database-design && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
database-design
GitHub stars
1.1k
Used in
1 other repo
Token cost
~1.2k tokens
SKILL.md length
76 words
Files
1
Skills in repo
15
Repo updated
First seen
Licence
MIT

At a glance

Database schema design, optimization, and migration patterns for PostgreSQL, MySQL, and NoSQL databases.

  • Designing schemas
  • SKILL.md covers Schema Design Principles, Index Design, Migration Patterns and Query Optimization, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Writing migrations

What it does

Database Design is an agent skill from MoizIbnYousaf/ai-agent-skills. Database schema design, optimization, and migration patterns for PostgreSQL, MySQL, and NoSQL databases. Use for designing schemas, writing migrations, or optimizing queries.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering Database schema design. It works with MySQL and PostgreSQL. The repository describes itself as: Universal skill installer and package manager for AI coding agents. One command, 12+ runtimes. npx ai-agent-skills. The licence is MIT.

When your agent uses it

  • Designing schemas
  • Writing migrations
  • Optimizing queries

Example prompts

  • “/database-design”

What it can do on your machine

Read from SKILL.md and the folder at commit 6d95c78. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are sql).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Database Design loads about 1.2k tokens when it runs. Until then it costs about 48 tokens; SKILL.md has 76 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~48
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from MoizIbnYousaf/ai-agent-skills at commit 6d95c78, republished under its MIT licence (© MoizIbnYousaf). 76 words, ~1,158 tokens.

Download SKILL.mdSave it as .claude/skills/database-design/SKILL.md (or your agent's skills folder).
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.
source
wshobson/agents
license
MIT
version
4.1.0

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
Common Optimizations
sql
-- Use EXISTS instead of IN for large sets
SELECT * FROM users u
WHERE EXISTS (SELECT 1 FROM orders o WHERE o.user_id = u.id);

-- Pagination with keyset (cursor) instead of OFFSET
SELECT * FROM posts
WHERE created_at < '2024-01-01'
ORDER BY created_at DESC
LIMIT 20;

-- Use CTEs for complex queries
WITH active_users AS (
  SELECT id FROM users WHERE last_login > NOW() - INTERVAL '30 days'
)
SELECT * FROM orders WHERE user_id IN (SELECT id FROM active_users);

Constraints & Data Integrity

sql
-- Primary key
ALTER TABLE users ADD PRIMARY KEY (id);

-- Foreign key with cascade
ALTER TABLE orders ADD CONSTRAINT fk_orders_user
  FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

-- Check constraint
ALTER TABLE products ADD CONSTRAINT chk_price_positive
  CHECK (price >= 0);

-- Unique constraint
ALTER TABLE users ADD CONSTRAINT uniq_users_email UNIQUE (email);

-- Exclusion constraint (no overlapping ranges)
ALTER TABLE reservations ADD CONSTRAINT excl_no_overlap
  EXCLUDE USING gist (room_id WITH =, tsrange(start_time, end_time) WITH &&);

Best Practices

  • Use UUIDs for public-facing IDs, SERIAL/BIGSERIAL for internal
  • Always add created_at and updated_at timestamps
  • Use soft deletes (deleted_at) for important data
  • Design for eventual consistency in distributed systems
  • Document schema decisions in migration files
  • Test migrations on production-size data before deploying

© MoizIbnYousaf, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/database-design of MoizIbnYousaf/ai-agent-skills.

Open the folder on GitHubat commit 6d95c78

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in MoizIbnYousaf/ai-agent-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Database Design next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Database Design compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Database Design this skillMoizIbnYousaf/ai-agent-skills1.1k1 repos~1.2kAutomated safety check: PassMIT
Golang Databaseunxed/f42402 repos~2.9kAutomated safety check: PassMIT
Database Expertcin12211/orca-q223—~2.8kAutomated safety check: PassMIT
DB Migrationhiromaily/go-crypto-wallet128—~652Automated safety check: PassMIT
Expert DatabaseReJeCtAll/ExpertTeam-Codex113—~692Automated safety check: PassMIT
SQL ProJeffallan/claude-skills12k—~1.3kAutomated safety check: PassMIT

Similar skills

  • Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context…

    240 GitHub starsUsed in 2 repos~2.9k tokens
    DatabasesAuto-check passed
  • Database Expert

    cin12211/orca-q

    Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration.

    223 GitHub stars~2.8k tokensUpdated 15 days ago
    DatabasesAuto-check passed
  • DB Migration

    hiromaily/go-crypto-wallet

    Database schema and migration workflow. An agent skill from hiromaily/go-crypto-wallet.

    128 GitHub stars~652 tokensUpdated 5 mo ago
    DatabasesAuto-check passed
  • Expert Database

    ReJeCtAll/ExpertTeam-Codex

    数据库优化专家入口。用于 Codex CLI 的 $expert-database 调用. An agent skill from ReJeCtAll/ExpertTeam-Codex.

    113 GitHub stars~692 tokensUpdated 3 mo ago
    DatabasesAuto-check passed
  • SQL Pro

    Jeffallan/claude-skills

    Optimizes SQL queries and designs schemas using CTEs, window functions, covering indexes and EXPLAIN ANALYZE, with notes on dialect differences between major databases.

    12k GitHub stars~1.3k tokensUpdated 3 days ago
    DatabasesAuto-check passed
  • Data Model Creation

    TencentCloudBase/CloudBase-AI-Toolkit

    [Deprecated] Optional advanced tool for complex data modeling.

    1.1k GitHub starsUsed in 1 repo~1.8k tokens
    DatabasesAuto-check passed

More from MoizIbnYousaf/ai-agent-skills

All 15 skills in this repo
  • LLM Application Dev

    MoizIbnYousaf/ai-agent-skills

    Building applications with Large Language Models - prompt engineering, RAG patterns, and LLM integration.

    1.1k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check passed
  • Audit Library Health

    MoizIbnYousaf/ai-agent-skills

    A skill your agent uses when checking the overall health of a skills library.

    1.1k GitHub stars~518 tokensUpdated 15 days ago
    Auto-check passed
  • Backend Development

    MoizIbnYousaf/ai-agent-skills

    Backend API design, database architecture, microservices patterns, and test-driven development.

    1.1k GitHub stars~853 tokensUpdated 15 days ago
    Auto-check passed
  • Browse And Evaluate

    MoizIbnYousaf/ai-agent-skills

    A skill your agent uses when exploring the ai-agent-skills catalog to find, compare, and evaluate skills before installing.

    1.1k GitHub stars~453 tokensUpdated 15 days ago
    Auto-check passed
  • Code Documentation

    MoizIbnYousaf/ai-agent-skills

    Writing effective code documentation - API docs, README files, inline comments, and technical guides.

    1.1k GitHub stars~1.4k tokensUpdated 15 days ago
    Auto-check passed
  • Curate A Team Library

    MoizIbnYousaf/ai-agent-skills

    A skill your agent uses when building a managed team skills library for a real stack.

    1.1k GitHub stars~973 tokensUpdated 15 days ago
    Auto-check passed

Works with

Categories

Questions about Database Design

What does Database Design do?

Database schema design, optimization, and migration patterns for PostgreSQL, MySQL, and NoSQL databases. Database Design is an agent skill from MoizIbnYousaf/ai-agent-skills. Database schema design, optimization, and migration patterns for PostgreSQL, MySQL, and NoSQL databases.

When should I use Database Design?

Database Design fits situations like: designing schemas; writing migrations; optimizing queries.

How do I install Database Design in Claude Code?

Run `npx skills add MoizIbnYousaf/ai-agent-skills --skill database-design -a claude-code`. Or copy the skill folder (skills/database-design in MoizIbnYousaf/ai-agent-skills) into .claude/skills/database-design in your project. Claude Code loads it when a task matches its description.

How do I install Database Design in Codex?

Run `npx skills add MoizIbnYousaf/ai-agent-skills --skill database-design -a codex`. Or copy the skill folder (skills/database-design in MoizIbnYousaf/ai-agent-skills) into .agents/skills/database-design in your project. Codex loads it when a task matches its description.

Can I use Database Design in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add MoizIbnYousaf/ai-agent-skills --skill database-design -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/database-design, .gemini/skills/database-design, .github/skills/database-design and .opencode/skills/database-design in your project.

What does Database Design need to run?

SKILL.md names no scripts, command-line tools or credentials: Database Design is instructions for the agent only.

Does Database Design access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Database Design safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Database Design use?

Database Design is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Database Design use?

About 1.2k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Database Design?

Skills that share tags, products or a category with Database Design: Golang Database (unxed/f4, 240 stars), Database Expert (cin12211/orca-q, 223 stars), DB Migration (hiromaily/go-crypto-wallet, 128 stars) and Expert Database (ReJeCtAll/ExpertTeam-Codex, 113 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Database Design?

MoizIbnYousaf (a GitHub user) maintains it in MoizIbnYousaf/ai-agent-skills, which has 1,148 GitHub stars. The repository holds 15 skills in this directory. The repository was last updated on September 21, 2026.

Source: MoizIbnYousaf/ai-agent-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.