model-data

Guide database schema design, migrations, query optimization, and data validation.

4|1|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/lushly-dev/afd --skill model-data
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-data
Source: https://github.com/lushly-dev/afd/tree/main/.claude/skills/model-data
Command: npx skills add https://github.com/lushly-dev/afd --skill model-data

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the complex process of designing robust database schemas, planning safe migrations, optimizing queries, and implementing effective data validation, ensuring data integrity and performance across various database types.

Core Features & Use Cases

  • Schema Design: Guides relational, document, and graph database schema creation.
  • Migrations & ORMs: Assists with planning and executing database migrations using tools like Prisma, Drizzle, Alembic, and Knex.
  • Query Optimization: Provides strategies for indexing, query tuning, and performance monitoring.
  • Data Validation: Helps set up validation rules using Zod, Pydantic, and database constraints.
  • Use Case: When starting a new project, use this Skill to design a normalized relational schema for user accounts and posts, including appropriate indexes and a migration plan.

Quick Start

Guide me through designing a new PostgreSQL schema for a blog, including tables for users and posts with appropriate indexes and relationships.

Frequently Asked Questions about model-data

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design a database schema for a new project?

Database schema design involves modeling relational, document, or graph structures to ensure data integrity. You can guide the process by defining normalized tables, relationships, and appropriate indexes for your specific database paradigm.

What's the best way to plan a database migration using an ORM?

Planning a database migration with an ORM requires tools like Prisma, Drizzle, Alembic, or Knex to safely alter schemas. You execute versioned migration files to transition structures without losing existing data.

How do I optimize slow SQL queries in a relational database?

SQL query optimization improves database performance through strategic indexing, query tuning, and performance monitoring. You analyze execution plans to add appropriate indexes and rewrite inefficient query patterns.

How do I set up data validation rules in my application?

Data validation is set up using libraries like Zod or Pydantic alongside database constraints to enforce boundary validation. This ensures incoming application data strictly conforms to defined schema types before database insertion.

When should I choose a document database over a relational schema?

Choosing a document database over a relational schema depends on your data modeling needs and database paradigm. Document databases suit flexible, unstructured data, while relational schemas enforce strict normalization for complex relationships.

Can I use CQRS and event sourcing for database modeling?

CQRS and event sourcing are advanced database modeling practices that separate read and write operations into distinct schemas. This approach tracks state changes as a sequence of immutable events for robust data integrity.