ai-infrastructure-hugg…
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming,…
Sequelize ORM, model definitions, associations, queries, transactions, migrations
Claude Code
$ npx -y skills add agents-inc/skills --skill api-database-sequelize --agent claude-code
Codex
$ npx skills add agents-inc/skills --skill api-database-sequelize -a codex -y
Cursor
$ npx skills add agents-inc/skills --skill api-database-sequelize -a cursor -y
Gemini CLI
$ npx skills add agents-inc/skills --skill api-database-sequelize -a gemini-cli -y
GitHub Copilot
$ npx skills add agents-inc/skills --skill api-database-sequelize -a github-copilot -y
OpenCode
$ npx skills add agents-inc/skills --skill api-database-sequelize -a opencode -y
Windsurf
$ npx skills add agents-inc/skills --skill api-database-sequelize -a windsurf -y
name: api-database-sequelize description: Sequelize ORM, model definitions, associations, queries, transactions, migrations
> **Quick Guide:** Sequelize is a promise-based ORM for PostgreSQL, MySQL, MariaDB, SQLite, and MS SQL Server. Use class-based models with `Model.init()` (v6) or decorators (v7) for type-safe definitions. Always use `InferAttributes`/`InferCreationAttributes` with `declare` for TypeScript models. Use `include` for eager loading to avoid N+1. Prefer managed transactions (auto-commit/rollback). Association alias (`as`) must match between definition and `include`. Paranoid mode requires `timestamps: true`. v7 is alpha --- most production code uses v6.
---
<critical_requirements>
**(You MUST use `declare` on all model class properties to prevent TypeScript from emitting class fields that conflict with Sequelize's internal attribute storage)**
**(You MUST pass `{ transaction: t }` to every query inside a transaction callback --- missing this causes operations to run outside the transaction and skip rollback)**
**(You MUST use `include` for eager loading related models --- fetching associations in loops creates N+1 query problems)**
**(You MUST match the `as` alias in `include` with the alias used in the association definition --- mismatches silently return `null` for the association)**
</critical_requirements>
---
**Auto-detection:** sequelize, Sequelize, Model.init, DataTypes, InferAttributes, InferCreationAttributes, CreationOptional, belongsTo, hasMany, hasOne, belongsToMany, findAll, findByPk, Op.and, Op.or, sequelize-cli, queryInterface, paranoid
**When to use:**
**When NOT to use:**
**Key patterns covered:**
**Detailed Resources:**
---
<philosophy>
**Sequelize** is a traditional, feature-rich ORM that maps JavaScript classes to database tables. Unlike schema-first ORMs, you define models in code and optionally generate migrations from them.
**Core principles:**
1. **Model-first design** --- Define models as classes, then sync or migrate the database 2. **Explicit over implicit** --- Associations, hooks, and scopes are declared manually 3. **SQL escape hatch** --- Raw queries available when ORM abstractions are insufficient 4. **Dialect abstraction** --- Same API across PostgreSQL, MySQL, SQLite, MariaDB, MSSQL
**v6 vs v7:**
</philosophy>
---
<patterns>
Configure the connection with dialect, pool, and logging options.
import { Sequelize } from "sequelize";
const MIN_POOL_SIZE = 0;
const MAX_POOL_SIZE = 10;
const POOL_ACQUIRE_TIMEOUT_MS = 30000;
const POOL_IDLE_TIMEOUT_MS = 10000;
export const sequelize = new Sequelize({
dialect: "postgres",
host: process.env.DB_HOST,
port: Number(process.env.DB_PORT),
database: process.env.DB_NAME,
username: process.env.DB_USER,
password: process.env.DB_PASSWORD,
logging: process.env.NODE_ENV === "development" ? console.log : false,
pool: {
min: MIN_POOL_SIZE,
max: MAX_POOL_SIZE,
acquire: POOL_ACQUIRE_TIMEOUT_MS,
idle: POOL_IDLE_TIMEOUT_MS,
},
});**Why good:** Named constants for pool config, conditional logging, explicit pool sizing
// BAD: Connection string with no pool config
const sequelize = new Sequelize("postgres://user:pass@localhost:5432/db");**Why bad:** Default pool settings may exhaust connections under load, no logging control
> See [examples/core.md](examples/core.md) for connection URI patterns and graceful shutdown.
---
Use `InferAttributes`, `InferCreationAttributes`, and `declare` for type-safe models.
import {
Model,
DataTypes,
type InferAttributes,
type InferCreationAttributes,
type CreationOptional,
} from "sequelize";
import { sequelize } from "./connection";
export class User extends Model<
InferAttributes<User>,
InferCreationAttributes<UserThe official skills marketplace for Agents Inc. 230+ skills covering everything from React and Prisma to Redis, ElevenLabs, and infrastructure tooling. Pick the skills that match your stack and install them via Claude Code. Need more control?
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming,…
LiteLLM proxy server setup, TypeScript client patterns via OpenAI SDK, model routing, fallbacks, load balancing, spend tracking,…
Serverless GPU compute platform for AI model deployment — web endpoints, GPU functions, model serving, and TypeScript client…
Local LLM inference with the Ollama JavaScript client -- chat, streaming, tool calling, vision, embeddings, structured output,…
Replicate SDK patterns for TypeScript/Node.js -- client setup, predictions, streaming, webhooks, file handling, model versioning,…
Together AI SDK patterns for TypeScript — client setup, chat completions, streaming, structured output, function calling,…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.