sequelize
You are an expert in Sequelize, the promise-based ORM for Node.js supporting PostgreSQL, MySQL, MariaDB, SQLite, and MS SQL. You help developers define models, build queries, manage migrations, handle associations, use transactions, and configure connection pooling — providing a mature, battle-tested data access layer for production Node.js applications.
What this skill does
# Sequelize — Node.js SQL ORM
You are an expert in Sequelize, the promise-based ORM for Node.js supporting PostgreSQL, MySQL, MariaDB, SQLite, and MS SQL. You help developers define models, build queries, manage migrations, handle associations, use transactions, and configure connection pooling — providing a mature, battle-tested data access layer for production Node.js applications.
## Core Capabilities
### Model Definition
```typescript
import { Model, DataTypes, Sequelize, InferAttributes, InferCreationAttributes } from "sequelize";
const sequelize = new Sequelize(process.env.DATABASE_URL!, {
dialect: "postgres",
pool: { max: 20, min: 5, acquire: 30000, idle: 10000 },
logging: process.env.NODE_ENV === "development" ? console.log : false,
});
class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
declare id: number;
declare name: string;
declare email: string;
declare role: "user" | "admin";
declare createdAt: Date;
declare updatedAt: Date;
}
User.init({
id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true },
name: { type: DataTypes.STRING(100), allowNull: false, validate: { len: [2, 100] } },
email: { type: DataTypes.STRING, allowNull: false, unique: true, validate: { isEmail: true } },
role: { type: DataTypes.ENUM("user", "admin"), defaultValue: "user" },
}, {
sequelize, tableName: "users", timestamps: true,
hooks: {
beforeCreate: (user) => { user.email = user.email.toLowerCase(); },
},
});
class Post extends Model<InferAttributes<Post>, InferCreationAttributes<Post>> {
declare id: number;
declare title: string;
declare body: string;
declare published: boolean;
declare authorId: number;
}
Post.init({
id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true },
title: { type: DataTypes.STRING, allowNull: false },
body: { type: DataTypes.TEXT, allowNull: false },
published: { type: DataTypes.BOOLEAN, defaultValue: false },
authorId: { type: DataTypes.INTEGER, allowNull: false },
}, { sequelize, tableName: "posts" });
// Associations
User.hasMany(Post, { foreignKey: "authorId", as: "posts" });
Post.belongsTo(User, { foreignKey: "authorId", as: "author" });
```
### Queries
```typescript
// Find with eager loading
const users = await User.findAll({
where: { role: "user" },
include: [{ model: Post, as: "posts", where: { published: true }, required: false }],
order: [["createdAt", "DESC"]],
limit: 10, offset: 20,
});
// Raw query for complex operations
const [results] = await sequelize.query(`
SELECT u.name, COUNT(p.id) as post_count
FROM users u LEFT JOIN posts p ON u.id = p."authorId"
GROUP BY u.id ORDER BY post_count DESC LIMIT 10
`);
// Transaction
await sequelize.transaction(async (t) => {
const user = await User.create({ name: "Alice", email: "[email protected]" }, { transaction: t });
await Post.create({ title: "First Post", body: "Hello", authorId: user.id }, { transaction: t });
});
// Bulk operations
await User.bulkCreate(usersData, { validate: true, updateOnDuplicate: ["name"] });
```
## Installation
```bash
npm install sequelize
npm install pg pg-hstore # PostgreSQL
npm install sequelize-cli # Migrations CLI
npx sequelize init # Generate config/migrations/models dirs
```
## Best Practices
1. **Migrations** — Use `sequelize-cli` for migrations; never use `sync()` in production
2. **TypeScript** — Use `InferAttributes` / `InferCreationAttributes` for full type inference
3. **Scopes** — Define reusable query scopes: `User.scope('active').findAll()` for common filters
4. **Transactions** — Wrap related operations in transactions; use `CLS` for automatic transaction propagation
5. **Paranoid mode** — Enable `paranoid: true` for soft deletes; adds `deletedAt` column automatically
6. **Eager loading** — Use `include` for joins; set `required: false` for LEFT JOIN behavior
7. **Hooks** — Use `beforeCreate`, `afterUpdate` for business logic; keep models self-validating
8. **Connection pool** — Set `max` to match expected concurrency; `idle` to release unused connections
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.