esx-framework — Claude Code skill: ESX Legacy Lua resources
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.
MIT 319 installs ★ 20 updated 2026-10-17
npx skills add germanfndez/fiveai-skills --skill esx-framework -a claude-codeWhat esx-framework does
ESX Legacy is a FiveM framework, and this skill keeps an agent inside its API when it writes Lua resources. The bundled references cover the shared object from exports['es_extended']:getSharedObject(), the split between server and client state, callbacks, events and player methods.
On the server you fetch a player with ESX.GetPlayerFromId(source) and change money, items, weapons or job through that object. On the client there is only ESX.PlayerData, and reading it before ESX.IsPlayerLoaded() gives you nothing useful. Every method call wants a nil-check, and money moves carry a reason. An answer from ESX.TriggerClientCallback never settles anything about funds, because the client can fake it — keep that validation on the server.
Seven rule files sit behind the skill: core concepts, client functions, server functions, xPlayer methods, events and callbacks, best practices. For notifications and menus it points to ox_lib rather than the stock ESX interface.
What it helps with
- return a player's bank balance through a server callback
- charge for a usable item with a stated reason
- keep money and inventory changes on the server
- look a player up by source and nil-check the object
- move notifications from ESX UI to ox_lib
Example prompts for the agent
- Write a server callback with
ESX.RegisterServerCallbackthat returns the player's bank balance - Register a usable item
lockpickand charge the player throughremoveMoneywith a reason - Why is
ESX.PlayerDataempty right after the player loads?
How to install esx-framework
1Skills CLI (Vercel)
npx skills add germanfndez/fiveai-skills --skill esx-framework -a claude-code2Manually: put the files in place
~/.claude/skills/esx-framework/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/esx-framework/
1Skills CLI (Vercel)
npx skills add germanfndez/fiveai-skills --skill esx-framework -a codex2Manually: put the files in place
.agents/skills/esx-framework/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add germanfndez/fiveai-skills --skill esx-framework -a cursor2Manually: put the files in place
.cursor/skills/esx-framework/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install germanfndez/fiveai-skills skills/esx-framework2Manually: put the files in place
.github/skills/esx-framework/SKILL.md1Skills CLI (Vercel)
npx skills add germanfndez/fiveai-skills --skill esx-framework -a gemini-cli2Platform CLI
gemini skills install https://github.com/germanfndez/fiveai-skills --path skills/esx-frameworkManually: put the files in place
.devin/skills/esx-framework/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add germanfndez/fiveai-skills --skill esx-framework -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about esx-framework
How do I install esx-framework in Claude Code?
Run npx skills add germanfndez/fiveai-skills --skill esx-framework -a claude-code. The skill file lands at ~/.claude/skills/esx-framework/SKILL.md.
What does esx-framework do?
It gives the agent rules and references for ESX Legacy: server and client functions, xPlayer methods, callbacks, events, money and items.
When can I read ESX.PlayerData on the client?
Only after ESX.IsPlayerLoaded() returns true, and ESX itself must be loaded first. The server-side xPlayer comes from ESX.GetPlayerFromId(source).
Source text
SKILL.md · MIT
--- name: esx-framework description: "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." license: MIT metadata: author: germanfndez version: "1.0.0" --- # 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 for `ESX` and `ESX.IsPlayerLoaded()` before reading `ESX.PlayerData`. - `xPlayer` exists on the SERVER only (`ESX.GetPlayerFromId(source)`). `ESX.PlayerData` exists on the CLIENT only. - Always nil-check: `if not xPlayer then return end` before calling any method. - Money, items, weapons, jobs and metadata are mutated on the server through `xPlayer.*` methods, never from the client. - Pass a `reason` to `addMoney`, `removeMoney`, `addAccountMoney`, `removeAccountMoney`. - Client callbacks (`ESX.TriggerClientCallback`, `ESX.AwaitClientCallback`) must never decide anything sensitive: the client can fake the answer. - Use `ESX.SecureNetEvent` for 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 on `esx:playerPedChanged`; never `Wait(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 1. Confirm `es_extended` starts before the resource; acquire `ESX` per side. 2. Decide the side: mutation and validation on server, display on client. 3. Fetch `xPlayer`, nil-check, then validate every client-supplied argument. 4. Pick the call from Decision Gates; read the matching rules file for signatures. 5. 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
© germanfndez · MIT · germanfndez/fiveai-skills