All skills
softaworks avatar

/database-schema-designer

@1c0662a
by softaworkssoftaworks/agent-toolkit2.5k stars
230

Design robust, scalable database schemas for SQL and NoSQL databases. Provides normalization guidelines, indexing strategies, migration patterns, constraint design, and performance optimization. Ensures data integrity, query performance, and maintainable data models.

Use this Skill: https://skilld.dev/gh/softaworks/agent-toolkit/database-schema-designer

This session only. Nothing lands on disk.

referencesschema-design-checklist.md

≈846 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Database Schema Design Checklist

Complete checklist for designing and reviewing database schemas.


Pre-Design

  • Requirements Gathered: Understand data entities and relationships
  • Access Patterns Identified: Know how data will be queried
  • SQL vs NoSQL Decision: Chosen appropriate database type
  • Scale Estimate: Expected data volume and growth rate
  • Read/Write Ratio: Understand if read-heavy or write-heavy

Normalization (SQL)

  • 1NF: Atomic values, no repeating groups
  • 2NF: No partial dependencies on composite keys
  • 3NF: No transitive dependencies
  • Denormalization Justified: If denormalized, reason documented

Table Design

Primary Keys

  • Primary Key Defined: Every table has primary key
  • Key Type Chosen: INT auto-increment or UUID
  • Meaningful Keys Avoided: Not using email/username as PK

Data Types

  • Appropriate Types: Correct data types for each column
  • String Sizes: VARCHAR sized appropriately
  • Numeric Precision: DECIMAL for money, INT for counts
  • Dates in UTC: TIMESTAMP for datetime columns

Constraints

  • NOT NULL: Required columns marked NOT NULL
  • Unique Constraints: Unique columns (email, username)
  • Check Constraints: Validation rules (price >= 0)
  • Default Values: Sensible defaults where appropriate

Relationships

Foreign Keys

  • Foreign Keys Defined: All relationships have FK constraints
  • ON DELETE Strategy: CASCADE, RESTRICT, SET NULL chosen
  • ON UPDATE Strategy: Usually CASCADE
  • Indexes on Foreign Keys: All FKs are indexed

Relationship Types

  • One-to-Many: Modeled correctly
  • Many-to-Many: Junction table created
  • Self-Referencing: Parent-child relationships handled
  • Polymorphic: Strategy chosen (separate FKs or type+id)

Indexing

Index Strategy

  • Primary Key Indexed: Automatic, verify
  • Foreign Keys Indexed: All FKs have indexes
  • WHERE Columns: Columns in WHERE clauses indexed
  • ORDER BY Columns: Sort columns indexed
  • Composite Indexes: Multi-column queries optimized
  • Column Order: Most selective column first

Index Limits

  • Not Over-Indexed: Only necessary indexes
  • Index Maintenance: Aware of write impact

Performance

  • Joins Optimized: N+1 queries avoided
  • SELECT * Avoided: Only fetch needed columns
  • Pagination: LIMIT/OFFSET or cursor-based
  • Aggregations: Pre-calculated for expensive queries

Migrations

  • Backward Compatible: New columns nullable initially
  • Up and Down: Rollback scripts provided
  • Data Migrations Separate: Schema vs data separated
  • Tested on Staging: Migrations tested

Security

  • Least Privilege: Minimal database permissions
  • Separate Accounts: Read-only vs read-write
  • Sensitive Data: Passwords hashed, PII encrypted
  • Parameterized Queries: SQL injection prevented

Documentation

  • ERD Created: Entity-relationship diagram
  • Schema Documented: Column descriptions
  • Indexes Documented: Why each index exists
  • Migration History: Changelog of changes

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The Database Schema Designer skill is a purely instructional resource that provides best practices, guidelines, and templates for database modeling. It contains no executable code, scripts, or external dependencies, and poses no identified security risks.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    4 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 1c0662a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 9 months ago
  • database-design
  • schema
  • sql
  • normalization
  • indexing
  • migrations
  • postgresql
  • mysql
  • data-modeling
  • constraints

README badge

README badge for softaworks/agent-toolkit/database-schema-designer

Generates SQL and NoSQL database schemas from data requirements, including normalization rules, indexing strategies, constraint design, and migration patterns. Covers domain modeling, access pattern analysis, and performance optimization for OLTP and OLAP workloads.

Generated from the current SKILL.md.

Does this skill work with both SQL and NoSQL databases?
Yes. The skill supports both SQL (with normalization to 3NF) and NoSQL (with embed/reference strategies). You specify your database preference, or it defaults to SQL if not stated.
What if I need to modify an existing schema?
The skill provides commands like `normalize {table}`, `add indexes for {table}`, and `migration for {change}` to evolve existing schemas with reversible migrations.
Does this cover performance optimization?
Yes. The skill includes indexing strategies, denormalization guidance for read-heavy workloads, and optimization for different access patterns (OLTP vs OLAP).
Will the generated migrations be backward compatible?
The skill emphasizes reversible, backward-compatible migrations with both UP and DOWN scripts. It also covers zero-downtime deployment patterns.
What data types and constraints does this cover?
The skill includes guidance on string types, numeric types (with explicit DECIMAL for money), date/time handling, and constraint design (PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK, NOT NULL).

Generated from the current SKILL.md. These answers refresh after source changes.