AgentSkillsCN

database_experts

数据库设计与查询优化

SKILL.md
--- frontmatter
name: database_experts
description: DB design & query optimization

Database Experts

Purpose

Standards for schema, query perf, safe migrations.

Core Principles

  1. Model clearly, normalize appropriately
  2. Optimize for common access patterns
  3. Safe migrations w/ backward compatibility

Rules

Schema

  • Consistent naming for tables/columns
  • Explicit PKs & indexes
  • Doc relationships & constraints

Query Optimization

  • Index frequent filters/joins
  • Avoid full table scans in latency-sensitive paths
  • Review query plans for hotspots

Migrations

  • Additive changes first (new cols/tables)
  • Backfill in batches
  • Remove deprecated only after consumers updated

Examples

✅ "Add col, backfill batches, switch reads" ❌ "Drop col immediately w/o coordinating consumers"

Edge Cases

  • Large tables: online migration strategies
  • Multi-tenant: verify isolation & indexing

See COMMON.md.

Refs: PG indexes, EXPLAIN, perf tips (2026-01-26)