一键导入
database-design
Database design principles and decision-making. Schema design, indexing strategy, ORM selection, serverless databases.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Database design principles and decision-making. Schema design, indexing strategy, ORM selection, serverless databases.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Route prediction and forecasting problems to the right method. Covers 7 families: Monte Carlo simulation, statistical forecasting (ARIMA/exponential smoothing), machine learning, Bayesian inference, crowd aggregation, causal inference, and first-principles modeling. Use when you need to predict a future outcome, quantify uncertainty, forecast time-series, update a belief with evidence, infer a cause, or synthesize expert opinions. Combines Monte Carlo Predictor, bootstrap, Bayesian update, and exponential smoothing as callable tools; routes to external methods (ML, markets, causal, physics) when those are the right fit.
Monte Carlo prediction framework for evaluating any project, with a real simulation engine. Use when the user wants to validate decisions, predict outcomes, find optimal paths, detect design divergences, or stress-test a project's direction. Activates on: 'predict', 'Monte Carlo', 'scenario analysis', 'what could go wrong', 'best path', 'validate direction', 'risk analysis', 'forecast', 'project trajectory', 'stress test', 'decision matrix', 'should I migrate', 'compare options'.
Your personal AI operating system — a digital twin that advocates for your interests 24/7. Orchestrates sub-agents, maintains persistent memory, forecasts opportunities, guards against threats, and never gives up on finding answers. Built on OpenClaw. Activates on: 'orchestrator', 'my AI', 'digital twin', 'second brain', 'spin up agent', 'find me', 'watch for', 'optimize my', 'what should I do'.
Universal AI Harness — a meta-framework that wraps any AI model to reduce token waste, ensure spec-driven thinking, maintain persistent memory, and produce calibrated, high-accuracy outputs. Combines BMAD spec-driven methodology, Deep Confidence reasoning, Monte Carlo validation, ReAct execution, and continuous learning. Use for any complex task, decision, or build. Activates on: 'think first', 'harness mode', 'spec-driven', 'BMAD', 'deep reasoning', 'plan before acting', 'structured thinking', 'truth-seeking'.
Deep Confidence Harness — a thinking, planning, and execution framework that forces structured reasoning before acting. Combines Monte Carlo scenario analysis, calibrated confidence, multi-perspective debate, and optimal path planning. Use before any complex decision, build, or task. Activates on: 'deep confidence', 'think before you act', 'plan first', 'Atlas mode', 'reason through this', 'what should I do', 'think this through', 'best approach', 'reason carefully', 'plan and execute'.
OpenClaw personal AI assistant configuration for life organization and income generation. Use when setting up, configuring, or instructing an OpenClaw agent named Henry to manage daily life, finances, tasks, calendar, and money-making activities. Activates on: 'Henry', 'OpenClaw Henry', 'my AI assistant', 'organize my life', 'make money with AI', 'set up Henry', 'Henry config'.
| name | database-design |
| description | Database design principles and decision-making. Schema design, indexing strategy, ORM selection, serverless databases. |
| allowed-tools | Read, Write, Edit, Glob, Grep |
Learn to THINK, not copy SQL patterns.
Read ONLY files relevant to the request! Check the content map, find what you need.
| File | Description | When to Read |
|---|---|---|
database-selection.md | PostgreSQL vs Neon vs Turso vs SQLite | Choosing database |
orm-selection.md | Drizzle vs Prisma vs Kysely | Choosing ORM |
schema-design.md | Normalization, PKs, relationships | Designing schema |
indexing.md | Index types, composite indexes | Performance tuning |
optimization.md | N+1, EXPLAIN ANALYZE | Query optimization |
migrations.md | Safe migrations, serverless DBs | Schema changes |
Default to B-Tree. Know when to switch.
| Index Type | Use Case | Example |
|---|---|---|
| B-Tree | Equality (=), Range (<, >), Sorting (ORDER BY) | WHERE age > 21 |
| Hash | Exact equality ONLY (Faster than B-Tree, but limited) | WHERE uuid = '...' |
| GIN | JSONB, Full Text Search, Arrays | WHERE data @> '{"tag": "urgent"}' |
| GiST | Geo-spatial, Nearest Neighbor | WHERE location <@ box |
Composite Index Rule: Order matters! (last_name, first_name) helps WHERE last_name='Bond', but DOES NOT help WHERE first_name='James'. (Leftmost Prefix Rule)
| Strategy | What is it? | Complexity | When to use? |
|---|---|---|---|
| Partitioning | Splitting one table into chunks on the SAME server. | Medium | Table > 100GB. Need to delete old data fast (DROP PARTITION). |
| Sharding | Splitting data across DIFFERENT servers. | Extreme | Write QPS > Single Node limit. Massive scale (Petabytes). |
Serverless Apps + Postgres = Disaster. Lambda scales to 1,000 instances -> 1,000 DB connections -> DB Crashes.
Solution: Use PgBouncer (or AWS RDS Proxy / Supabase Pooler).
Before designing schema:
❌ Default to PostgreSQL for simple apps (SQLite may suffice) ❌ Skip indexing ❌ Use SELECT * in production ❌ Store JSON when structured data is better ❌ Ignore N+1 queries