esx-framework
Skill19 starsChanged 2 months agoMITView on GitHub
Trigger: ESX, es_extended, xPlayer, PlayerData, ESX.GetPlayerFromId, ESX.RegisterServerCallback, ESX jobs, economy, inventory. Build ESX Legacy resources with server/client functions, xPlayer methods, callbacks and events.
In this repository12 other files it gives its agents.
- skill-creatorSkill
- fivemanageSkill
- fivem-basicsSkill
- fivem-deploymentSkill
- fivem-nuiSkill
- fivem-securitySkill
- lua-basicsSkill
- ox-inventorySkill
- oxlibSkill
- oxmysqlSkill
- ox-targetSkill
- qbcore-frameworkSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Always nil-check: if not xPlayer then return end before calling any method.
- Very specific: line 26
Use ESX.SecureNetEvent for client events that only the server may trigger.
- Distinctive: line 27
Prefer ox_lib for notifications, menus, dialogs and progress bars over ESX UI.
≈ “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
ESX Framework
Server/client API for ESX Legacy: xPlayer, PlayerData, callbacks, events, jobs and money.
Activation Contract
Load this skill when the user creates or edits an ESX resource, touches xPlayer or ESX.PlayerData, needs jobs, money, accounts, items or weapons through ESX, or asks about ESX callbacks, events or best practices.
Hard Rules
- Get the object with
ESX = exports['es_extended']:getSharedObject(). On the client, wait forESXandESX.IsPlayerLoaded()before readingESX.PlayerData. xPlayerexists on the SERVER only (ESX.GetPlayerFromId(source)).ESX.PlayerDataexists on the CLIENT only.- Always nil-check:
if not xPlayer then return endbefore calling any method. - Money, items, weapons, jobs and metadata are mutated on the server through
xPlayer.*methods, never from the client. - Pass a
reasontoaddMoney,removeMoney,addAccountMoney,removeAccountMoney. - Client callbacks (
ESX.TriggerClientCallback,ESX.AwaitClientCallback) must never decide anything sensitive: the client can fake the answer. - Use
ESX.SecureNetEventfor client events that only the server may trigger. - Prefer ox_lib for notifications, menus, dialogs and progress bars over ESX UI.
- Cache
PlayerPedId()and update onesx:playerPedChanged; neverWait(0)loops without need.
Decision Gates
| Need | Use |
| Client asks server for data | ESX.RegisterServerCallback + ESX.TriggerServerCallback |
| Server pushes an event to one player | xPlayer.triggerEvent(name, ...) |
| Server-only client event | ESX.SecureNetEvent(name, cb) on the client |
| Find player by source / identifier | ESX.GetPlayerFromId / ESX.GetPlayerFromIdentifier |
| Filter players by job etc. | ESX.GetExtendedPlayers(key, value) |
| Usable item | ESX.RegisterUsableItem(item, cb) |
| Admin command with group | ESX.RegisterCommand(name, group, cb, allowConsole, suggestion) |
Execution Steps
- Confirm
es_extendedstarts before the resource; acquireESXper side. - Decide the side: mutation and validation on server, display on client.
- Fetch
xPlayer, nil-check, then validate every client-supplied argument. - Pick the call from Decision Gates; read the matching rules file for signatures.
- Return data via callbacks, not paired events.
Output Contract
Return runnable Lua with the client/server split explicit, xPlayer nil-checked, and reasons on money operations. Use ox_lib for UI unless the user asks otherwise.
References
- rules/core-concepts.md — architecture, PlayerData, xPlayer, startup flow.
- rules/client-functions.md — client-side ESX functions and player state.
- rules/server-functions.md — player retrieval, callbacks, commands, jobs, items.
- rules/xplayer-methods.md — xPlayer money, accounts, inventory, weapons, meta.
- rules/events-callbacks.md — server/client callbacks, events, SecureNetEvent.
- rules/best-practices.md — naming, caching, loops, security, Lua 5.4.
- rules/reference-links.md — official ESX documentation links.
Upstream docs: https://docs.esx-framework.org
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.

