一键导入
schema-design
Migration-ready database schema design with normalization and indexing strategies
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Migration-ready database schema design with normalization and indexing strategies
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Local git operations for syncing, branching, merging, and conflict resolution
GitHub interactions for issues, PRs, releases, and repository management
Use this skill when performing hardware security analysis for System-on-Chip components — threat modeling, verification scaffolding, compliance mapping, executive briefing, microarchitectural attack analysis, physical side-channel assessment, kernel security analysis, emerging hardware security, or TLA+ formal specification. Routes to the appropriate specialist. Trigger phrases include "threat model my SoC", "run STRIDE analysis", "generate SVA assertions", "compliance check against FIPS", "executive summary of findings", "Spectre analysis for cache", "DPA attack assessment", "kernel hardening review", "PQC hardware review", "TLA+ spec for access control". Do NOT use for software-only security, network security, or web application security.
Use when working with Terraform or OpenTofu - creating modules, writing tests (native test framework, Terratest), setting up CI/CD pipelines, reviewing configurations, choosing between testing approaches, debugging state issues, implementing security scanning (trivy, checkov), or making infrastructure-as-code architecture decisions
Security audit checklist for web applications. Use when reviewing, auditing, or hardening a web app's security posture. Covers rate limiting, auth headers, IP blocking, CORS, security middleware, input validation, file upload limits, ORM usage, and password hashing. Triggers on requests like "review security", "harden this app", "security audit", "check for vulnerabilities", or when building/reviewing API endpoints.
Use this skill when connecting AI or LLMs to data platforms. Covers MCP servers for warehouses, natural-language-to-SQL, embeddings for data discovery, LLM-powered enrichment, and AI agent data access patterns. Common phrases: "text-to-SQL", "MCP server for Snowflake", "LLM data enrichment", "AI agent access". Do NOT use for general data integration (use data-integration) or dbt modeling (use dbt-transforms).
| name | Schema Design |
| department | architect |
| description | Migration-ready database schema design with normalization and indexing strategies |
| version | 1 |
| triggers | ["database","schema","data model","table","migration","entity","relationship","foreign key","index","normalization"] |
Design relational database schemas with normalization trade-offs, migration plans, and indexing strategies. Produces migration-ready SQL that can be applied directly to the database.
Read current schema files, migration history, or ORM models. List all existing tables with their columns, types, constraints, and relationships. Note any existing indexes and RLS policies.
From the feature requirements and interview output, determine what new data needs to be stored. List candidate entities and their purpose.
For each new entity, define:
Define all relationships between entities:
Default to 3NF. For each denormalization decision, document:
Drive index choices from query patterns:
If using Supabase or row-level security:
Write executable SQL:
# Schema Design: [Feature Name]
## Entity Overview
| Entity | Purpose | New/Modified |
|--------|---------|-------------|
| ... | ... | ... |
## Entity Definitions
### [entity_name]
| Column | Type | Nullable | Default | Constraints |
|--------|------|----------|---------|-------------|
| id | uuid | NO | gen_random_uuid() | PK |
| ... | ... | ... | ... | ... |
## Relationships
[ASCII diagram] users 1──N posts posts N──M tags (through: post_tags)
## Index Strategy
| Table | Index | Columns | Type | Rationale |
|-------|-------|---------|------|-----------|
| ... | ... | ... | ... | ... |
## Denormalization Decisions
| What | Why | Consistency Strategy |
|------|-----|---------------------|
| ... | ... | ... |
## RLS Policies
| Table | Operation | Policy | Using |
|-------|-----------|--------|-------|
| ... | ... | ... | ... |
## Migration SQL
### Up
```sql
-- New tables
CREATE TABLE ...
-- Indexes
CREATE INDEX ...
-- RLS
ALTER TABLE ... ENABLE ROW LEVEL SECURITY;
CREATE POLICY ...
DROP POLICY ...
DROP INDEX ...
DROP TABLE ...
## Quality Checks
- [ ] Every entity has a primary key
- [ ] Foreign keys reference existing or newly created tables
- [ ] Indexes support the identified query patterns
- [ ] Migration is reversible (Down section undoes Up completely)
- [ ] RLS policies cover all access patterns (SELECT, INSERT, UPDATE, DELETE)
- [ ] Timestamp columns (created_at, updated_at) are present on mutable entities
- [ ] CASCADE behavior is explicitly defined for all foreign keys
- [ ] No orphan tables (every table is reachable via relationships or has a documented reason for isolation)
## Evolution Notes
<!-- Observations appended after each use -->