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.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o sequelize.zip https://jpskill.com/download/15376.zip && unzip -o sequelize.zip && rm sequelize.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15376.zip -OutFile "$d\sequelize.zip"; Expand-Archive "$d\sequelize.zip" -DestinationPath $d -Force; ri "$d\sequelize.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
sequelize.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
sequelizeフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Claude が読む原文 SKILL.md(中身を展開)
この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。
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
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
// 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: "alice@example.com" }, { 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
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
- Migrations — Use
sequelize-clifor migrations; never usesync()in production - TypeScript — Use
InferAttributes/InferCreationAttributesfor full type inference - Scopes — Define reusable query scopes:
User.scope('active').findAll()for common filters - Transactions — Wrap related operations in transactions; use
CLSfor automatic transaction propagation - Paranoid mode — Enable
paranoid: truefor soft deletes; addsdeletedAtcolumn automatically - Eager loading — Use
includefor joins; setrequired: falsefor LEFT JOIN behavior - Hooks — Use
beforeCreate,afterUpdatefor business logic; keep models self-validating - Connection pool — Set
maxto match expected concurrency;idleto release unused connections