Agent skill

Database Designer

by alirezarezvani in alirezarezvani/claude-skills

A skill your agent uses when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.

MITAuto-check passedDatabases

Install Database Designer

skills CLI
$ npx skills add alirezarezvani/claude-skills --skill database-designer -a claude-code

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

GitHub CLI
$ gh skill install alirezarezvani/claude-skills database-designer --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/alirezarezvani/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/engineering/skills/database-designer .claude/skills/database-designer && 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-designer
GitHub stars
28k
Token cost
~3.2k tokens
SKILL.md length
1,150 words
Files
15 (incl. references, assets)
Skills in repo
342
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.

  • Works in 4 steps: Analyze the schema → Optimize indexes against real query… → Generate the migration → …
  • The user asks to design database schemas
  • SKILL.md covers Overview, Core Competencies, Tool Workflow (run these — do… and Database Design Principles, plus 4 more sections
  • Runs Python scripts from its folder; calls python3

What it does

Database Designer is an agent skill from alirezarezvani/claude-skills. Use when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.

Its SKILL.md is about 3.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 17 other files, including reference files and assets (for example `README.md`, `assets/sample_query_patterns.json` and `assets/sample_schema.json`).

It sits in Databases, covering Database schema design, SQL and Database migrations. It works with SQL. The repository describes itself as: 380 Claude Code skills & agent skills & plugins (30+ Agents, 70+ custom commands, 380+ skills, customizable references, scripts)for Claude Code, Codex, Gemini CLI, Cursor, and 8… The licence is MIT.

When your agent uses it

  • The user asks to design database schemas
  • Plan data migrations
  • Optimize queries
  • Choose between SQL and NoSQL

Example prompts

  • “/database-designer”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Analyze the schema
  2. Optimize indexes against real query patterns
  3. Generate the migration
  4. Verification loop

What it can do on your machine

Read from SKILL.md and the folder at commit 19392f7. 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

    Ships script files (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    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 Designer loads about 3.2k tokens when it runs, and up to ~16k if it reads all its reference files. Until then it costs about 42 tokens; SKILL.md has 1,150 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~42
When it runs · the whole SKILL.md, loaded when a task matches
~3.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~16k

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 alirezarezvani/claude-skills at commit 19392f7, republished under its MIT licence (© alirezarezvani). 1,150 words, ~3,177 tokens.

Download SKILL.mdSave it as .claude/skills/database-designer/SKILL.md (or your agent's skills folder). This skill also uses 14 other files; get the full folder from GitHub.
name
database-designer
description
Use when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.

Database Designer - POWERFUL Tier Skill

Overview

A comprehensive database design skill that provides expert-level analysis, optimization, and migration capabilities for modern database systems. This skill combines theoretical principles with practical tools to help architects and developers create scalable, performant, and maintainable database schemas.

Core Competencies

Schema Design & Analysis
  • Normalization Analysis: Automated detection of normalization levels (1NF through BCNF)
  • Denormalization Strategy: Smart recommendations for performance optimization
  • Data Type Optimization: Identification of inappropriate types and size issues
  • Constraint Analysis: Missing foreign keys, unique constraints, and null checks
  • Naming Convention Validation: Consistent table and column naming patterns
  • ERD Generation: Automatic Mermaid diagram creation from DDL
Index Optimization
  • Index Gap Analysis: Identification of missing indexes on foreign keys and query patterns
  • Composite Index Strategy: Optimal column ordering for multi-column indexes
  • Index Redundancy Detection: Elimination of overlapping and unused indexes
  • Performance Impact Modeling: Selectivity estimation and query cost analysis
  • Index Type Selection: B-tree, hash, partial, covering, and specialized indexes
Migration Management
  • Zero-Downtime Migrations: Expand-contract pattern implementation
  • Schema Evolution: Safe column additions, deletions, and type changes
  • Data Migration Scripts: Automated data transformation and validation
  • Rollback Strategy: Complete reversal capabilities with validation
  • Execution Planning: Ordered migration steps with dependency resolution

Tool Workflow (run these — do not analyze schemas by hand)

All paths relative to this skill folder; sample inputs in assets/.

1. Analyze the schema
bash
python3 schema_analyzer.py --input schema.sql --generate-erd --output-format json -o analysis.json

Accepts SQL DDL or JSON schema (assets/sample_schema.sql / sample_schema.json). Output includes normalization findings, missing constraints, naming issues, and a Mermaid ERD — show the ERD to the user and fix flagged issues before optimizing.

2. Optimize indexes against real query patterns
bash
python3 index_optimizer.py --schema assets/sample_schema.json --queries assets/sample_query_patterns.json --analyze-existing --format json -o indexes.json

Write the user's hot queries into a query-patterns JSON first (copy assets/sample_query_patterns.json). Output is a priority-ordered list of CREATE INDEX recommendations plus redundant-index removals.

3. Generate the migration
bash
python3 migration_generator.py --current current_schema.json --target target_schema.json --zero-downtime --format sql -o migration.sql

--zero-downtime emits an expand-contract plan; --validate-only checks feasibility without generating SQL.

4. Verification loop

Re-run step 1 on the target schema and assert the issues found in the first pass are gone; run migration_generator.py --validate-only before handing over the migration.

Database Design Principles

→ See references/database-design-reference.md for details

Best Practices

Schema Design
  1. Use meaningful names: Clear, consistent naming conventions
  2. Choose appropriate data types: Right-sized columns for storage efficiency
  3. Define proper constraints: Foreign keys, check constraints, unique indexes
  4. Consider future growth: Plan for scale from the beginning
  5. Document relationships: Clear foreign key relationships and business rules
Performance Optimization
  1. Index strategically: Cover common query patterns without over-indexing
  2. Monitor query performance: Regular analysis of slow queries
  3. Partition large tables: Improve query performance and maintenance
  4. Use appropriate isolation levels: Balance consistency with performance
  5. Implement connection pooling: Efficient resource utilization
Security Considerations
  1. Principle of least privilege: Grant minimal necessary permissions
  2. Encrypt sensitive data: At rest and in transit
  3. Audit access patterns: Monitor and log database access
  4. Validate inputs: Prevent SQL injection attacks
  5. Regular security updates: Keep database software current

Query Generation Patterns

SELECT with JOINs
sql
-- INNER JOIN: only matching rows
SELECT o.id, c.name, o.total
FROM orders o
INNER JOIN customers c ON c.id = o.customer_id;

-- LEFT JOIN: all left rows, NULLs for non-matches
SELECT c.name, COUNT(o.id) AS order_count
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.id
GROUP BY c.name;

-- Self-join: hierarchical data (employees/managers)
SELECT e.name AS employee, m.name AS manager
FROM employees e
LEFT JOIN employees m ON m.id = e.manager_id;
Common Table Expressions (CTEs)
sql
-- Recursive CTE for org chart
WITH RECURSIVE org AS (
  SELECT id, name, manager_id, 1 AS depth
  FROM employees WHERE manager_id IS NULL
  UNION ALL
  SELECT e.id, e.name, e.manager_id, o.depth + 1
  FROM employees e INNER JOIN org o ON o.id = e.manager_id
)
SELECT * FROM org ORDER BY depth, name;
Window Functions
sql
-- ROW_NUMBER for pagination / dedup
SELECT *, ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY created_at DESC) AS rn
FROM orders;

-- RANK with gaps, DENSE_RANK without gaps
SELECT name, score, RANK() OVER (ORDER BY score DESC) AS rank FROM leaderboard;

-- LAG/LEAD for comparing adjacent rows
SELECT date, revenue,
  revenue - LAG(revenue) OVER (ORDER BY date) AS daily_change
FROM daily_sales;
Aggregation Patterns
sql
-- FILTER clause (PostgreSQL) for conditional aggregation
SELECT
  COUNT(*) AS total,
  COUNT(*) FILTER (WHERE status = 'active') AS active,
  AVG(amount) FILTER (WHERE amount > 0) AS avg_positive
FROM accounts;

-- GROUPING SETS for multi-level rollups
SELECT region, product, SUM(revenue)
FROM sales
GROUP BY GROUPING SETS ((region, product), (region), ());

Migration Patterns

Up/Down Migration Scripts

Every migration must have a reversible counterpart. Name files with a timestamp prefix for ordering:

migrations/
├── 20260101_000001_create_users.up.sql
├── 20260101_000001_create_users.down.sql
├── 20260115_000002_add_users_email_index.up.sql
└── 20260115_000002_add_users_email_index.down.sql
Zero-Downtime Migrations (Expand/Contract)

Use the expand-contract pattern to avoid locking or breaking running code:

  1. Expand — add the new column/table (nullable, with default)
  2. Migrate data — backfill in batches; dual-write from application
  3. Transition — application reads from new column; stop writing to old
  4. Contract — drop old column in a follow-up migration
Data Backfill Strategies
sql
-- Batch update to avoid long-running locks
UPDATE users SET email_normalized = LOWER(email)
WHERE id IN (SELECT id FROM users WHERE email_normalized IS NULL LIMIT 5000);
-- Repeat in a loop until 0 rows affected
Rollback Procedures
  • Always test the down.sql in staging before deploying up.sql to production
  • Keep rollback window short — if the contract step has run, rollback requires a new forward migration
  • For irreversible changes (dropping columns with data), take a logical backup first

Performance Optimization

Indexing Strategies
Index TypeUse CaseExample
B-tree (default)Equality, range, ORDER BYCREATE INDEX idx_users_email ON users(email);
GINFull-text search, JSONB, arraysCREATE INDEX idx_docs_body ON docs USING gin(to_tsvector('english', body));
GiSTGeometry, range types, nearest-neighborCREATE INDEX idx_locations ON places USING gist(coords);
PartialSubset of rows (reduce size)CREATE INDEX idx_active ON users(email) WHERE active = true;
CoveringIndex-only scansCREATE INDEX idx_cov ON orders(customer_id) INCLUDE (total, created_at);
Show full SKILL.md (477 more words)Show less
EXPLAIN Plan Reading
sql
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT ...;

Key signals to watch:

  • Seq Scan on large tables — missing index
  • Nested Loop with high row estimates — consider hash/merge join or add index
  • Buffers shared read much higher than hit — working set exceeds memory
N+1 Query Detection

Symptoms: application issues one query per row (e.g., fetching related records in a loop).

Fixes:

  • Use JOIN or subquery to fetch in one round-trip
  • ORM eager loading (select_related / includes / with)
  • DataLoader pattern for GraphQL resolvers
Connection Pooling
ToolProtocolBest For
PgBouncerPostgreSQLTransaction/statement pooling, low overhead
ProxySQLMySQLQuery routing, read/write splitting
Built-in pool (HikariCP, SQLAlchemy pool)AnyApplication-level pooling

Rule of thumb: Set pool size to (2 * CPU cores) + disk spindles. For cloud SSDs, start with 2 * vCPUs and tune.

Read Replicas and Query Routing
  • Route all SELECT queries to replicas; writes to primary
  • Account for replication lag (typically <1s for async, 0 for sync)
  • Use pg_last_wal_replay_lsn() to detect lag before reading critical data

Multi-Database Decision Matrix

CriteriaPostgreSQLMySQLSQLiteSQL Server
Best forComplex queries, JSONB, extensionsWeb apps, read-heavy workloadsEmbedded, dev/test, edgeEnterprise .NET stacks
JSON supportExcellent (JSONB + GIN)Good (JSON type)MinimalGood (OPENJSON)
ReplicationStreaming, logicalGroup replication, InnoDB clusterN/AAlways On AG
LicensingOpen source (PostgreSQL License)Open source (GPL) / commercialPublic domainCommercial
Max practical sizeMulti-TBMulti-TB~1 TB (single-writer)Multi-TB

When to choose:

  • PostgreSQL — default choice for new projects; best extensibility and standards compliance
  • MySQL — existing MySQL ecosystem; simple read-heavy web applications
  • SQLite — mobile apps, CLI tools, unit test databases, IoT/edge
  • SQL Server — mandated by enterprise policy; deep .NET/Azure integration
NoSQL Considerations
DatabaseModelUse When
MongoDBDocumentSchema flexibility, rapid prototyping, content management
RedisKey-value / cacheSession store, rate limiting, leaderboards, pub/sub
DynamoDBWide-columnServerless AWS apps, single-digit-ms latency at any scale

Use SQL as default. Reach for NoSQL only when the access pattern clearly benefits from it.


Sharding & Replication

Horizontal vs Vertical Partitioning
  • Vertical partitioning: Split columns across tables (e.g., separate BLOB columns). Reduces I/O for narrow queries.
  • Horizontal partitioning (sharding): Split rows across databases/servers. Required when a single node cannot hold the dataset or handle the throughput.
Sharding Strategies
StrategyHow It WorksProsCons
Hashshard = hash(key) % NEven distributionResharding is expensive
RangeShard by date or ID rangeSimple, good for time-seriesHot spots on latest shard
GeographicShard by user regionData locality, complianceCross-region queries are hard
Replication Patterns
PatternConsistencyLatencyUse Case
SynchronousStrongHigher write latencyFinancial transactions
AsynchronousEventualLow write latencyRead-heavy web apps
Semi-synchronousAt-least-one replica confirmedModerateBalance of safety and speed

Cross-References

  • sql-database-assistant — query writing, optimization, and debugging for day-to-day SQL work
  • database-schema-designer — ERD modeling, normalization analysis, and schema generation
  • migration-architect — large-scale migration planning across database engines or major schema overhauls
  • senior-backend — application-layer patterns (connection pooling, ORM best practices)
  • senior-devops — infrastructure provisioning for database clusters and replicas

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

Files

SKILL.md and 14 other files (references, assets) in engineering/skills/database-designer of alirezarezvani/claude-skills.

  • SKILL.md
  • README.md
  • assets/sample_query_patterns.json
  • assets/sample_schema.json
  • assets/sample_schema.sql
  • expected_outputs/index_optimization_sample.txt
  • expected_outputs/migration_sample.txt
  • expected_outputs/schema_analysis_sample.txt
  • index_optimizer.py
  • migration_generator.py
  • references/database-design-reference.md
  • references/database_selection_decision_tree.md
  • references/index_strategy_patterns.md
  • references/normalization_guide.md
  • schema_analyzer.py

Open the folder on GitHubat commit 19392f7

Compare with similar skills

Database Designer 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 Designer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Database Designer this skillalirezarezvani/claude-skills28k—~3.2kAutomated safety check: PassMIT
DatabasesMicrock/ordinary-claude-skills401—~1.9kAutomated safety check: NotesMIT
Cursor BYOK Database Schemaleookun/cursor-byok3.2k—~1.3kAutomated safety check: PassMIT
Database FundamentalsDanielPodolsky/ownyourcode2901 repos~1.6kAutomated safety check: PassMIT
DB Migrationskurealnum/dotfiles290—~820Automated safety check: PassNone
DB ContextSilvioBaratto/optimizer176—~6.4kAutomated safety check: NotesCustom licence

Similar skills

  • Databases

    Microck/ordinary-claude-skills

    Work with MongoDB (document database, BSON documents, aggregation pipelines, Atlas cloud) and PostgreSQL (relational database, SQL queries, psql CLI, pgAdmin).

    401 GitHub stars~1.9k tokensUpdated 1 mo ago
    DatabasesAuto-check: notes
  • Cursor BYOK Database Schema

    leookun/cursor-byok

    Guides SQLite schema changes in the Cursor BYOK server, keeping SQLx migrations, the Rust store, API contracts and fixtures aligned.

    3.2k GitHub stars~1.3k tokensUpdated 9 days ago
    DatabasesAuto-check passed
  • Database Fundamentals

    DanielPodolsky/ownyourcode

    Reviews schema design, SQL queries, ORM patterns. An agent skill from DanielPodolsky/ownyourcode.

    290 GitHub starsUsed in 1 repo~1.6k tokens
    DatabasesAuto-check passed
  • DB Migrations

    kurealnum/dotfiles

    A skill your agent uses when generating or regenerating Drizzle migration files, changing database schema tables or columns, resolving migration sequence conflicts after rebase, reviewing migration…

    290 GitHub stars~820 tokensUpdated 5 mo ago
    DatabasesAuto-check passed
  • DB Context

    SilvioBaratto/optimizer

    Complete knowledge of the optimizer PostgreSQL database: 57 ingestion tables, schema, relationships, live row counts, query patterns, and conventions.

    176 GitHub stars~6.4k tokensUpdated yesterday
    DatabasesAuto-check: notes
  • Migration

    kortix-ai/suna

    How to change the database schema in this repo. An agent skill from kortix-ai/suna.

    20k GitHub stars~1.2k tokensUpdated today
    DatabasesAuto-check passed

More from alirezarezvani/claude-skills

All 342 skills in this repo
  • Agile Product Owner

    alirezarezvani/claude-skills

    Writes INVEST-checked user stories with acceptance criteria, splits epics, plans sprints from velocity and ranks the backlog with a weighted score.

    28k GitHub starsUsed in 3 repos~3.2k tokens
    Auto-check passed
  • Product Strategist

    alirezarezvani/claude-skills

    OKR cascade toolkit for product leaders: generates aligned company-to-team OKRs from five strategy types and scores how well they line up.

    28k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • App Store Optimization

    alirezarezvani/claude-skills

    App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store.

    28k GitHub starsUsed in 1 repo~4.2k tokens
    Auto-check passed
  • AWS Solution Architect

    alirezarezvani/claude-skills

    Design AWS architectures for startups using serverless patterns and IaC templates.

    28k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Campaign Analytics

    alirezarezvani/claude-skills

    Calculates attribution, funnel and ROI figures for marketing campaigns with three Python scripts that need only the standard library.

    28k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed
  • Code to PRD

    alirezarezvani/claude-skills

    Reverse-engineers a frontend, backend or fullstack codebase into a product requirements document with per-page docs, an enum dictionary and an API inventory.

    28k GitHub starsUsed in 1 repo~4.9k tokens
    Auto-check passed

Works with

Categories

Questions about Database Designer

What does Database Designer do?

A skill your agent uses when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships. Database Designer is an agent skill from alirezarezvani/claude-skills. Use when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.

When should I use Database Designer?

Database Designer fits situations like: the user asks to design database schemas; plan data migrations; optimize queries; choose between SQL and NoSQL.

How do I install Database Designer in Claude Code?

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

How do I install Database Designer in Codex?

Run `npx skills add alirezarezvani/claude-skills --skill database-designer -a codex`. Or copy the skill folder (engineering/skills/database-designer in alirezarezvani/claude-skills) into .agents/skills/database-designer in your project. Codex loads it when a task matches its description.

Can I use Database Designer 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 alirezarezvani/claude-skills --skill database-designer -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-designer, .gemini/skills/database-designer, .github/skills/database-designer and .opencode/skills/database-designer in your project.

What does Database Designer need to run?

Going by SKILL.md and its folder, Database Designer needs Python for the scripts in its folder and the command-line tools its instructions call (python3). Our summary lists: Python 3.

Does Database Designer 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 Designer 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 Designer use?

Database Designer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Database Designer use?

About 3.2k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 13k tokens, read only when the agent opens those files.

What are the alternatives to Database Designer?

Skills that share tags, products or a category with Database Designer: Databases (Microck/ordinary-claude-skills, 401 stars), Cursor BYOK Database Schema (leookun/cursor-byok, 3.2k stars), Database Fundamentals (DanielPodolsky/ownyourcode, 290 stars) and DB Migrations (kurealnum/dotfiles, 290 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Database Designer?

alirezarezvani (a GitHub user) maintains it in alirezarezvani/claude-skills, which has 27,788 GitHub stars. The repository holds 342 skills in this directory. The repository was last updated on August 30, 2026.

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