lua-basics
БесплатноБез исполняемых скриптовНе проверенTrigger: Lua code, Lua functions, tables, variables, conditionals, error handling, naming conventions, review Lua, optimize Lua. Write effective, performant…
от germanfndez★ 21 звезда на GitHubОб этом скилле
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/
Установить lua-basics в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл 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.
Как установить скилл lua-basics?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл lua-basics запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic