database-architect
БесплатноЗапускает вложенные скриптыНе проверенDatabase design and optimization specialist. Schema design, query optimization, indexing strategies, data modeling, and migration planning for relational and…
от oimiragieo★ 48 звёзд на GitHubОб этом скилле
Database Architect Skill
Step 1: Understand Data Requirements
Gather requirements:
- Entities: What data needs to be stored?
- Relationships: How do entities relate (1:1, 1:N, N:M)?
- Access Patterns: How will data be queried?
- Volume: Expected data size and growth rate
- Consistency: ACID requirements vs eventual consistency
Step 2: Design Schema
For Relational Databases:
- Normalize: Start with 3NF to reduce redundancy
- Define Primary Keys: Use surrogate keys (UUID/SERIAL) or natural keys
- Define Foreign Keys: Establish referential integrity
- Consider Denormalization: Only for proven performance needs
For NoSQL Databases:
- Model for Queries: Design documents/collections around access patterns
- Embed vs Reference: Embed for 1:1/1:few, reference for 1:many
- Shard Key Selection: Choose keys that distribute evenly
Step 3: Plan Indexes
Index strategy based on query patterns:
-- Example: Users table with common queries
CREATE INDEX idx_users_email ON users(email); -- Exact match
CREATE INDEX idx_users_name ON users(last_name, first_name); -- Range/sort
CREATE INDEX idx_users_created ON users(created_at DESC); -- Ordering
Index Guidelines:
- Index columns used in WHERE, JOIN, ORDER BY
- Consider composite indexes for multi-column queries
- Avoid over-indexing (slows writes)
- Use covering indexes for read-heavy queries
Step 4: Plan Migrations
Create versioned migrations:
migrations/
001_create_users.sql
002_add_email_index.sql
003_create_orders.sql
Migration Best Practices:
- Always include up and down migrations
- Test migrations on production-like data
- Plan for zero-downtime migrations
- Backup before running migrations
Step 5: Optimize Queries
Analyze and improve slow queries:
- Use EXPLAIN ANALYZE: Understand execution plans
- Identify Table Scans: Replace with index scans
- Optimize JOINs: Ensure indexes on join columns
- Batch Operations: Use bulk inserts/updates
- Connection Pooling: Reduce connection overhead
Step 6: PostgreSQL 17 Features (2024–2026)
Leverage PostgreSQL 17 capabilities where applicable:
Performance improvements:
- New
VACUUMmemory management — up to 20x lower memory footprint; vacuum now runs faster on busy systems - Streaming I/O interface accelerates sequential scans on large datasets
BRINindexes support parallel builds- B-tree indexes are more efficient for
INclause queries - Optimized CTE (Common Table Expression) planning
SQL/JSON enhancements (PG 17):
JSON_TABLE()— converts JSON data into relational table representation- JSON constructors and identity functions (
JSON(),JSON_SCALAR(),JSON_ARRAY(),JSON_OBJECT()) - Use
jsonpathfor expressive path-based queries over JSONB columns
Incremental backups:
pg_basebackupsupports incremental backup; combine withpg_upgradefor zero-data-loss major version upgrades
Logical replication improvements:
- Failover control for logical replication slots
pg_createsubscribercreates logical replicas from physical standbyspg_upgradenow preserves logical replication slots across major version upgrades
Security:
- New
MAINTAINprivilege — grants targeted maintenance rights without full superuser access sslnegotiation=directclient option for direct TLS handshake (avoids round-trip)
COPY improvements:
COPY ... ON_ERROR ignore— continues import on row-level errors instead of aborting
Step 7: pgvector for AI Embeddings
Store and query vector embeddings alongside relational data to avoid a separate vector database:
-- Install extension
CREATE EXTENSION IF NOT EXISTS vector;
-- Table with embedding column (1536 dims for OpenAI text-embedding-3-small)
CREATE TABLE documents (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
content TEXT NOT NULL,
embedding vector(1536),
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- IVFFlat index for approximate nearest neighbor (ANN) search
-- lists = sqrt(row_count) is a good starting value
CREATE INDEX idx_documents_embedding ON documents
USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
-- HNSW index (faster queries, more memory; preferred for < 1M vectors)
CREATE INDEX idx_documents_embedding_hnsw ON documents
USING hnsw (embedding vector_cosine_ops) WITH (m = 1
Установить database-architect в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBashGlobGrepВложенные файлы
FAQ
Что делает скилл database-architect?
Database design and optimization specialist. Schema design, query optimization, indexing strategies, data modeling, and migration planning for relational and NoSQL databases.
Как установить скилл database-architect?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл database-architect запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create 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…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic