
lua-basics
Trigger: Lua code, Lua functions, tables, variables, conditionals, error handling, naming conventions, review Lua, optimize Lua. Write effective, performant Lua for FiveM resources.
- Installs
- 384
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/germanfndez/fiveai-skills --skill lua-basics- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads lua-basics automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Lua Basics
Idiomatic, performant Lua patterns for FiveM: functions, tables, variables, conditionals and errors.
Activation Contract
Load this skill when writing or reviewing any Lua in a FiveM resource, or when the user asks about Lua naming, structure, performance, tables or error handling.
Hard Rules
- Naming:
ALL_CAPSconstants,camelCaselocals,PascalCaseglobals,_for unused variables. - Prefer
local; declare locals as close to first use as possible; group file-level globals at the top of a single client/server file. - Do not use
table.insert; append witht[#t + 1] = vor maintain your own size counter. - Iterate arrays with numeric
for i = 1, #t; imply array indices ({ a, b }) instead of writing them out. - Extract repeated table dereferences into locals; use
t.keyfor constant keys andt[var]for dynamic keys. - Use guard clauses and early returns; never write
if x then return true else return false end. - Prefer positive boolean expressions; set defaults with
value = value or default. - Use
assertfor pre-conditions instead ofif not x then error() end; fail loudly on unexpected state; return errors as values for expected failures. - Limit parameters; avoid boolean parameters in APIs (use enums); pass named local functions instead of inline ones.
- Keep functions small, single-level of abstraction, and document exports.
Decision Gates
| Situation | Pattern |
|---|---|
| Expected failure (not found, invalid input) | return nil, err or false |
| Programmer error / impossible state | assert / error |
| Flag with more than two meanings | enum table, not boolean |
| Function reused more than once as argument | local function then pass by name |
| Append to array | t[#t + 1] = v |
Execution Steps
- Apply naming and scope rules to every identifier.
- Replace nested
ifwith guard clauses. - Replace
table.insertandpairson arrays with index writes and numeric loops. - Add
assertpre-conditions at function entry. - Re-read for size: split any function mixing high- and low-level code.
Output Contract
Return Lua that follows the naming, locality, table and error-handling rules above; annotate any deliberate deviation.
References
- rules/functions.md — size, naming, parameters, exports, guard clauses.
- rules/tables.md — indices, dereferencing, table.insert, iteration, size.
- rules/variables.md — naming, enums vs booleans, declaration location.
- rules/conditionals.md — defaults, boolean expressions, readability.
- rules/errors.md — assert, pre-conditions, errors as values, fail loudly.
- rules/reference-links.md — official Lua and FiveM documentation.
Upstream docs: https://www.lua.org/manual/5.4/
FAQ
What does the lua-basics skill do?
Trigger: Lua code, Lua functions, tables, variables, conditionals, error handling, naming conventions, review Lua, optimize Lua. Write effective, performant Lua for FiveM resources.
How do I install lua-basics?
Run npx skills add https://github.com/germanfndez/fiveai-skills --skill lua-basics in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/lua-basics/ (personal) or .claude/skills/lua-basics/ (project).
Which AI agents can use lua-basics?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is lua-basics safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains lua-basics?
It is published by germanfndez in germanfndez/fiveai-skills. It has 384 recorded installs.
More from germanfndez/fiveai-skills
fivem-nui
germanfndez/fiveai-skills
Trigger: NUI, uipage, SendNUIMessage, SetNUIFocus, RegisterNUICallback, HTML/CSS/JS for FiveM, FiveM menu UI. Build FiveM NUI pages, wire Lua-browser messaging, callbacks and focus.
fivem-security
germanfndez/fiveai-skills
Trigger: security, anti-cheat, exploit, secure events, validate client data, server authority, distance check, rate limit, review server code. Harden FiveM net events and server-side validation.
fivemanage
germanfndez/fiveai-skills
Trigger: Fivemanage, fmsdk, takeImage, takeServerImage, uploadImage, Log, Info/Warn/Error, player screenshots, logs dashboard. Install and use the Fivemanage SDK for images and centralized logs.
esx-framework
germanfndez/fiveai-skills
Trigger: ESX, esextended, xPlayer, PlayerData, ESX.GetPlayerFromId, ESX.RegisterServerCallback, ESX jobs, economy, inventory. Build ESX Legacy resources with server/client functions, xPlayer methods, callbacks and events.
qbcore-framework
germanfndez/fiveai-skills
Open the skill to read its SKILL.md instructions.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.