Syntic

Skills may execute instructions and code that could affect your environment. Marketplace scans reduce risk but do not guarantee safety. Always review files, run your own security checks, and use at your own risk.

LanguagesFree Safe

Lua Developer

Security Scan Summary

Status: Safe

Source: Syntic Skills registry

Automated security scan completed with no high-risk patterns detected. Manual review is still required.

About This Skill

Use when building game scripts, Neovim plugins, and embedded Lua systems with metatables, coroutines, and LuaJIT optimization.

Downloadable SKILL.md

Download SKILL.md and place it in your Syntic skills folder. For Syntic Code, install in your local skills directory, review contents, and run in a controlled environment first. Acknowledge the risk notice above to enable the download.

SKILL.md
---
name: Lua Developer
description: Use when building game scripts, Neovim plugins, and embedded Lua systems with metatables, coroutines, and LuaJIT optimization.
category: Languages
version: 1.0.0
tools: []
---

# Performant Lua Development

Build high-performance scripts for game engines, Neovim plugins, and embedded systems. Leverage Lua's simplicity-first philosophy and metatables, coroutines, and LuaJIT's FFI for powerful abstractions.

## Lua Fundamentals

1. Use local variables everywhere. Global variable access is slower and pollutes the namespace. Declare `local` at the top of every scope.
2. Use tables as the universal data structure: arrays, dictionaries, objects, modules, and namespaces are all tables.
3. Implement object-oriented patterns with metatables and `__index`. Use the colon syntax (`obj:method()`) for methods that need `self`.
4. Prefer single-return functions. When multiple values are needed, return a table instead of multiple return values.
5. Handle nil explicitly. Lua does not distinguish between a missing key and a key set to nil. Use sentinel values or `rawget` when needed.

## Neovim Plugin Development

- Structure plugins with a `lua/plugin-name/` directory. Expose the public API through `lua/plugin-name/init.lua` with a `setup()` function.
- Use `vim.api.nvim_create_autocmd` for event handling. Use `vim.keymap.set` for keybinding registration with `desc` for which-key integration.
- Use `vim.treesitter` for syntax-aware operations. Query tree-sitter nodes instead of regex for reliable code manipulation.
- Implement commands with `vim.api.nvim_create_user_command`. Accept range, bang, and completion arguments.
- Use `vim.notify` for user-facing messages with severity levels. Use `vim.log.levels` for consistent classification.
- Store plugin state in a module-level table. Expose a `setup(opts)` function that merges user options with defaults using `vim.tbl_deep_extend`.

## Game Scripting Patterns

- Design the Lua-C boundary carefully. Expose only the API the script needs. Each C function must validate its arguments.
- Use coroutines for game entity behavior: `coroutine.yield()` to pause execution between frames, resume on the next update tick.
- Pool frequently created tables to reduce garbage collection pressure. Reuse tables with `table.clear` or manual field nilling.
- Use metatables with `__index` for prototype-based inheritance in entity component systems.
- Sandbox untrusted scripts by setting a restricted environment table with `setfenv` (Lua 5.1) or `_ENV` (Lua 5.2+).

## LuaJIT Optimization

- Write LuaJIT-friendly code: avoid `pairs()` in hot loops, use numeric for loops, keep functions monomorphic.
- Use LuaJIT FFI for calling C libraries directly. Define C struct layouts with `ffi.cdef` and allocate with `ffi.new`.
- Avoid creating closures in hot paths. LuaJIT optimizes flat function calls better than closure-heavy code.
- Use `ffi.typeof` to cache ctype objects. Creating ctypes repeatedly in loops defeats the JIT.
- Profile with LuaJIT's `-jv` (verbose JIT output) and `-jp` (profiler) flags to identify trace aborts and NYI (not yet implemented) operations.

## Module and Package Design

- Return a table from module files: `local M = {} ... return M`. Never use `module()` function.
- Use `require` for loading modules. Lua caches `require` results in `package.loaded`, so subsequent calls return the cached table.
- Implement lazy loading for expensive modules: store the module path and load on first access via `__index` metamethod.
- Version your module API. Use semantic versioning and document breaking changes in a changelog.

## Error Handling

- Use `pcall` and `xpcall` for protected calls. Use `xpcall` with an error handler that captures the stack trace.
- Return `nil, error_message` from functions that can fail. Check the first return value before using the result.
- Use `error()` with a table argument for structured errors: `error({ code = "NOT_FOUND", message = "User not found" })`.
- Never silently swallow errors. Log them at minimum, even if the function provides a fallback.

## Testing & Verification

- Run `luacheck` with the project's `.luacheckrc` to catch undefined globals, unused variables, and style violations.
- Test Neovim plugins with `plenary.nvim` test harness or `busted` for standalone Lua.
- Profile memory usage with `collectgarbage("count")` before and after critical operations.
- Verify compatibility with the target Lua version (5.1, 5.4, or LuaJIT 2.1).

Bundle Download

Includes SKILL.md and bundled support files where provided. Risk acknowledgement is required.

Install Targets

Syntic App

  1. 1. Create a dedicated folder for this skill in your local skills library.
  2. 2. Place SKILL.md into that folder.
  3. 3. Restart Syntic and invoke this skill on matching tasks.

Syntic Code (CLI)

  1. 1. Save SKILL.md in your local Syntic Code skills directory.
  2. 2. Keep related files in the same skill folder.
  3. 3. Run in a safe environment and validate outputs.

Source

https://github.com/rohitg00/awesome-claude-code-toolkit/blob/main/agents/language-experts/lua-developer.md

Open Source Link
Languages

Related Skills