database-design
SolidDesign schemas and migrations when persistent data structures change.
AI & Automation 113 stars
26 forks Updated 1 months ago MIT
Install
Quality Score: 83/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
<!-- This is a SCAFFOLD skill -->
# Database Design
## When to Apply
- **Classification**: feature (if new tables/columns), architecture-change (schema redesign), hotfix (data-related bug)
- **Phase**: /plan (schema design), /implement (migration creation), /review (schema review), /test (data integrity)
- **Trigger**: Task involves creating tables, modifying schema, writing migrations, or changing data access patterns
## Conventions
> **Customize after /app-init**: Replace these generic conventions with your project's ADR and ORM-specific patterns.
### Table Design
- Every table MUST have: `id` (primary key), `created_at`, `updated_at`
- Use UUIDs or auto-increment IDs consistently (per ADR decision)
- Soft delete: add `deleted_at` column if ADR specifies soft delete
- Table names: plural, snake_case (e.g., `users`, `order_items`)
- Column names: snake_case (e.g., `first_name`, `is_active`)
### Relationship Patterns
| Relationship | Implementation | Example |
|---|---|---|
| One-to-Many | Foreign key on "many" side | `orders.user_id → users.id` |
| Many-to-Many | Junction table | `user_roles (user_id, role_id)` |
| One-to-One | Foreign key + unique constraint | `user_profiles.user_id (UNIQUE) → users.id` |
| Self-referencing | Foreign key to same table | `categories.parent_id → categories.id` |
### Index Strategy
- Every foreign key column MUST have an index
- Columns used in WHERE clauses frequently → add index
- Composite indexes: put the most selective column firs...
Details
- Author
- KbWen
- Repository
- KbWen/agentic-os
- Created
- 5 months ago
- Last Updated
- 1 months ago
- Language
- Python
- License
- MIT
Related Skills
AI & Automation Featured
code-simplifier
Review RTK Rust code for idiomatic simplification. Detects over-engineering, unnecessary allocations, verbose patterns. Applies Rust idioms without changing behavior.
79,919 Updated today
rtk-ai AI & Automation Featured
design-patterns
Rust design patterns for RTK. Newtype, Builder, RAII, Trait Objects, State Machine. Applied to CLI filter modules. Use when designing new modules or refactoring existing ones.
79,919 Updated today
rtk-ai AI & Automation Featured
issue-triage
Issue triage: audit open issues, categorize, detect duplicates, cross-ref PRs, risk assessment, post comments. Args: "all" for deep analysis of all, issue numbers to focus (e.g. "42 57"), "en"/"fr" for language, no arg = audit only in French.
79,919 Updated today
rtk-ai