roblox-luau-patternslisted
Install: claude install-skill ibrohim1234567881717/game-dev-ai-skills
# Roblox Luau Patterns
## Purpose
Luau is not Lua 5.1 with a new name. It has a gradual type system, its own
syntax additions (`continue`, `+=`, backtick string interpolation, `if-then-else`
expressions), deliberate removals (`setfenv`, `getfenv`, `goto`, bitwise
operators, `loadstring` off by default), and a compiler that optimises specific
shapes and pessimises others.
Code copied from a Lua tutorial usually runs, then fails in a way the author did
not expect: `--!strict` rejects it, `getfenv` deoptimises the whole enclosing
function, or a class written with `self` untyped produces no completion and no
type checking at any call site. This skill is the set of idioms that make a Luau
module type-check cleanly, read like the rest of the ecosystem, and stay cheap.
## When to use
- Writing a new `ModuleScript`, or converting an untyped one to `--!strict`.
- Deciding how to model something: plain table of functions, metatable class,
closure-based object, or just data.
- Fixing `luau-lsp` or Studio script-analysis diagnostics you do not understand.
- Reviewing Luau for correctness or for allocation in a hot path.
- Porting code written for Lua 5.1, LÖVE, or another Lua host.
## When NOT to use
- Deciding *where* the module lives in the DataModel, or whether the project is
Rojo or Studio-only — use `roblox-project-conventions` first.
- Designing the boundary between client and server — use
`roblox-client-server-architecture`.
- Validating attacker-controlled input — ty