Skip to main content
skill CX Codex

oxmysql — Claude Code skill: what it does, how to install

This Claude Code skill writes server-side SQL for FiveM through oxmysql. It activates for database queries and migrations from mysql-async.

MIT 124 installs ★ 20 updated 2026-10-17

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add germanfndez/fiveai-skills --skill oxmysql -a claude-code
Open on GitHub

What oxmysql does

The skill selects an oxmysql call based on the expected result and writes server-side Lua or JavaScript with .await and positional ? placeholders. It covers reads, writes, prepared statements, and transactions. User values go through placeholders rather than being joined into SQL text.

Add server_script '@oxmysql/lib/MySQL.lua' to fxmanifest.lua above the other server scripts, and start oxmysql before the resource. MySQL.Sync.* and MySQL.Async.* are unavailable. For writes that must succeed together, the skill uses a transaction that rolls back on failure.

What it helps with

  • write a parameterized SELECT query for a FiveM resource
  • fetch one database row or value
  • group several writes into a transaction
  • replace mysql-async calls with oxmysql

Example prompts for the agent

  • Write server-side Lua to find a player with MySQL.single.await and a ? parameter.
  • Convert this mysql-async query to oxmysql.
  • Save several database changes in one oxmysql transaction.

How to install oxmysql

1Skills CLI (Vercel)

npx skills add germanfndez/fiveai-skills --skill oxmysql -a claude-code

2Manually: put the files in place

~/.claude/skills/oxmysql/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/oxmysql/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about oxmysql

How do I install oxmysql in Claude Code?

Run npx skills add germanfndez/fiveai-skills --skill oxmysql -a claude-code. The skill file is placed at ~/.claude/skills/oxmysql/SKILL.md.

What does oxmysql do?

The skill helps write FiveM server-side SQL using oxmysql. It selects a function for the expected result and uses .await with ? placeholders.

What does oxmysql need to work?

The oxmysql resource must start before the FiveM resource that uses it. Add server_script '@oxmysql/lib/MySQL.lua' to fxmanifest.lua.

Source text

SKILL.md · MIT
---
name: oxmysql
description: "Trigger: oxmysql, MySQL.query, MySQL.insert, MySQL.update, MySQL.single, MySQL.scalar, MySQL.prepare, MySQL.transaction, rawExecute, SQL, database, mysql-async. Write server-side SQL with oxmysql."
license: MIT
metadata:
  author: germanfndez
  version: "1.0.0"
---

# oxmysql

Server-side MySQL/MariaDB access for FiveM through the `MySQL` table (replacement for mysql-async and ghmattimysql).

## Activation Contract

Load this skill when the user writes or edits database code in a FiveM resource: SELECT/INSERT/UPDATE/DELETE, upserts, transactions, `MySQL.*`, `exports.oxmysql`, or migrating from mysql-async.

## Hard Rules

- Server only. Add `server_script '@oxmysql/lib/MySQL.lua'` to `fxmanifest.lua` above other server scripts.
- `MySQL.Sync.*` and `MySQL.Async.*` (mysql-async compatibility layer) are NOT available. Replace them with `MySQL.query`, `MySQL.scalar`, `MySQL.single`, `MySQL.insert`, `MySQL.update`, `MySQL.prepare`, `MySQL.transaction`, each with a `.await` variant.
- `@named` placeholders are deprecated: use positional `?` with an array of values. `prepare` accepts only `?` (and `??` for column names).
- Never concatenate user input into SQL; every value goes through a placeholder.
- Every function takes `(query, params, callback)`; use `.await` to yield instead of nesting callbacks.
- Use `transaction` when several writes must succeed or fail together; it rolls back on any failure.
- Use `rawExecute` only when the normalized result shape of `query`/`prepare` is insufficient.
- Prefer MariaDB over MySQL 8 for compatibility.

## Decision Gates

| Need | Call | Returns |
|---|---|---|
| Many rows | `MySQL.query.await(sql, params)` | array of rows |
| One row | `MySQL.single.await(sql, params)` | row or nil |
| One value (COUNT, one column) | `MySQL.scalar.await(sql, params)` | value or nil |
| Insert | `MySQL.insert.await(sql, params)` | insert id |
| Update / delete count | `MySQL.update.await(sql, params)` | affected rows |
| Hot path, repeated statement | `MySQL.prepare.await(sql, params)` | rows / value |
| Several statements atomically | `MySQL.transaction.await({ { query, values }, ... })` | success boolean |
| Raw, unnormalized result | `MySQL.rawExecute.await(sql, params)` | raw result |

## Execution Steps

1. Confirm the manifest line and that `oxmysql` starts before the resource.
2. Pick the function by result shape from Decision Gates.
3. Write the SQL with backticked identifiers and `?` for every value.
4. Wrap multi-statement writes in `transaction`.
5. Handle nil results (`single`, `scalar`) before use.

## Output Contract

Return runnable server-side Lua (or JS) using `MySQL.<fn>.await` with positional placeholders and no mysql-async syntax.

## References

- rules/placeholders.md — `?` placeholders, deprecated `@named`.
- rules/query.md — MySQL.query: rows or insertId/affectedRows.
- rules/single.md — MySQL.single: one row or nil.
- rules/scalar.md — MySQL.scalar: single value.
- rules/insert.md — MySQL.insert: returns insert id.
- rules/update.md — MySQL.update: returns affected rows.
- rules/prepare.md — MySQL.prepare: prepared statements.
- rules/transaction.md — MySQL.transaction: atomic multi-query.
- rules/rawExecute.md — MySQL.rawExecute: raw result.

Upstream docs: https://overextended.dev/oxmysql

© germanfndez · MIT · germanfndez/fiveai-skills

Similar skills

All skills for Data and databases →

From the same set12

The whole set →
lua-basics lua-basics — a skill that makes your coding agent follow Lua conventions for FiveM resources: naming, locals, tables and error handling. CX Codex +1 436installs fivemanage Teaches the agent to use the Fivemanage SDK: capture player screenshots, upload images and push logs to the dashboard via exports.fmsdk. CX Codex +1 367installs esx-framework esx-framework keeps an AI coding agent inside the ESX Legacy API when it writes FiveM resources: server and client sides, player objects, callbacks, jobs, money. CX Codex +1 319installs qbcore-framework qbcore-framework helps build FiveM resources on qb-core by generating server and client Lua code with argument validation, callback handling, and proper Player object methods. CX Codex +1 272installs oxlib This Claude Code skill helps write Lua code with ox_lib in FiveM resources. It activates for UI, zones, commands, and client-server requests. CX Codex +1 117installs fivem-deployment The fivem-deployment Claude Code skill selects and checks FXServer builds. It activates for server updates, server.cfg edits, or client connection problems after an update. CX Codex +1 114installs ox-inventory This Claude Code skill guides Lua work with ox_inventory, from item changes to stashes, shops, and inventory hooks. It activates for requests to register storage or move code from qb-inventory or esx inventory. CX Codex +1 104installs ox-target This Claude Code skill builds FiveM interactions with ox_target. It activates for target options, interaction zones, or migrations from qb-target. CX Codex +1 102installs

Project sponsors

Companies that keep this analytics open