本文へ移動
cccskills
無料GitHub で公開

database

Schema design, migrations y data operations para Postgres + Prisma/GORM. Setup, indexing, queries, seeds, backups.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcaneスター 3(GitHub 3 + cccskills 0)
連携ツールPostgreSQL

実行スコア 未検証

インストール方法を見る

含まれるファイル(3)

  • SKILL.md4.2 KB
  • references/anti-patterns.md1.4 KB
  • references/query-patterns.md1.6 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

database — Schema, Migrations & Data Operations

Route

Intención del usuarioModoSecciones relevantes
"diseñar schema", "nueva tabla", "relación", "índice"SCHEMA→ 2. Schema Design, 3. Migrations
"query lenta", "EXPLAIN", "N+1", "optimizar"QUERY→ 5. Query Patterns
"migration", "ALTER TABLE", "expand-contract", "rollback"MIGRATION→ 3. Migrations
"sin datos", "seed", "fixtures", "datos demo"SEED→ 7. Seed Data
"conexiones", "pool", "timeout", "PgBouncer"CONNECTIONS→ 4. Connection Management
"backup", "restore", "recovery", "PITR"OPS→ 8. Backup & Recovery

Regla: si el argumento es full, ejecutar Checklist completo. Si la intención es ambigua, preguntar.


Stack: Fastify + Prisma + PostgreSQL + Zod + TypeScript

1. ORM Choice

Default Prisma (type-safe, declarative schema, built-in migrations). Consider Drizzle for SQL-like type-safe syntax, node-pg-migrate + pg for raw SQL control, golang-migrate for Go codebases. Never mix migration tools in one repo.

2. Schema Design

Naming: snake_case tables/columns, PascalCase Prisma models, singular names.

CriteriaRule
PKsUUID or CUID; avoid auto-increment if distributed
FKsAlways explicit, always indexed on child side
Timestampscreated_at + updated_at on every table
Soft deletedeleted_at NULL + partial index on non-nulls
EnumsPrisma enum for fixed sets; string if values change often
RelationsExplicit join tables for M:N; no circular FK deps
CompositesEquality first, range second, ORDER BY last
NullabilityNOT NULL by default; nullable only for meaningful absence

Index types: B-tree (95% — equality/range/sort), GIN (arrays/jsonb/tsvector), GiST (geo/ranges), BRIN (huge ordered tables). Use partial indexes to reduce size, covering indexes (INCLUDE) to avoid heap access, expression indexes when WHERE has functions.

3. Migrations

Forward-only default. .down.sql for reversible DDL; document one-way explicitly. Name: YYYYMMDDHHMMSS_verb_desc. Never edit merged migrations.

Rules: One change per migration. DDL and data backfills always separate (mixing = long locks). Set lock_timeout + statement_timeout on ALTER TABLE. CREATE INDEX CONCURRENTLY on live tables (outside transaction). ADD COLUMN with non-volatile DEFAULT instant on PG 11+. Adding NOT NULL: CHECK NOT VALID then VALIDATE in separate migration.

Zero-downtime expand-contract: Expand (nullable col/new table/concurrent idx, release N) -> Backfill (async idempotent batched ~10k, N) -> Dual-write (N+1) -> Migrate reads (N+2) -> Contract DROP (N+3, after 1+ stable release). CI: up -> down -> up must pass.

4. Connection Management

Pool size: max(2, cores*2) per instance, never exceed total max_connections. Connection timeout 5s, statement timeout 30s. Health check via SELECT 1 in health endpoint. PgBouncer transaction-mode for serverless/high-connection loads.

5. Query Patterns, Seed Data & Backup

→ Read references/query-patterns.md for: N+1 fixes, pagination, bulk ops, seed strategies, backup/recovery.

Anti-patterns

→ Read references/anti-patterns.md for the full 16-item checklist.

Checklist

  • Docker Compose + .env.example with DATABASE_URL
  • One change per migration, DDL/data separated, expand-contract for breaking changes
  • lock_timeout + statement_timeout on ALTER; CONCURRENTLY for prod indexes
  • CI: up -> down -> up passes
  • FK children indexed; composite order: equality -> range -> ORDER BY
  • EXPLAIN ANALYZE before/after query changes; N+1 eliminated; cursor pagination
  • Seeds idempotent, prod-guarded, no real PII, reference data separated
  • Backup restores tested; RTO/RPO documented

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Plan, design, and implement A/B tests and experiments with statistical rigor. Covers hypothesis frameworks, sample sizing, metrics, and result analysis.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月27日 更新

Web/mobile accessibility decision guide: WCAG 2.2 AA, ARIA, keyboard nav, focus management, contrast, testing. Use for: a11y, accessibility, wcag, aria, screen reader, keyboard, contrast.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月27日 更新

Generate, iterate, and scale ad creative for paid advertising across Google, Meta, LinkedIn, and X. Covers platform specs, creative frameworks, and quality validation.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月27日 更新

Musica interactiva para juegos: layering vertical, re-secuenciacion horizontal, stingers, reglas de transicion con sync points, y mapeo de estados de gameplay a musica. Usar para: musica adaptativa, sistema de musica dinamica, transiciones musicales, combat music.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月27日 更新

Design multi-agent systems, create agent architectures, define communication patterns, and build autonomous agent workflows with structured evaluation frameworks.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月27日 更新

Inter-agent communication protocol for C-suite agent teams. Defines invocation syntax, loop prevention, isolation rules, response formats, and quality loops.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月27日 更新

SebastianLuser のスキルをすべて見る

このスキルの問題を報告する