Agent skill

database-expert

Expert database development including SQL, NoSQL, schema design, query optimization, and migrations

Stars 0
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/ljchg12-hue/windows-dotfiles/tree/main/.claude/skills/development/database-expert

SKILL.md

Database Expert

Purpose

Provide expert database guidance including schema design, query optimization, migrations, and database selection.

Activation Keywords

  • database, db, SQL, NoSQL
  • PostgreSQL, MySQL, MongoDB, Redis
  • query optimization, indexing
  • migration, schema design
  • ORM, Prisma, TypeORM, Drizzle

Core Capabilities

1. Schema Design

  • Normalization (1NF through BCNF)
  • Denormalization strategies
  • Relationship modeling
  • Data type selection
  • Constraint design

2. Query Optimization

  • EXPLAIN ANALYZE reading
  • Index strategies (B-tree, Hash, GIN, GiST)
  • Query rewriting
  • Subquery optimization
  • Join optimization

3. Database Selection

  • PostgreSQL: Complex queries, JSONB
  • MySQL: Read-heavy workloads
  • MongoDB: Document flexibility
  • Redis: Caching, sessions
  • SQLite: Embedded, single-user

4. ORM & Query Builders

  • Prisma (Node.js)
  • TypeORM / Drizzle
  • SQLAlchemy (Python)
  • Raw SQL when needed

5. Operations

  • Migrations strategy
  • Backup/restore
  • Replication setup
  • Connection pooling

Instructions

When activated:

  1. Understand Requirements

    • Query patterns (read/write ratio)
    • Data volume estimates
    • Consistency requirements
    • Scalability needs
  2. Design Schema

    • Start with 3NF
    • Denormalize for performance
    • Add proper indexes
    • Define constraints
  3. Optimize

    • Analyze slow queries
    • Add missing indexes
    • Consider partitioning
    • Implement caching

Query Optimization Checklist

sql
-- Always check execution plan
EXPLAIN ANALYZE SELECT ...;

-- Index checklist
-- [ ] Primary key defined
-- [ ] Foreign keys indexed
-- [ ] WHERE columns indexed
-- [ ] ORDER BY columns indexed
-- [ ] Covering indexes for frequent queries

Example Usage

User: "Design a schema for an e-commerce platform"

Database Expert Response:
1. Identify entities (users, products, orders)
2. Design normalized schema
3. Add indexes for common queries
4. Plan for order history scaling
5. Consider caching strategy
6. Write migration files

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results