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

database-schema-designer

Skill2 starsChanged 6 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.

17 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use skill-judge, agent-md-refactor and 7 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.
  • bamechoSkill

    skill-judge

    Evaluate Agent Skill design quality against official specifications and best practices. Use when reviewing, auditing, or improving SKILL.md files and skill packages. Provides multi-dimensional scoring and actionable improvement suggestions.

    Also in 3 projects that use this

  • softaworksSkill

    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 3 projects that use this

  • JeffallanSkill

    rag-architect

    Designs and implements production-grade RAG systems by chunking documents, generating embeddings, configuring vector stores, building hybrid search pipelines, applying reranking, and evaluating retrieval quality. Use when building RAG systems, vector databases, or knowledge-grounded AI applications requiring semantic search, document retrieval, context augmentation, similarity search, or embedding-based indexing.

    Also in 3 projects that use this

  • alirezarezvaniSkill

    dependency-auditor

    Check dependencies for known vulnerabilities using npm audit, pip-audit, etc. Use when package.json or requirements.txt changes, or before deployments. Alerts on vulnerable dependencies. Triggers on dependency file changes, deployment prep, security mentions.

    Also in 3 projects that use this

  • rogue-dev-studioSkill

    browser-automation

    Canonical browser automation and web UI verification: Playwright, agent browser CLIs, and CDP-based tooling in one playbook.

    Also in 3 projects that use this

  • lookfreeSkill

    excalidraw

    Generate architecture diagrams as .excalidraw files from codebase analysis. Use when the user asks to create architecture diagrams, system diagrams, visualize codebase structure, or generate excalidraw files.

    Also in 3 projects that use this

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 11 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 11 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.