sequelize-models

Automate Sequelize model creation and optimization for PostgreSQL schemas.

1|Updated Dec 4, 2025
One-click install
npx skills add https://github.com/francanete/fran-marketplace --skill sequelize-models
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sequelize-models
Source: https://github.com/francanete/fran-marketplace/tree/main/database-expert/skills/sequelize-models
Command: npx skills add https://github.com/francanete/fran-marketplace --skill sequelize-models

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates the creation and optimization of PostgreSQL models using Sequelize, reducing boilerplate and errors in model definitions.

Core Features & Use Cases

  • Model definition patterns for Sequelize with PostgreSQL, including primary keys, data types, field mappings, and sensible defaults.
  • Association patterns (hasMany, belongsToMany, hasOne) with through tables and foreign keys to illustrate one-to-many, many-to-many, and one-to-one relationships.
  • Validations, hooks, scopes, and indexing best practices to ensure data integrity and performant queries.
  • Practical use cases for common domain models (e.g., User, Post, Comment) with guidance on migrations and naming conventions.

Quick Start

Define a Sequelize User model with fields id, email, firstName, lastName, status, and metadata, enable underscored naming, timestamps, and basic validations; then demonstrate a hasMany association to an Order model and a compound index on status and createdAt.

Frequently Asked Questions about sequelize-models

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

FAQPage Schema
How do I define Sequelize models for PostgreSQL with proper associations and validations?

Sequelize models for PostgreSQL require defining DataTypes, field mappings, and validations, then configuring associations like hasMany or belongsToMany with through tables and foreign keys to establish one-to-many and many-to-many relationships.

What are the best practices for Sequelize model options like underscored naming and timestamps?

Sequelize model best practices include enabling underscored naming for column consistency, enabling timestamps for tracking records, applying sensible defaults, and using scopes and hooks to maintain data integrity and automate formatting.

How do I set up many-to-many associations in Sequelize using through tables?

Many-to-many associations in Sequelize use belongsToMany with a through table to map join relationships, specifying foreign keys on both sides to ensure PostgreSQL referential integrity across interconnected domain models.

How do I handle transactions and indexing in Sequelize for PostgreSQL?

Sequelize transaction handling and indexing require defining compound indexes on frequently queried fields and wrapping multi-step operations in transaction blocks to ensure data integrity and performant PostgreSQL queries.

Does Sequelize support soft-delete patterns and custom hooks?

Sequelize supports soft-delete patterns using the paranoid option alongside custom hooks to intercept lifecycle events, enabling logical record deletion while preserving data history within PostgreSQL databases.

What is the best way to manage migrations and naming conventions for Sequelize domain models?

Migrations and naming conventions for Sequelize domain models require consistent field mappings, underscored table names, and structural migration scripts to synchronize PostgreSQL schema changes with model definitions.