lua
Skill15 starsChanged 46 days agoMITView on GitHub
Expert Lua programming assistance covering tables, metatables, closures, coroutines, and C embedding. Use when writing game scripts, Neovim plugins, Nginx OpenResty modules, or embedded device logic.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- Ajustor/claude-skillstheir own version, first seen Nov 16, 2026
- Mindrally/skillstheir own version, first seen Oct 8, 2026
- weiweimhy/agent-skillstheir own version, first seen Jul 1, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- Mindrally/skills★ 275same name
- Ajustor/claude-skills★ 0same name
- weiweimhy/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- numpySkill
- ollamaSkill
- openai-gptSkill
- opencvSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 102
Use metatables with the __index metamethod:
- Very specific: line 127
Always Declare Variables as local: Global variables by default pollute _G and degrade performance.
- Distinctive: line 129
Use LuaJIT where Supported: Leverage the LuaJIT compiler for near C-speed execution in OpenResty and games.
- Distinctive: line 135
Create circular metatable references: Infinite recursion during index lookups causes stack overflow errors.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
Lua
A powerful, efficient, lightweight, embeddable scripting language.
When to Use
- Game Engine Scripting & Modding: Scripting gameplay logic, AI behavior, and UI in Roblox, World of Warcraft, and LÖVE2D.
- High-Performance Web Gateways (Nginx / OpenResty): Executing microsecond request routing, auth token checks, and WAF rules in Nginx.
- Redis Server-Side Scripting: Running atomic transactions and complex data manipulations directly inside Redis instances.
- Extensible Editor Configurations (Neovim): Writing custom editor plugins, keymaps, and LSP hooks in modern Neovim.
Quick Start
print("Hello, World!")
function factorial(n)
if n == 0 then
return 1
else
return n * factorial(n - 1)
end
endCore Concepts
Tables as Universal Data Structures
Lua represents arrays, hashes, objects, modules, and namespaces using a single unified primitive: the Table:
-- Array style (1-indexed!)
local fruits = {"Apple", "Banana", "Cherry"}
print("First item:", fruits[1])
-- Hash / Dictionary style
local config = {
host = "127.0.0.1",
port = 8080,
["max-connections"] = 100
}
-- Iterating key-value pairs
for key, value in pairs(config) do
print(key .. " = " .. tostring(value))
endMetatables & Object-Oriented Inheritance
Overloads table behaviors (operators, indexing, custom methods) via metamethods:
local Account = {}
Account.__index = Account
function Account.new(balance)
local self = setmetatable({}, Account)
self.balance = balance or 0
return self
end
function Account:deposit(amount)
self.balance = self.balance + amount
return self.balance
end
local acc = Account.new(100)
acc:deposit(50)
print("Account balance:", acc.balance) -- 150Coroutines for Cooperative Concurrency
Fibers with manual yield and resume control:
local co = coroutine.create(function()
for i = 1, 3 do
print("Coroutine yield:", i)
coroutine.yield()
end
end)
coroutine.resume(co) -- "Coroutine yield: 1"
coroutine.resume(co) -- "Coroutine yield: 2"Common Patterns
Object-Oriented Class via Metatables
Problem: Lua lacks a native class keyword; object models must be built from first principles.
Solution:
Use metatables with the __index metamethod:
local Vector2 = {}
Vector2.__index = Vector2
function Vector2.new(x, y)
local self = setmetatable({}, Vector2)
self.x = x or 0
self.y = y or 0
return self
end
function Vector2:magnitude()
return math.sqrt(self.x * self.x + self.y * self.y)
end
local v = Vector2.new(3, 4)
print("Magnitude:", v:magnitude()) -- Output: 5Best Practices
Do:
- Always Declare Variables as
local: Global variables by default pollute_Gand degrade performance; uselocal var = .... - Remember Lua Arrays are 1-Indexed: Arrays start at index
1, not0. - Use LuaJIT where Supported: Leverage the LuaJIT compiler for near C-speed execution in OpenResty and games.
- Cache Global Function Lookups: Localize hot functions (
local sub = string.sub) in tight loops to eliminate global table lookups.
Don't:
- Store
nilvalues in arrays: Storingnilinside sequential tables breaks length operator (#) calculations. - Create circular metatable references: Infinite recursion during index lookups causes stack overflow errors.
- Concatenate strings repeatedly in loops: Use
table.insertandtable.concatto avoid O(N^2) memory reallocations.
Troubleshooting
| Error | Cause | Solution |
attempt to index a nil value | Accessing key on a variable that evaluated to nil. | Guard access with if tbl and tbl.key then or assign default table {}. |
attempt to call a nil value (method call with . instead of :) | Calling method with v.magnitude() instead of v:magnitude(). | Use colon syntax : to automatically pass self as the first argument. |
1-based indexing confusion | Treating first index in Lua array tables as 0. | Access first element with tbl[1] and iterate with ipairs. |
References
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.

