data-relational-database
Use when the user asks about PostgreSQL or MySQL indexing, EXPLAIN ANALYZE, partitioning, streaming or logical replication, autovacuum, connection pooling…
от j4flmao★ 47 звёзд на GitHub
Установить data-relational-database в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Data Relational Database
Purpose
Design relational database schemas with proper indexing, partitioning, replication, connection pooling, and query optimization strategies.
Agent Protocol
Trigger
Exact user phrases: "PostgreSQL", "MySQL", "relational database", "partitioning", "replication", "indexing", "vacuum", "connection pooling", "query optimization", "EXPLAIN", "CTE", "window function", "transaction isolation", "migration", "PgBouncer", "MVCC", "WAL", "B-tree", "GiST", "GIN", "BRIN".
Input Context
Before activating, verify:
- Database platform (PostgreSQL, MySQL, MariaDB, SQLite)
- Data volume (rows, growth rate, total size in GB/TB)
- Query workload (OLTP, OLAP, mixed)
- Current schema and migration tool (Alembic, Sqitch, Flyway, Liquibase)
- Existing indexing strategy and planner statistics
- Replication needs (read replicas, disaster recovery, logical replication)
- Connection pooling requirements (client count, max connections)
Output Artifact
Database schema with indexes, partition configuration, replication setup, and query optimization plan as SQL and YAML.
Response Format
-- Table DDL with partitioning
-- Index creation statements
-- Replication configuration
-- Migration statements
# Connection pool config
# Replication setup
# Vacuum settings
No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.
Completion Criteria
- Normalized schema with appropriate constraints (PK, FK, CHECK, UNIQUE)
- Indexing strategy covering slow queries (EXPLAIN ANALYZE output reviewed)
- Partitioning scheme configured for large tables
- Replication setup (streaming for HA, logical for data distribution)
- Connection pool configured (PgBouncer transaction mode default)
- Vacuum and autovacuum settings tuned
- Transaction isolation levels chosen per workload
- Migration plan with rollback strategy
Max Response Length
300 lines of SQL and configuration.
Workflow
Step 1: Schema Design
Normalize to 3NF by default. Denormalize only for read-heavy analytical queries. Every table needs a primary key (UUID or BIGSERIAL). Foreign keys with indexes on referencing columns. Naming: snake_case for tables, columns, indexes; uq_ unique, ix_ index, fk_ foreign key, pk_ primary key. Use CHECK constraints for domain integrity. Use ENUM or reference tables for constrained values.
CREATE TABLE customers (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email TEXT NOT NULL UNIQUE,
name TEXT NOT NULL,
status customer_status NOT NULL DEFAULT 'active',
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
Step 2: Indexing Strategy
B-tree: default for equality and range queries on high-cardinality columns. GiST: full-text search, geometric data, range type overlap. GIN: JSONB, array containment, full-text search tsvector. BRIN: large sequential tables where rows are physically ordered (time-series). Partial indexes for filtered queries. Composite indexes with leading column matching the most selective filter. Covering indexes (INCLUDE columns) for index-only scans. Avoid over-indexing on write-heavy tables.
-- B-tree composite: equality then range
CREATE INDEX ix_orders_customer_created
ON orders (customer_id, created_at DESC);
-- Partial: only active orders
CREATE INDEX ix_orders_active
ON orders (created_at DESC)
WHERE status = 'pending';
-- GIN: JSONB path operations
CREATE INDEX ix_products_attrs
ON products USING GIN (attributes jsonb_path_ops);
-- BRIN: time-series with 100000 block range
CREATE INDEX ix_events_ts
ON events USING BRIN (occurred_at)
WITH (pages_per_range = 100000);
Step 3: Partitioning
Range partition by date for time-series data. List partition by category/region. Hash partition for load balancing when no natural partition key. Sub-partitioning for multi-dimensional data. Each partition is a table — indexes must be created per partition or on parent (PG 12+). Partition pruning requires WHERE clause on partition key. Avoid too many partitions (>1000).
CREATE TABLE events (
id BIGSERIAL, occurred_at TIMESTAMPTZ NOT NULL,
event_type TEXT NOT NULL, payload JSONB
) PARTITION BY RANGE (occurred_at);
CREATE TABLE events_2025_q1 PARTITION OF events
FOR VALUES FROM ('2025-01-01') TO ('2025-04-01');
CREATE TABLE events_2025_q2 PARTITION OF events
FOR VALUES FROM ('2025-04-01') TO ('2025-07-01');
Step 4: Replication
Streaming replication: primary ships WAL to standbys. Synchronous for zero data loss (2 safe). Asynchronous for performance (slight lag). Cascading replication for geographic distribution. Logical replication: publish/subscribe at table level, cross-version compatible, supports selective replication. Conflict resolution for bidirectional: last-write-wins or custom handler.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/cockroachdb-yugabyte.md
- references/database-indexing.md
- references/database-migration-strategies.md
- references/distributed-sql-databases.md
- references/postgres-advanced.md
- references/query-optimization.md
- references/relational-database-high-availability.md
- references/relational-database-query-optimization.md
FAQ
Что делает скилл data-relational-database?
Use when the user asks about PostgreSQL or MySQL indexing, EXPLAIN ANALYZE, partitioning, streaming or logical replication, autovacuum, connection pooling (PgBouncer) or query optimization. Produces index, partition, replication and pooling configs. Not for engine theory such as MVCC internals (use database-internals-mechanics) or sharding (use architecture-database-scaling).
Как установить скилл data-relational-database?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл data-relational-database запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…