Skip to main content
skill CX Codex

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

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

What 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.RegisterServerCallback that returns the player's bank balance
  • Register a usable item lockpick and charge the player through removeMoney with a reason
  • Why is ESX.PlayerData empty right after the player loads?

How to install esx-framework

1Skills CLI (Vercel)

npx skills add germanfndez/fiveai-skills --skill esx-framework -a claude-code

2Manually: put the files in place

~/.claude/skills/esx-framework/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/esx-framework/

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

Similar skills

All skills for Game dev and 3D: Unity, Unreal, Godot, Blender →

From the same set12

The whole set →
fivem-security fivem-security reviews FiveM server handlers and rewrites them so the server stops trusting client input. Useful when cheaters fire forged events at your resource. CX Codex +1 566installs fivem-basics fivem-basics — a FiveM Lua skill that lays out a resource across client, server and shared, writes the manifest and wires the sides with events and exports. CX Codex +1 509installs 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 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 oxmysql This Claude Code skill writes server-side SQL for FiveM through oxmysql. It activates for database queries and migrations from mysql-async. CX Codex +1 124installs 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

Project sponsors

Companies that keep this analytics open