agentleFS
alexderzalexderz/agentic-toolbox/skills/lang-lua/SKILL.md

lang-lua

Skill5 starsChanged 46 days agoMITView on GitHub

use this when writing, reviewing, or testing Lua — *.lua including Neovim, game, and embedded scripts. do not use for JavaScript.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    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
  1. Very specific:

    Run the project's test or the host (nvim headless, game harness) on the changed file.

    line 18
  2. Very specific:

    Do not swallow with empty pcall unless you handle both returns.

    line 36

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Lua

Thin-but-complete guide. You actually write Lua. No scripts/. Process skills that may load with this one: load-with list.

Iron law

Indexes start at 1. pairs is not ipairs. Know which Lua you are on.

Tooling / verify

Run the project's test or the host (nvim headless, game harness) on the changed file. luacheck if the tree already has it.

Idioms a linter misses

  • 1-based sequences. Do not port 0-based loops blindly.
  • ipairs for the array part; pairs for maps. Do not mix and assume order.
  • local by default. Globals are a bug unless _G is the point.
  • require paths stay inside the project.
  • Lua 5.1 / LuaJIT: no integer subtype. Beware bitwise libs and numbers past 2^53.
  • Tables are the only data structure. Document whether a table is a list, a map, or both.

Errors

  • error / assert or the project's result convention (nil, err).
  • Do not swallow with empty pcall unless you handle both returns.

Concurrency

  • Lua is typically single-threaded. Coroutines are not threads. Do not share a table across two hosts without a plan.
  • Neovim: respect the event loop. No blocking syscalls on the main thread if the plugin already uses async.

Testing

  • Busted / the host's test command if present. Otherwise a small assert driver next to the module.

PR review

  • Off-by-one from a JS/C port.
  • New global.
  • load / loadstring of anything that is not a literal in-repo chunk.

Security

  • No load / loadstring / dofile of untrusted text.
  • os.execute / io.popen: argument hygiene; prefer none.
  • Neovim: no executing user text as Lua.

Always

  • local. ipairs vs pairs chosen on purpose. Tests or a host run.

Ask first

  • Switching Lua version (5.1 / 5.2 / 5.3 / 5.4 / LuaJIT).
  • Loading C modules.

Never

  • load / loadstring of untrusted text.
  • Assuming 0-based arrays.
  • Mutating _G as architecture.

Red flags

  • "Arrays start at 0"
  • "pairs and ipairs are the same"
  • "I'll loadstring the user config"

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.