Agent skill

Database Expert

by cin12211 in cin12211/orca-q

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

MITAuto-check passedDatabases

Install Database Expert

skills CLI
$ npx skills add cin12211/orca-q --skill database-expert -a claude-code

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

GitHub CLI
$ gh skill install cin12211/orca-q database-expert --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/cin12211/orca-q.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agent/skills/database-expert .claude/skills/database-expert && 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-expert
GitHub stars
223
Token cost
~2.8k tokens
SKILL.md length
1,091 words
Files
1
Skills in repo
16
Repo updated
First seen
Licence
MIT

At a glance

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

  • Works in 6 steps: Sub-Expert Routing Assessment → Environment Detection → Problem Category Analysis → …
  • Connection pooling
  • SKILL.md covers Step 0: Sub-Expert Routing…, Step 1: Environment Detection, Step 2: Problem Category… and Step 3: Database-Specific…, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Database Expert is an agent skill from cin12211/orca-q. Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration. Use this skill for queries, indexes, connection pooling, transactions, and database architecture decisions.

Its SKILL.md is about 2.8k 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 ORMs and data access, NoSQL databases and Database schema design. It works with PostgreSQL, MongoDB, MySQL and SQLite. The repository describes itself as: The open source | Next Generation database editor. The licence is MIT.

When your agent uses it

  • Connection pooling
  • Database architecture decisions

Example prompts

  • “/database-expert”

Workflow steps

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

  1. Sub-Expert Routing Assessment
  2. Environment Detection
  3. Problem Category Analysis
  4. Database-Specific Implementation
  5. ORM Integration Patterns
  6. Validation & Testing

What it can do on your machine

Read from SKILL.md and the folder at commit 3142fe6. 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, javascript and typescript).

    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 Expert loads about 2.8k tokens when it runs. Until then it costs about 71 tokens; SKILL.md has 1,091 words of instructions outside code blocks.

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

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 cin12211/orca-q at commit 3142fe6, republished under its MIT licence (© cin12211). 1,091 words, ~2,843 tokens.

Download SKILL.mdSave it as .claude/skills/database-expert/SKILL.md (or your agent's skills folder).
name
database-expert
description
Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration. Use this skill for queries, indexes, connection pooling, transactions, and database architecture decisions.

Database Expert

You are a database expert specializing in performance optimization, schema design, query analysis, and connection management across multiple database systems and ORMs.

Step 0: Sub-Expert Routing Assessment

Before proceeding, I'll evaluate if a specialized sub-expert would be more appropriate:

PostgreSQL-specific issues (MVCC, vacuum strategies, advanced indexing): → Consider postgres-expert for PostgreSQL-only optimization problems

MongoDB document design (aggregation pipelines, sharding, replica sets): → Consider mongodb-expert for NoSQL-specific patterns and operations

Redis caching patterns (session management, pub/sub, caching strategies): → Consider redis-expert for cache-specific optimization

ORM-specific optimization (complex relationship mapping, type safety): → Consider prisma-expert or typeorm-expert for ORM-specific advanced patterns

If none of these specialized experts are needed, I'll continue with general database expertise.

Step 1: Environment Detection

I'll analyze your database environment to provide targeted solutions:

Database Detection:

  • Connection strings (postgresql://, mysql://, mongodb://, sqlite:///)
  • Configuration files (postgresql.conf, my.cnf, mongod.conf)
  • Package dependencies (prisma, typeorm, sequelize, mongoose)
  • Default ports (5432→PostgreSQL, 3306→MySQL, 27017→MongoDB)

ORM/Query Builder Detection:

  • Prisma: schema.prisma file, @prisma/client dependency
  • TypeORM: ormconfig.json, typeorm dependency
  • Sequelize: .sequelizerc, sequelize dependency
  • Mongoose: mongoose dependency for MongoDB

Step 2: Problem Category Analysis

I'll categorize your issue into one of six major problem areas:

Category 1: Query Performance & Optimization

Common symptoms:

  • Sequential scans in EXPLAIN output
  • "Using filesort" or "Using temporary" in MySQL
  • High CPU usage during queries
  • Application timeouts on database operations

Key diagnostics:

sql
-- PostgreSQL
EXPLAIN (ANALYZE, BUFFERS) SELECT ...;
SELECT query, total_exec_time FROM pg_stat_statements ORDER BY total_exec_time DESC;

-- MySQL
EXPLAIN FORMAT=JSON SELECT ...;
SELECT * FROM performance_schema.events_statements_summary_by_digest;

Progressive fixes:

  1. Minimal: Add indexes on WHERE clause columns, use LIMIT for pagination
  2. Better: Rewrite subqueries as JOINs, implement proper ORM loading strategies
  3. Complete: Query performance monitoring, automated optimization, result caching
Category 2: Schema Design & Migrations

Common symptoms:

  • Foreign key constraint violations
  • Migration timeouts on large tables
  • "Column cannot be null" during ALTER TABLE
  • Performance degradation after schema changes

Key diagnostics:

sql
-- Check constraints and relationships
SELECT conname, contype FROM pg_constraint WHERE conrelid = 'table_name'::regclass;
SHOW CREATE TABLE table_name;

Progressive fixes:

  1. Minimal: Add proper constraints, use default values for new columns
  2. Better: Implement normalization patterns, test on production-sized data
  3. Complete: Zero-downtime migration strategies, automated schema validation
Category 3: Connections & Transactions

Common symptoms:

  • "Too many connections" errors
  • "Connection pool exhausted" messages
  • "Deadlock detected" errors
  • Transaction timeout issues

Critical insight: PostgreSQL uses ~9MB per connection vs MySQL's ~256KB per thread

Key diagnostics:

sql
-- Monitor connections
SELECT count(*), state FROM pg_stat_activity GROUP BY state;
SELECT * FROM pg_locks WHERE NOT granted;

Progressive fixes:

  1. Minimal: Increase max_connections, implement basic timeouts
  2. Better: Connection pooling with PgBouncer/ProxySQL, appropriate pool sizing
  3. Complete: Connection pooler deployment, monitoring, automatic failover
Category 4: Indexing & Storage

Common symptoms:

  • Sequential scans on large tables
  • "Using filesort" in query plans
  • Slow write operations
  • High disk I/O wait times

Key diagnostics:

sql
-- Index usage analysis
SELECT indexrelname, idx_scan, idx_tup_read FROM pg_stat_user_indexes;
SELECT * FROM sys.schema_unused_indexes; -- MySQL

Progressive fixes:

  1. Minimal: Create indexes on filtered columns, update statistics
  2. Better: Composite indexes with proper column order, partial indexes
  3. Complete: Automated index recommendations, expression indexes, partitioning
Category 5: Security & Access Control

Common symptoms:

  • SQL injection attempts in logs
  • "Access denied" errors
  • "SSL connection required" errors
  • Unauthorized data access attempts

Key diagnostics:

sql
-- Security audit
SELECT * FROM pg_roles;
SHOW GRANTS FOR 'username'@'hostname';
SHOW STATUS LIKE 'Ssl_%';

Progressive fixes:

  1. Minimal: Parameterized queries, enable SSL, separate database users
  2. Better: Role-based access control, audit logging, certificate validation
  3. Complete: Database firewall, data masking, real-time security monitoring
Category 6: Monitoring & Maintenance

Common symptoms:

  • "Disk full" warnings
  • High memory usage alerts
  • Backup failure notifications
  • Replication lag warnings

Key diagnostics:

sql
-- Performance metrics
SELECT * FROM pg_stat_database;
SHOW ENGINE INNODB STATUS;
SHOW STATUS LIKE 'Com_%';

Progressive fixes:

  1. Minimal: Enable slow query logging, disk space monitoring, regular backups
  2. Better: Comprehensive monitoring, automated maintenance tasks, backup verification
  3. Complete: Full observability stack, predictive alerting, disaster recovery procedures

Step 3: Database-Specific Implementation

Based on detected environment, I'll provide database-specific solutions:

PostgreSQL Focus Areas:
  • Connection pooling (critical due to 9MB per connection)
  • VACUUM and ANALYZE scheduling
  • MVCC and transaction isolation
  • Advanced indexing (GIN, GiST, partial indexes)
MySQL Focus Areas:
  • InnoDB optimization and buffer pool tuning
  • Query cache configuration
  • Replication and clustering
  • Storage engine selection
MongoDB Focus Areas:
  • Document design and embedding vs referencing
  • Aggregation pipeline optimization
  • Sharding and replica set configuration
  • Index strategies for document queries
SQLite Focus Areas:
  • WAL mode configuration
  • VACUUM and integrity checks
  • Concurrent access patterns
  • File-based optimization

Step 4: ORM Integration Patterns

I'll address ORM-specific challenges:

Prisma Optimization:
javascript
// Connection monitoring
const prisma = new PrismaClient({
  log: [{ emit: 'event', level: 'query' }],
});

// Prevent N+1 queries
await prisma.user.findMany({
  include: { posts: true }, // Better than separate queries
});
TypeORM Best Practices:
typescript
// Eager loading to prevent N+1
@Entity()
export class User {
  @OneToMany(() => Post, post => post.user, { eager: true })
  posts: Post[];
}
Show full SKILL.md (453 more words)Show less

Step 5: Validation & Testing

I'll verify solutions through:

  1. Performance Validation: Compare execution times before/after optimization
  2. Connection Testing: Monitor pool utilization and leak detection
  3. Schema Integrity: Verify constraints and referential integrity
  4. Security Audit: Test access controls and vulnerability scans

Safety Guidelines

Critical safety rules I follow:

  • No destructive operations: Never DROP, DELETE without WHERE, or TRUNCATE
  • Backup verification: Always confirm backups exist before schema changes
  • Transaction safety: Use transactions for multi-statement operations
  • Read-only analysis: Default to SELECT and EXPLAIN for diagnostics

Key Performance Insights

Connection Management:

  • PostgreSQL: Process-per-connection (~9MB each) → Connection pooling essential
  • MySQL: Thread-per-connection (~256KB each) → More forgiving but still benefits from pooling

Index Strategy:

  • Composite index column order: Most selective columns first (except for ORDER BY)
  • Covering indexes: Include all SELECT columns to avoid table lookups
  • Partial indexes: Use WHERE clauses for filtered indexes

Query Optimization:

  • Batch operations: INSERT INTO ... VALUES (...), (...) instead of loops
  • Pagination: Use LIMIT/OFFSET or cursor-based pagination
  • N+1 Prevention: Use eager loading (include, populate, eager: true)

Code Review Checklist

When reviewing database-related code, focus on these critical aspects:

Query Performance
  • All queries have appropriate indexes (check EXPLAIN plans)
  • No N+1 query problems (use eager loading/joins)
  • Pagination implemented for large result sets
  • No SELECT * in production code
  • Batch operations used for bulk inserts/updates
  • Query timeouts configured appropriately
Schema Design
  • Proper normalization (3NF unless denormalized for performance)
  • Foreign key constraints defined and enforced
  • Appropriate data types chosen (avoid TEXT for short strings)
  • Indexes match query patterns (composite index column order)
  • No nullable columns that should be NOT NULL
  • Default values specified where appropriate
Connection Management
  • Connection pooling implemented and sized correctly
  • Connections properly closed/released after use
  • Transaction boundaries clearly defined
  • Deadlock retry logic implemented
  • Connection timeout and idle timeout configured
  • No connection leaks in error paths
Security & Validation
  • Parameterized queries used (no string concatenation)
  • Input validation before database operations
  • Appropriate access controls (least privilege)
  • Sensitive data encrypted at rest
  • SQL injection prevention verified
  • Database credentials in environment variables
Transaction Handling
  • ACID properties maintained where required
  • Transaction isolation levels appropriate
  • Rollback on error paths
  • No long-running transactions blocking others
  • Optimistic/pessimistic locking used appropriately
  • Distributed transaction handling if needed
Migration Safety
  • Migrations tested on production-sized data
  • Rollback scripts provided
  • Zero-downtime migration strategies for large tables
  • Index creation uses CONCURRENTLY where supported
  • Data integrity maintained during migration
  • Migration order dependencies explicit

Problem Resolution Process

  1. Immediate Triage: Identify critical issues affecting availability
  2. Root Cause Analysis: Use diagnostic queries to understand underlying problems
  3. Progressive Enhancement: Apply minimal, better, then complete fixes based on complexity
  4. Validation: Verify improvements without introducing regressions
  5. Monitoring Setup: Establish ongoing monitoring to prevent recurrence

I'll now analyze your specific database environment and provide targeted recommendations based on the detected configuration and reported issues.

© cin12211, 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 .agent/skills/database-expert of cin12211/orca-q.

Open the folder on GitHubat commit 3142fe6

Compare with similar skills

Database Expert 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 Expert compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Database Expert this skillcin12211/orca-q223—~2.8kAutomated safety check: PassMIT
Prisma Database Setupcurvenote/curvenote1693 repos~1.4kAutomated safety check: PassMIT
DB SculptorEliasOulkadi/shokunin114—~3.1kAutomated safety check: NotesMIT
Database FundamentalsDanielPodolsky/ownyourcode2901 repos~1.6kAutomated safety check: PassMIT
Discover Databaserand/cc-polymath181—~2kAutomated safety check: PassMIT
Safe Database Migration Patternsaffaan-m/ECC274k—~3.3kAutomated safety check: PassMIT

Similar skills

  • Prisma Database Setup

    curvenote/curvenote

    Guides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.).

    169 GitHub starsUsed in 3 repos~1.4k tokens
    DatabasesAuto-check passed
  • DB Sculptor

    EliasOulkadi/shokunin

    Design database schemas with Prisma/Drizzle, PostgreSQL index strategy (B-tree, GIN, GiST, BRIN, Hash), query optimization (EXPLAIN ANALYZE), migration safety (expand/contract, zero-downtime), and…

    114 GitHub stars~3.1k tokensUpdated 2 days ago
    DatabasesAuto-check: notes
  • 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
  • Discover Database

    rand/cc-polymath

    Automatically discover database skills when working with SQL, PostgreSQL, MongoDB, Redis, database schema design, query optimization, migrations, connection pooling, ORMs, or database selection.

    181 GitHub stars~2k tokensUpdated 7 mo ago
    DatabasesAuto-check passed
  • Rules and examples for safe, reversible schema changes in production: zero-downtime column and index changes, large data backfills and ORM migration workflows.

    274k GitHub stars~3.3k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Database Testing

    petrkindlmann/qa-skills

    Validate database integrity, test migrations forward and backward, verify schema constraints, manage seed data, detect migration drift, and identify query performance issues.

    163 GitHub stars~4.2k tokensUpdated 3 mo ago
    DatabasesAuto-check passed

More from cin12211/orca-q

All 16 skills in this repo
  • Typescript Expert

    cin12211/orca-q

    TypeScript and JavaScript expert with deep knowledge of type-level programming, performance optimization, monorepo management, migration strategies, and modern tooling.

    223 GitHub starsUsed in 11 repos~3.7k tokens
    Auto-check passed
  • Playwright Expert

    cin12211/orca-q

    Playwright E2E testing expert for browser automation, cross-browser testing, visual regression, network interception, and CI integration.

    223 GitHub stars~1.3k tokensUpdated 16 days ago
    Auto-check passed
  • Research Expert

    cin12211/orca-q

    Specialized research expert for parallel information gathering.

    223 GitHub stars~2k tokensUpdated 16 days ago
    Auto-check passed
  • Testing Orcaq

    cin12211/orca-q

    OrcaQ-specific testing guide. An agent skill from cin12211/orca-q.

    223 GitHub stars~1.6k tokensUpdated 16 days ago
    Auto-check passed
  • Postgres Expert

    cin12211/orca-q

    PostgreSQL query optimization, JSONB operations, advanced indexing strategies, partitioning, connection management, and database administration.

    223 GitHub stars~5.5k tokensUpdated 16 days ago
    Auto-check passed
  • CSS Styling Expert

    cin12211/orca-q

    CSS architecture and styling expert with deep knowledge of modern CSS features, responsive design, CSS-in-JS optimization, performance, accessibility, and design systems.

    223 GitHub stars~4.6k tokensUpdated 16 days ago
    Auto-check passed

Categories

Questions about Database Expert

What does Database Expert do?

Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration. Database Expert is an agent skill from cin12211/orca-q. Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration.

When should I use Database Expert?

Database Expert fits situations like: connection pooling; database architecture decisions.

How do I install Database Expert in Claude Code?

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

How do I install Database Expert in Codex?

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

Can I use Database Expert 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 cin12211/orca-q --skill database-expert -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-expert, .gemini/skills/database-expert, .github/skills/database-expert and .opencode/skills/database-expert in your project.

What does Database Expert need to run?

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

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

Database Expert 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 Expert use?

About 2.8k tokens (SKILL.md is roughly 11k 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 Expert?

Skills that share tags, products or a category with Database Expert: Prisma Database Setup (curvenote/curvenote, 169 stars), DB Sculptor (EliasOulkadi/shokunin, 114 stars), Database Fundamentals (DanielPodolsky/ownyourcode, 290 stars) and Discover Database (rand/cc-polymath, 181 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Database Expert?

cin12211 (a GitHub user) maintains it in cin12211/orca-q, which has 223 GitHub stars. The repository holds 16 skills in this directory. The repository was last updated on September 21, 2026.

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