schema-design
Skill0 starsChanged 6 months agoApache-2.0View on GitHub
Use when designing or modifying database schemas with migration plans. Covers entity definition, relationship mapping, normalization trade-offs, indexing strategies, and RLS policies. Do not use for API endpoint contracts (use api-design) or codebase analysis (use codebase-context).
- Deletes or force-pushes
3 other projects use a version of this.
Adopted by
Most recently taken up by
- nahid-sparktales/agent-dispatchertheir own version, first seen Sep 21, 2026
- int2t05/engineering-skillstheir own version, first seen Aug 13, 2026
- butterbase-ai/butterbase-skillstheir own version, first seen Jun 10, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- butterbase-ai/butterbase-skills★ 533same name
- nahid-sparktales/agent-dispatcher★ 59same name
- int2t05/engineering-skills★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository65 other files it gives its agents.
- a11y-auditSkill
- i18n-reviewSkill
- interaction-designSkill
- journey-mappingSkill
- ml-workflowSkill
- pipeline-designSkill
- schema-evaluationSkill
- api-designSkill
- codebase-contextSkill
- distributed-patternsSkill
- design-system-architectureSkill
- motion-designSkill
- visual-auditSkill
- adr-templateSkill
- changelog-designSkill
- documentation-planSkill
- crypto-reviewSkill
- pqc-readinessSkill
- protocol-analysisSkill
- e2e-testingSkill
- pattern-analysisSkill
- testing-strategySkill
- finance-close-checklistSkill
- finance-controls-auditSkill
- finance-journal-entriesSkill
- finance-reconciliationSkill
- finance-tax-researchSkill
- finance-variance-analysisSkill
- audit-trail-designSkill
- compliance-reviewSkill
- data-classificationSkill
- growth-engineeringSkill
- messaging-strategySkill
- monetization-designSkill
- cost-analysisSkill
- deployment-planSkill
- finops-analysisSkill
- observability-designSkill
- ai-evaluationSkill
- prompt-engineeringSkill
- rag-architectureSkill
- device-integrationSkill
- navigation-designSkill
- platform-auditSkill
- formal-specSkill
- invariant-analysisSkill
- competitive-analysisSkill
- enterprise-search-strategySkill
- library-evaluationSkill
- technology-radarSkill
- embedded-architectureSkill
- fleet-managementSkill
- protocol-designSkill
- edge-case-enumerationSkill
- failure-mode-analysisSkill
- threat-modelSkill
- analytics-designSkill
- impact-estimationSkill
- mvp-scopingSkill
- caching-strategySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 12 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Does not define API contracts or endpoint shapes — hand off to api-design.
- Distinctive: line 40
No user-provided values are used in commands or file paths.
- Distinctive: line 57
Read current schema files, migration history, or ORM models.
- Distinctive: line 67
Default values and constraints (UNIQUE, CHECK, etc.)
- Distinctive: line 77
Document cascade behavior (ON DELETE CASCADE vs SET NULL vs RESTRICT)
- Distinctive: line 81
Default to 3NF. For each denormalization decision, document:
- Distinctive: line 96
If using Supabase or row-level security:
- Distinctive: line 99
Use auth.uid() for user-scoped access
- Distinctive: line 100
Document any service_role bypass patterns
- Distinctive: line 105
CREATE TABLE statements for new tables
- Distinctive: line 115
If the schema design reveals API contract requirements or endpoint shape changes, recommend loading architect/api-design.
- Distinctive: line 116
If the schema involves sensitive data fields or access control beyond RLS, recommend loading guardian/data-classification.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Schema Design
Purpose
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.
Scope Constraints
- Produces schema definitions and migration SQL only; does not execute migrations.
- Covers entity design, relationships, indexes, RLS policies, and rollback plans.
- Does not define API contracts or endpoint shapes — hand off to api-design.
Inputs
- Feature requirements (from interview/idea phase)
- Existing schema (current tables, relationships, migrations)
- Query patterns (how the data will be read — drives index and denormalization decisions)
- Access control requirements (who can read/write which rows)
Input Sanitization
No user-provided values are used in commands or file paths. All inputs are treated as read-only analysis targets.
Procedure
Progress Checklist
<!-- Track completion across compaction boundaries -->- Step 1: Inventory Existing Entities
- Step 2: Identify New Entities Needed
- Step 3: Define Entity Attributes
- Step 4: Map Relationships
- Step 5: Apply Normalization
- Step 6: Design Indexes
- Step 7: Plan RLS Policies
- Step 8: Draft Migration SQL
Step 1: Inventory Existing Entities
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.
Step 2: Identify New Entities Needed
From the feature requirements and interview output, determine what new data needs to be stored. List candidate entities and their purpose.
Step 3: Define Entity Attributes
For each new entity, define:
- Column name, data type, and nullability
- Default values and constraints (UNIQUE, CHECK, etc.)
- Primary key strategy (UUID vs serial vs composite)
- Timestamp columns (created_at, updated_at)
Step 4: Map Relationships
Define all relationships between entities:
- 1:1 — Foreign key with UNIQUE constraint
- 1:N — Foreign key on the "many" side
- N:M — Junction/through table with composite primary key
- Document cascade behavior (ON DELETE CASCADE vs SET NULL vs RESTRICT)
Step 5: Apply Normalization
Default to 3NF. For each denormalization decision, document:
- What is being denormalized
- Why (query performance, read frequency, join cost)
- How consistency is maintained (triggers, application logic, eventual consistency)
Step 6: Design Indexes
Drive index choices from query patterns:
- Single-column indexes for filtered/sorted columns
- Composite indexes for multi-column WHERE clauses (column order matters)
- Partial indexes for filtered subsets (WHERE active = true)
- GIN indexes for array/JSONB columns if applicable
Step 7: Plan RLS Policies
If using Supabase or row-level security:
- Define SELECT, INSERT, UPDATE, DELETE policies per table
- Map policies to user roles (anon, authenticated, service_role)
- Use auth.uid() for user-scoped access
- Document any service_role bypass patterns
Step 8: Draft Migration SQL
Write executable SQL:
- CREATE TABLE statements for new tables
- ALTER TABLE statements for existing table modifications
- CREATE INDEX statements
- RLS policy statements
- Include a rollback section (DROP TABLE, DROP INDEX, etc.)
Compaction resilience: If context was lost during a long session, re-read the Inputs section to reconstruct what system is being analyzed, check the Progress Checklist for completed steps, then resume from the earliest incomplete step.
Handoff
- If the schema design reveals API contract requirements or endpoint shape changes, recommend loading architect/api-design.
- If the schema involves sensitive data fields or access control beyond RLS, recommend loading guardian/data-classification.
Output Format
# 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 ...Down
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 -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

