agentleFS
NikoxkxNikoxkx/Agent-Skills/skills/data-analytics/database-schema-designer/SKILL.md

database-schema-designer

Skill1 starsChanged 5 months agoApache-2.0View on GitHub

Designs normalized relational database schemas with proper constraints, indexes, and relationships. Use when modeling data for a new application or refactoring an existing schema.

26 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use api-test-suite-builder, feedback-mastery and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Arnav-0Skill

    api-test-suite-builder

    Use when the user asks to generate API tests, create integration test suites, test REST endpoints, or build contract tests.

    Also in 4 projects that use this

  • nbirknerSkill

    feedback-mastery

    Use when preparing to give difficult feedback, approaching a hard conversation with a direct report, peer, or manager, or navigating conflict at work. Also use before performance reviews or when addressing repeated behavior issues. Keywords: give feedback, hard conversation, conflict, performance issue, SBI framework.

    Also in 3 projects that use this

  • jeasonstudioSkill

    agent-md-refactor

    Refactor bloated AGENTS.md, CLAUDE.md, or similar agent instruction files to follow progressive disclosure principles. Splits monolithic files into organized, linked documentation.

    Also in 5 projects that use this

  • Arnav-0Skill

    secrets-vault-manager

    Use when the user asks to set up secret management infrastructure, integrate HashiCorp Vault, configure cloud secret stores (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager), implement secret rotation, or audit secret access patterns.

    Also in 3 projects that use this

  • csiddhant796-blipSkill

    self-eval

    Honestly evaluate AI work quality using a two-axis scoring system. Use after completing a task, code review, or work session to get an unbiased assessment. Detects score inflation, forces devil's advocate reasoning, and persists scores across sessions.

    Also in 3 projects that use this

  • csiddhant796-blipSkill

    threat-detection

    Use when hunting for threats in an environment, analyzing IOCs, or detecting behavioral anomalies in telemetry. Covers hypothesis-driven threat hunting, IOC sweep generation, z-score anomaly detection, and MITRE ATT&CK-mapped signal prioritization.

    Also in 3 projects that use this

  • +1 more from csiddhant796-blip
  • +1 more from Arnav-0

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check constraints for business rules (e.g., price > 0).

    line 51
  2. Distinctive:

    Not null where appropriate.

    line 52
  3. Distinctive:

    Polymorphic associations: Use a join table or separate tables per type instead of a single foreign key + type column when possible.

    line 77

“Common” is measured: kept by at least 6 in 10 of the 17 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Overview

Designs well-normalized relational database schemas (target 3NF with pragmatic denormalization where justified). Covers naming conventions, primary key strategies (UUID vs serial/bigserial), foreign keys with cascade options, index design, soft delete pattern, audit columns, and generation of ER diagrams from SQL.

When to Use This Skill

  • Designing the data model for a new application or feature.
  • Refactoring a messy or performance-problematic schema.
  • The user provides business requirements or an existing schema to improve.

Prerequisites

  • Understanding of the domain and entities/relationships.
  • Chosen database (PostgreSQL strongly recommended for new projects; MySQL/SQLite also supported).
  • Tool for ERD generation (dbdiagram.io, draw.io, or schemaspy / pgadmin).

Steps

  1. Identify entities and relationships:
    • List all nouns that need to be stored.
    • Define relationships (one-to-many, many-to-many, one-to-one).
  2. Normalization:
    • 1NF: atomic values, no repeating groups.
    • 2NF: no partial dependency on composite PK.
    • 3NF: no transitive dependencies.
    • Note when to denormalize (read-heavy reporting tables, materialized views).
  3. Naming & conventions:
    • Tables: plural snake_case (users, order_items).
    • Columns: snake_case, consistent (created_at, updated_at).
    • Primary keys: id (bigserial or uuid).
    • Foreign keys: user_id, order_id.
  4. Keys & constraints:
    • Primary key.
    • Foreign keys with ON DELETE / ON UPDATE (RESTRICT, CASCADE, SET NULL — choose deliberately).
    • Unique constraints.
    • Check constraints for business rules (e.g., price > 0).
    • Not null where appropriate.
  5. Indexes:
    • B-tree on foreign keys (almost always).
    • Composite on common filter + sort combinations.
    • Partial indexes for common subsets.
    • GIN for JSONB, full-text, arrays when needed.
  6. Patterns:
    • Soft delete (deleted_at + is_deleted generated column or partial unique indexes).
    • Audit columns (created_at, updated_at, created_by, updated_by).
    • JSONB for flexible attributes (with GIN index).
  7. Output:
    • Complete CREATE TABLE statements (Postgres syntax, adaptable).
    • Index creation statements.
    • ERD (Mermaid or dbdiagram.io syntax).
    • Migration notes (how to apply without downtime).

Examples

A complete e-commerce schema (users, products, orders, order_items, reviews, inventory) with proper normalization, indexes, soft deletes, audit columns, and a Mermaid ERD is included, plus a denormalized reporting table example with justification.

Edge Cases & Error Handling

  • Polymorphic associations: Use a join table or separate tables per type instead of a single foreign key + type column when possible.
  • High cardinality: Careful with indexes on very high-cardinality columns.
  • Sharding / partitioning: Note when a table will need to be partitioned by date or tenant.

Verification

  1. All CREATE TABLE statements run cleanly on a fresh database.
  2. Foreign key constraints prevent invalid data.
  3. Common queries have efficient plans (EXPLAIN shows index usage).
  4. ERD matches the SQL.
  5. Soft delete and audit columns are present where expected.
  6. Success: Schema is normalized, constraints protect data integrity, and common access patterns are fast.

References

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.