orm-mysql-usage
Simplifies MySQL database interactions and query building in Node.js applications.
Install
mkdir -p .claude/skills/orm-mysql-usage && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13425" && unzip -o skill.zip -d .claude/skills/orm-mysql-usage && rm skill.zipInstalls to .claude/skills/orm-mysql-usage
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Build MySQL queries, perform CRUD operations, and manage transactions using @axiosleo/orm-mysql. Use when writing database queries, building where conditions, inserting/updating/deleting rows, managing transactions, or working with the ORM query builder in this project.Key capabilities
- →Create MySQL database connections or connection pools
- →Build SQL queries using a fluent ORM query builder
- →Perform CRUD operations (Create, Read, Update, Delete) on database tables
- →Manage database transactions with commit and rollback
- →Generate SQL statements and parameter values without execution
- →Register pre/post hooks for query operations
How it works
The skill uses the @axiosleo/orm-mysql package to abstract MySQL database interactions, allowing users to build queries and manage data through a programmatic interface. It wraps a connection or connection pool with a QueryHandler to create QueryOperator instances for table operations.
Inputs & outputs
When to use orm-mysql-usage
- →Building dynamic SQL queries
- →Executing database CRUD operations
- →Implementing transactions
- →Managing database connections
About this skill
@axiosleo/orm-mysql Usage Guide
Installation
npm install @axiosleo/orm-mysql
Setup
Create a Connection
const { createClient, QueryHandler } = require("@axiosleo/orm-mysql");
const conn = createClient({
host: "localhost",
port: 3306,
user: "root",
password: "password",
database: "my_db",
});
const db = new QueryHandler(conn);
Create a Connection Pool (recommended for production)
const { createPool, QueryHandler } = require("@axiosleo/orm-mysql");
const pool = createPool({
host: "localhost",
port: 3306,
user: "root",
password: "password",
database: "my_db",
connectionLimit: 10,
});
const db = new QueryHandler(pool);
Using MySQLClient
const { MySQLClient } = require("@axiosleo/orm-mysql");
const client = new MySQLClient({
host: "localhost",
port: 3306,
user: "root",
password: "password",
database: "my_db",
}, null, "pool"); // "default" | "promise" | "pool"
const rows = await client.table("users").select();
await client.close();
Class Hierarchy
QueryCondition -- where clauses (where, whereIn, whereLike, whereBetween...)
└── Query -- query building (table, attr, join, orderBy, limit, page...)
└── QueryOperator -- execution (select, find, insert, update, delete...)
└── TransactionOperator -- adds append() for row locking
QueryHandlerwraps a connection/pool and createsQueryOperatorvia.table(name)TransactionHandlerwraps a promise connection and createsTransactionOperatorvia.table(name)
Quick Start
const db = new QueryHandler(conn);
// SELECT
const users = await db.table("users")
.where("age", ">", 18)
.orderBy("name", "asc")
.limit(10)
.select("id", "name", "age");
// INSERT
await db.table("users").insert({ name: "Joe", age: 25 });
// UPDATE
await db.table("users").where("id", 1).update({ age: 26 });
// DELETE
await db.table("users").where("id", 1).delete();
// COUNT
const total = await db.table("users").where("age", ">", 18).count();
// IMPORTANT: for paginated lists, reuse the SAME builder for count() and select() -- see pagination.md
// FIND single row
const user = await db.table("users").where("id", 1).find();
Dry Run with notExec()
Call notExec() before any CRUD method to get a Builder object with .sql and .values instead of executing:
const builder = await db.table("users")
.where("age", ">", 18)
.notExec()
.select("id", "name");
console.log(builder.sql); // "SELECT `id`, `name` FROM `users` WHERE `age` > ?"
console.log(builder.values); // [18]
Reference Files
| Scenario | File |
|---|---|
| Building queries (table, join, orderBy, limit, groupBy, attr) | query-building.md |
| Where conditions (where, whereIn, whereLike, whereBetween...) | where-conditions.md |
| CRUD operations (select, find, count, insert, update, delete, incrBy, upsertRow) | crud-operations.md |
| Pagination (reuse the same builder for count() and select(), avoid duplicated where clauses) | pagination.md |
| Transactions (beginTransaction, commit, rollback, FOR UPDATE) | transactions.md |
Hooks
Register pre/post hooks for query operations:
const { Hook } = require("@axiosleo/orm-mysql");
Hook.pre(async (options) => {
console.log("Before:", options.operator, options.tables);
}, { table: "users", opt: "insert" });
Hook.post(async (options, result) => {
console.log("After:", result);
}, { table: "users", opt: "insert" });
Schema Helpers
const exists = await db.existTable("users");
const dbExists = await db.existDatabase("my_db");
const fields = await db.getTableFields("my_db", "users", "COLUMN_NAME", "DATA_TYPE");
Raw SQL
const result = await db.query({ sql: "SELECT * FROM users WHERE id = ?", values: [1] });
When not to use it
- →When working with databases other than MySQL
- →When deep learning or AI-specific database operations are required
- →When a direct SQL client without ORM abstraction is preferred
Limitations
- →Limited to MySQL databases
- →Requires familiarity with ORM concepts for effective use
How it compares
This skill provides a structured ORM approach to database operations, abstracting raw SQL queries into method calls for building conditions, performing CRUD, and managing transactions.
Compared to similar skills
orm-mysql-usage side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| orm-mysql-usage (this skill) | 0 | 3mo | Review | Intermediate |
| agentdb-advanced-features | 7 | 9mo | Review | Advanced |
| senior-backend | 14 | 7mo | Review | Advanced |
| redis-inspect | 6 | 6mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
agentdb-advanced-features
ruvnet
Master advanced AgentDB features including QUIC synchronization, multi-database management, custom distance metrics, hybrid search, and distributed systems integration. Use when building distributed AI systems, multi-agent coordination, or advanced vector search applications.
senior-backend
davila7
Comprehensive backend development skill for building scalable backend systems using NodeJS, Express, Go, Python, Postgres, GraphQL, REST APIs. Includes API scaffolding, database optimization, security implementation, and performance tuning. Use when designing APIs, optimizing database queries, implementing business logic, handling authentication/authorization, or reviewing backend code.
redis-inspect
civitai
Inspect Redis cache keys, values, and TTLs for debugging. Supports both main cache and system cache. Use for debugging cache issues, checking cached values, and monitoring cache state. Read-only by default.
database-migration
wshobson
Execute database migrations across ORMs and platforms with zero-downtime strategies, data transformation, and rollback procedures. Use when migrating databases, changing schemas, performing data transformations, or implementing zero-downtime deployment strategies.
prisma-connection-pool-exhaustion
blader
Fix Prisma "Too many connections" and connection pool exhaustion errors in serverless environments (Vercel, AWS Lambda, Netlify). Use when: (1) Error "P2024: Timed out fetching a new connection from the pool", (2) PostgreSQL "too many connections for role", (3) Database works locally but fails in production serverless, (4) Intermittent database timeouts under load.
add-module
fullstackhero
Create a new module (bounded context) with proper project structure, permissions, DbContext, and registration. Use when adding a new business domain that needs its own entities and endpoints.