npx claudepluginhub levifig/loaf --plugin loafWant just this skill?
Then install: npx claudepluginhub u/[userId]/[slug]
Covers schema design, migrations, query optimization, indexing strategies, and normalization tradeoffs.
This skill is limited to using the following tools:
references/indexing.mdreferences/migrations.mdreferences/query-optimization.mdreferences/schema-design.mdDatabase Skill
Domain knowledge for database administration and development. Covers schema design, migrations, query optimization, and indexing strategies.
When to Use This Skill
- Designing new tables or modifying existing schemas
- Writing or reviewing database migrations
- Optimizing slow queries
- Planning index strategies
- Evaluating normalization vs denormalization tradeoffs
Key Reference Files
| File | Use When |
|---|---|
| schema-design.md | Creating tables, choosing keys, audit patterns |
| migrations.md | Writing safe, reversible migrations |
| query-optimization.md | Debugging slow queries, N+1 detection |
| indexing.md | Choosing index types, composite index order |
Quick Reference
Primary Key Selection
| Type | Use When | Avoid When |
|---|---|---|
| UUID v4 | Distributed systems, no sequential exposure | Need sortability, space-constrained |
| ULID | Need sortability + uniqueness | Legacy system compatibility |
| Serial/Identity | Single database, simple use case | Distributed writes, ID exposure concerns |
Migration Safety
Safe (online): ADD COLUMN (nullable), ADD INDEX CONCURRENTLY, CREATE TABLE
Unsafe (offline): ADD COLUMN NOT NULL (without default), DROP COLUMN, RENAME
Index Decision Tree
High cardinality + equality lookups → B-tree (default)
Low cardinality + many values → Consider partial index
Array/JSON containment → GIN
Geometric/range queries → GiST
Exact equality only → Hash (rare)
Core Principles
- Data integrity first - Constraints catch bugs that code misses
- Plan for scale - Design decisions are expensive to change
- Measure before optimizing - Use EXPLAIN ANALYZE, not intuition
- Backward compatibility - Migrations must not break running code
Related Skills
- See
foundationsfor universal code quality principles - See
infrastructurefor connection pooling and deployment patterns
Similar Skills
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.