fivem-basics
Skill19 starsChanged 2 months agoMITView on GitHub
Trigger: FiveM resource, fxmanifest, client/server script, RegisterNetEvent, TriggerServerEvent, TriggerClientEvent, exports, F8 logs, how FiveM works. Structure resources, manifests, events and exports for FiveM Lua.
In this repository12 other files it gives its agents.
- skill-creatorSkill
- esx-frameworkSkill
- fivemanageSkill
- 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
4 rules. About 0 are common, 1 is distinctive, and 3 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.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Never handle money or item transactions on the client.
- Very specific: line 25
No game natives in shared_scripts unless guarded by environment.
- Very specific: line 26
Use PlayerPedId() not GetPlayerPed(-1).
- Very specific: line 27
Prefer local; prefer variable Wait() over fixed Wait(0).
≈ “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
FiveM basics
Resource structure, fxmanifest, client/server split, events, exports and debugging for FiveM Lua.
Activation Contract
Load this skill when the user creates or edits any FiveM resource, fxmanifest.lua, client*.lua or server*.lua, asks how client/server, events or exports work, or reports a bug that needs server vs F8 logs.
Hard Rules
- Manifest:
fx_version 'cerulean'andgame 'gta5'(or'rdr3'/'common'); every client-served file goes infiles. - Register networked events with
RegisterNetEvent; local-only events useAddEventHandleralone, neverRegisterNetEvent. - Server handlers read the sender from
source; broadcast withTriggerClientEvent(event, -1, ...). GetInvokingResource()is nil for every net event that crosses the network; it is not an authentication check. Validate types, ranges and server-owned state instead.- Never handle money or item transactions on the client; validate and apply on the server.
- No game natives in
shared_scriptsunless guarded by environment. - Use
PlayerPedId()notGetPlayerPed(-1); use#(a - b)notGetDistanceBetweenCoords. - Prefer
local; prefer variableWait()over fixedWait(0). - Resource names use underscores, no spaces or special characters.
Decision Gates
| Need | Use |
| Client to server | TriggerServerEvent(event, ...) |
| Server to one / all clients | TriggerClientEvent(event, playerId | -1, ...) |
| Same side only | TriggerEvent + AddEventHandler |
| Data back across the network | a callback (ox_lib / framework), not paired events |
| Single-resource, non-networked call | a plain function, not an event |
| Cross-resource function | exports / server_export in manifest, exports.res:fn() |
| Bug with clean server console | ask for F8 client logs |
Execution Steps
- Lay out
client/,server/,shared/and the manifest; read rules/structure.md and rules/fxmanifest.md. - Decide the side for each piece of logic (natives on client, data and validation on server).
- Wire communication from Decision Gates; name events
resource:side:action. - Validate every server handler argument; add distance and state checks.
- Point to https://docs.fivem.net/natives/ for native lookups.
Output Contract
Return the manifest plus runnable Lua split by side, with event names, validation and source handling explicit.
References
- rules/structure.md — scope, client/server separation, naming.
- rules/fxmanifest.md — manifest entries, globbing, minimal example.
- rules/client-server.md — what runs where and how sides communicate.
- rules/events.md — register, trigger, naming, events vs functions, security.
- rules/exports.md — defining and consuming exports.
- rules/debugging.md — server console vs F8 logs.
- rules/optimization.md — locals, tables, natives, loops, security.
- rules/reference-links.md — official docs and natives reference.
Upstream docs: https://docs.fivem.net/docs/
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.

