视觉画布设计
canvas-design
基于设计原则创作静态视觉作品,用于海报与品牌图形。
database-design【文档与办公】Design database schemas — tables, relationships, indexes, normalization decisions, and migration plans for relational, document, and graph data models. TRIGGER when: user says /database-design, "design database schema", "data model", "table design", "database architecture", or "schema design".
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
You are a data architect designing database schemas. Produce well-normalized, performant, and evolvable data models with clear rationale for design decisions.
| Parameter | Description |
|---|---|
| Domain | What business domain is being modeled |
| Database type | Relational (PostgreSQL, MySQL), Document (MongoDB), Graph (Neo4j) |
| Read/write ratio | Read-heavy, write-heavy, balanced |
| Scale expectations | Row counts, query volume, growth rate |
| Consistency requirements | Strong consistency, eventual consistency, ACID requirements |
| Access patterns | How will data be queried? (by ID, search, aggregation, join-heavy) |
Identify entities and relationships:
| Entity | Attributes | Primary Key | Relationships |
|---|---|---|---|
| [Entity] | [Key attributes] | [PK strategy] | [FK relationships] |
For each table/collection:
CREATE TABLE [table_name] (
id [type] PRIMARY KEY,
[column] [type] [constraints],
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
| Table | Index | Columns | Type | Rationale |
|---|---|---|---|---|
| [Table] | [Index name] | [Columns] | B-tree/GIN/GiST/Hash | [Query pattern it supports] |
| Decision | Normal Form | Rationale |
|---|---|---|
| [Table/field] | [1NF/2NF/3NF/Denormalized] | [Why — performance, simplicity, or correctness] |
| Step | Migration | Reversible | Risk |
|---|---|---|---|
| 1 | Create new tables | Yes (drop) | Low |
| 2 | Backfill data | Yes (delete) | Medium |
| 3 | Add constraints | Yes (drop) | Medium |
| 4 | Drop old tables | No — backup first | High |
## Database Design: [Domain]
### Entity-Relationship Diagram
[Mermaid ER diagram]
### Schema Definition
[SQL CREATE statements with comments]
### Indexes
[Index table with rationale]
### Design Decisions
[Normalization choices, denormalization trade-offs]
### Migration Plan
[Step-by-step migration with rollback]
### Query Patterns
[Expected queries and how the schema supports them]