esx-framework — скилл для Claude Code: ESX Legacy в Lua
Скилл esx-framework ведёт агента по API ESX Legacy для ресурсов FiveM: сервер и клиент, xPlayer, PlayerData, колбэки, работы и деньги.
MIT 319 установок ★ 20 обновлён 2026-10-17
npx skills add germanfndez/fiveai-skills --skill esx-framework -a claude-codeЧто делает esx-framework
Скилл описывает работу с ESX Legacy — API для ресурсов FiveM на Lua. Внутри правила и справочники: как получить объект через exports['es_extended']:getSharedObject(), где живёт xPlayer, а где ESX.PlayerData, как регистрировать колбэки и события.
Развилка простая. На сервере ESX.GetPlayerFromId(source) отдаёт xPlayer, и деньги, предметы, оружие и должности меняются только его методами. На клиенте доступен лишь ESX.PlayerData, причём читать его до ESX.IsPlayerLoaded() бессмысленно. Перед вызовом метода нужен nil-check, а у addMoney и removeMoney — причина операции. Ответ ESX.TriggerClientCallback не годится для решений о деньгах: клиент подделает его, поэтому проверка остаётся на сервере.
Семь файлов правил разбирают ядро, клиентские и серверные функции, методы xPlayer, события, безопасность и Lua 5.4. Для уведомлений и меню скилл советует ox_lib вместо штатного UI ESX.
Какие задачи решает
- собрать серверный колбэк, который отдаёт баланс игрока
- подключить usable item со списанием денег и причиной
- перенести изменение денег и предметов с клиента на сервер
- найти игрока по
sourceи проверитьxPlayerна nil - заменить уведомления ESX на ox_lib
Примеры запросов агенту
- Напиши серверный колбэк на
ESX.RegisterServerCallback, который возвращает баланс игрока - Добавь usable item
lockpick: списание денег черезremoveMoneyс причиной - Почему
ESX.PlayerDataпустой сразу после загрузки персонажа?
Как установить esx-framework
1Через Skills CLI (Vercel)
npx skills add germanfndez/fiveai-skills --skill esx-framework -a claude-code2Вручную: положить файлы
~/.claude/skills/esx-framework/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/esx-framework/
1Через Skills CLI (Vercel)
npx skills add germanfndez/fiveai-skills --skill esx-framework -a codex2Вручную: положить файлы
.agents/skills/esx-framework/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add germanfndez/fiveai-skills --skill esx-framework -a cursor2Вручную: положить файлы
.cursor/skills/esx-framework/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install germanfndez/fiveai-skills skills/esx-framework2Вручную: положить файлы
.github/skills/esx-framework/SKILL.md1Через Skills CLI (Vercel)
npx skills add germanfndez/fiveai-skills --skill esx-framework -a gemini-cli2Командой платформы
gemini skills install https://github.com/germanfndez/fiveai-skills --path skills/esx-frameworkВручную: положить файлы
.devin/skills/esx-framework/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add germanfndez/fiveai-skills --skill esx-framework -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы об esx-framework
Как установить esx-framework в Claude Code?
Выполните npx skills add germanfndez/fiveai-skills --skill esx-framework -a claude-code. Файл скилла окажется по пути ~/.claude/skills/esx-framework/SKILL.md.
Что делает esx-framework?
Даёт агенту правила и справочники по ESX Legacy: серверные и клиентские функции, методы xPlayer, колбэки, события, работу с деньгами и предметами.
Где xPlayer, а где ESX.PlayerData?
xPlayer существует только на сервере и берётся через ESX.GetPlayerFromId(source). ESX.PlayerData — только на клиенте, и читать его можно после ESX.IsPlayerLoaded().
Исходный текст
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