home / skills / bankkroll / skills-builder / sequelize

sequelize skill

/skills/sequelize

This skill provides Sequelize documentation guidance on advanced associations, eager loading, transactions, and core concepts to help answer complex questions.

npx playbooks add skill bankkroll/skills-builder --skill sequelize

Review the files below or copy the command above to add this skill to your agents.

Files (14)
SKILL.md
3.8 KB
---
name: "sequelize"
description: "Scraped from https://sequelize.org/docs/v6/ Source: https://sequelize.org/docs/v6/. Use when questions involve: advanced association concepts, category, core concepts, moved, other topics."
---

# Sequelize

> Official documentation: https://sequelize.org/docs/v6/

## Overview

This skill provides comprehensive documentation for sequelize.

**Total references:** 13 files (~63,274 tokens)

**Topics covered:**
Ordering eager loaded associations, Creating an instance, Eager loading with Many-to-Many relationships, Managed transactions, Limits and Pagination, Creating the standard relationships, findOne, Defining a model as paranoid, Enforcing a foreign key reference without constraints, findAll, New databases versus existing databases, Installation...

## Reference Files

Load only the reference files relevant to the user's question:

### Advanced Association Concepts

- **[Advanced M:N Associations and more](references/advanced-association-concepts-1.md)** (~4,743 tokens)
  - Topics: Through tables versus normal tables and the Super Many-to-Many association, Aliases and custom key names, Self-references
- **[Eager Loading and more](references/advanced-association-concepts-2.md)** (~6,191 tokens)
  - Topics: Basic example, Multiple eager loading, Eager loading with Many-to-Many relationships

### Category

- **[Advanced Association Concepts and more](references/category.md)** (~1,267 tokens)

### Core Concepts

- **[Associations and more](references/core-concepts-1.md)** (~7,504 tokens)
  - Topics: Defining the Sequelize associations, Creating the standard relationships, One-To-One relationships
- **[Model Basics and more](references/core-concepts-2.md)** (~4,355 tokens)
  - Topics: Concept, Model Definition, Table name inference
- **[Model Querying and more](references/core-concepts-3.md)** (~6,453 tokens)
  - Topics: Simple INSERT queries, Simple SELECT queries, Specifying attributes for SELECT queries
- **[Validations & Constraints](references/core-concepts-4.md)** (~2,060 tokens)
  - Topics: Difference between Validations and Constraints, Unique Constraint, Allowingdisallowing null values

### General

- **[Getting Started and more](references/general.md)** (~1,229 tokens)
  - Topics: Installing, Connecting to a database, Terminology convention

### Moved

- **[Associations and more](references/moved.md)** (~722 tokens)
  - Topics: Deprecatedsequelizeimport

### Other Topics

- **[Using sequelize in AWS Lambda and more](references/other-topics-1.md)** (~7,300 tokens)
  - Topics: TLDR, The Nodejs event loop, AWS Lambda function handler types in Nodejs
- **[Extending Data Types and more](references/other-topics-2.md)** (~7,991 tokens)
  - Topics: Example, PostgreSQL, Available hooks
- **[Naming Strategies and more](references/other-topics-3.md)** (~6,810 tokens)
  - Topics: Theunderscoredoption, Singular vs Plural, Ranges PostgreSQL only
- **[Transactions and more](references/other-topics-4.md)** (~6,649 tokens)
  - Topics: Unmanaged transactions, Managed transactions, ConcurrentPartial transactions

## Usage Guidelines

1. **Identify relevant sections** - Match the user's question to the appropriate reference file(s)
2. **Load minimally** - Only read files directly relevant to the question to conserve context
3. **Cite sources** - Reference specific sections when answering
4. **Combine knowledge** - For complex questions, you may need multiple reference files

### When to use each reference:

- **Advanced Association Concepts**: Advanced Association Concepts-related features and documentation
- **Category**: Category-related features and documentation
- **Core Concepts**: Core Concepts-related features and documentation
- **General**: General documentation, overview, and getting started
- **Moved**: Moved-related features and documentation
- **Other Topics**: Other Topics-related features and documentation

Overview

This skill provides concise, actionable documentation and examples from Sequelize v6. It helps developers find authoritative guidance on associations, model definitions, querying, transactions, and less common topics like paranoid models and custom naming strategies. Use it to quickly locate patterns, options, and best practices from the official docs.

How this skill works

The skill inspects the official Sequelize v6 documentation and surfaces relevant sections for a given question. It maps user queries to focused reference areas (advanced associations, core concepts, transactions, etc.) and returns distilled explanations, examples, and recommended options. It favors minimal, practical guidance and points to the appropriate doc topics for deeper reading.

When to use it

  • You need concrete examples for One-To-One, One-To-Many, or Many-To-Many associations.
  • You want correct usage patterns for eager loading, aliases, or through tables.
  • You’re designing models and need guidance on paranoid, underscored, or custom table names.
  • You must implement managed or unmanaged transactions with Sequelize.
  • You need querying examples: findOne, findAll, attribute selection, limits, and pagination.
  • You want platform-specific tips (e.g., PostgreSQL ranges, AWS Lambda usage) and edge-case patterns.

Best practices

  • Define associations explicitly in models and keep association setup centralized for clarity.
  • Use aliases and scoped includes when loading multiple relationships to avoid naming collisions.
  • Prefer managed transactions for simple flows and unmanaged transactions for advanced control.
  • Use paranoid models only when soft-deletes are required; index frequently queried columns for performance.
  • Apply constraints and foreign keys where the database should enforce integrity; use validations for application-level checks.

Example use cases

  • Implementing a Many-To-Many relationship with a through table that stores extra attributes.
  • Eager loading nested associations with includes and custom aliases to fetch related data in one query.
  • Switching an existing table to paranoid mode to preserve deleted rows without changing application logic.
  • Handling transactions across several model updates with a managed transaction pattern.
  • Customizing naming strategy (underscored, singular/plural) to match an existing database schema.

FAQ

When should I use a through table versus a normal join table?

Use a through table when you need to store attributes on the relationship or model the join as a first-class entity. For simple M:N without extra fields, a plain join table is sufficient.

How do I avoid attribute name collisions when eager loading multiple associations?

Use aliases (as) when defining associations and reference the same alias in include clauses. This keeps include outputs distinct and predictable.

Should I rely on Sequelize validations or database constraints?

Use validations for application-level checks and user feedback. Enforce critical integrity with database constraints so the database remains consistent even outside the app.