oxmysql
Skill19 starsChanged 2 months agoMITView on GitHub
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.
In this repository12 other files it gives its agents.
- skill-creatorSkill
- esx-frameworkSkill
- fivemanageSkill
- fivem-basicsSkill
- fivem-deploymentSkill
- fivem-nuiSkill
- fivem-securitySkill
- lua-basicsSkill
- ox-inventorySkill
- oxlibSkill
- ox-targetSkill
- qbcore-frameworkSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Never concatenate user input into SQL.
- Very specific: line 24
Every function takes (query, params, callback).
- Very specific: line 25
Use transaction when several writes must succeed or fail together.
- Very specific: line 26
Use rawExecute only when the normalized result shape of query/prepare is insufficient.
- Distinctive: line 27
Prefer MariaDB over MySQL 8 for compatibility.
- Very specific: line 46
Write the SQL with backticked identifiers and ?
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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'tofxmanifest.luaabove other server scripts. MySQL.Sync.*andMySQL.Async.*(mysql-async compatibility layer) are NOT available. Replace them withMySQL.query,MySQL.scalar,MySQL.single,MySQL.insert,MySQL.update,MySQL.prepare,MySQL.transaction, each with a.awaitvariant.@namedplaceholders are deprecated: use positional?with an array of values.prepareaccepts only?(and??for column names).- Never concatenate user input into SQL; every value goes through a placeholder.
- Every function takes
(query, params, callback); use.awaitto yield instead of nesting callbacks. - Use
transactionwhen several writes must succeed or fail together; it rolls back on any failure. - Use
rawExecuteonly when the normalized result shape ofquery/prepareis 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
- Confirm the manifest line and that
oxmysqlstarts before the resource. - Pick the function by result shape from Decision Gates.
- Write the SQL with backticked identifiers and
?for every value. - Wrap multi-statement writes in
transaction. - 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
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

