database
SQL, schemas, migrations, ORMs, query optimization, indexing, transactions, EXPLAIN, PostgreSQL, MySQL, SQLite, DynamoDB, or Redis.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
SQL, schemas, migrations, ORMs, query optimization, indexing, transactions, EXPLAIN, PostgreSQL, MySQL, SQLite, DynamoDB, or Redis.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | database |
| description | SQL, schemas, migrations, ORMs, query optimization, indexing, transactions, EXPLAIN, PostgreSQL, MySQL, SQLite, DynamoDB, or Redis. |
Language-agnostic guidance for schema design, migrations, ORM use, and query optimization.
Default to simplicity. Optimize only when you have measured evidence of a problem.
"If I remove this optimization, what specific query slows down and by how much?"
If the answer is vague ("might be slow", "best practices", "scales better"), the optimization may be theater.
| Anti-Pattern | Example | Problem |
|---|---|---|
| Premature indexing | "Index every foreign key" | Slows writes, may never be queried |
| Over-normalization | "6NF for theoretical purity" | Joins slow down reads, rarely updated |
| Premature sharding | "Shard for future scale" | Adds complexity before you have data |
| Caching everything | "Redis for all queries" | Before measuring if queries are slow |
| CQRS theater | "Separate read/write DBs" | For a CRUD app with 100 users |
RESTRICT is the safe default; use CASCADE only for dependent data and SET NULL only for optional relationships.| Store | Choose when | Avoid when |
|---|---|---|
| Relational | Relationships, consistency, or multi-record transactions matter | A simple key lookup is the only access pattern |
| Document | Records have flexible, independently retrieved attributes | Cross-document relationships or transactions dominate |
| Key-value | Caching, sessions, rate limits, or direct key lookup dominate | Queries need joins, filtering, or multiple access paths |
| Graph | Traversals and relationship queries are the primary workload | Relationships are shallow and relational queries are sufficient |
updated_at.| Pitfall | Problem | Fix |
|---|---|---|
| N+1 queries | One query per item | Eager loading or batch queries |
| Missing indexes | Slow queries | Inspect EXPLAIN; index measured WHERE, JOIN, and ordering paths |
| No transaction boundaries | Inconsistent data | Wrap related writes in a transaction |
| Unbounded queries | Memory exhaustion | Limit and paginate |
| Wrong cascade rules | Data loss or orphans | Choose CASCADE, RESTRICT, or SET NULL deliberately |
| Plain text passwords | Security breach | Store password hashes |
| Type mismatches | Incorrect comparison or storage | Use appropriate numeric, temporal, and identifier types |
| No query timeouts | Locks and cascading failures | Set production statement timeouts |
Pi extensions and tool policy: extensions/*.ts, hooks, registerTool, promptGuidelines, registerCommand, footer/status UI, tool_result, session hooks, or subprocesses. Not for slash-command placement; use pi-command.
README, CHANGELOG, docs/, RFCs, ADRs, guides, or Markdown structure. Not for prose cleanup or archival work.
Prose cleanup for filler, hype, vague claims, repetition, detection tells, or uncited specifics. Not for Markdown architecture or archival work.
Requirements, user stories, acceptance/verification criteria, or testable outcomes. Not for PRD drafting (/prd) or Pi /goal prompts.
Use for /prd-it or to draft, refine, or review a Product Requirements Document. Not for acceptance criteria, planning, or Pi /goal prompts.
Pi session, trace, metrics, routing, workflow-friction, workflow-telemetry, usage, or local JSONL analysis with DuckDB. Use for aggregating or correlating Pi runtime logs. Not for adding telemetry, generic SQL/database design, or non-Pi logs.