Skip to main content
skill CX Codex

lua — Claude Code skill: Lua development guidelines

Gives the agent a rulebook for Lua: tables, metatables, error handling, game loops and memory. Useful when your project is Lua or Love2D.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill lua -a claude-code
Open on GitHub

What lua does

The skill hands your agent a set of Lua conventions. Naming is spelled out: snake_case for variables and functions, PascalCase for classes and modules, uppercase for constants, a leading underscore for private names. Code organisation gets its own section — related functions go into modules, module-private code stays in local functions, dependencies come in through require().

Error handling is described with pcall and xpcall, plus assert() for preconditions and explicit nil checks. On performance the agent is told to keep values in locals, cache frequently read data and avoid creating tables inside loops. For object patterns it reaches for metatables: __index for inheritance, __newindex for property validation.

There is a game development section too: game loop structure, collision detection efficiency, state and input handling, integration with engines such as Love2D. Nothing to install beyond the skill itself, since these are text rules for the agent. One caveat: the skill sets a style, it does not check your code, so the agent will not flag a file that drifts from it.

What it helps with

  • settle naming for Lua variables and modules with the agent
  • wrap a risky call in pcall instead of letting the script die
  • stop table creation inside a hot loop
  • set up inheritance through __index without copying methods
  • lay out a game loop and input handling

Example prompts for the agent

  • write an inventory module in Lua with private functions kept local
  • wrap config loading in pcall and return a clear error
  • rewrite this loop so no tables are created on each iteration

How to install lua

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill lua -a claude-code

2Manually: put the files in place

~/.claude/skills/lua/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/lua/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about lua

How do I install the lua skill in Claude?

Run npx skills add Mindrally/skills --skill lua -a claude-code. The skill file then sits at ~/.claude/skills/lua/SKILL.md.

What does the lua skill do?

It gives the agent Lua development rules: naming, modules, error handling with pcall and xpcall, metatables, memory habits and game loop structure.

Does the lua skill need any dependencies?

No. It is a set of text rules for the agent and installs with a single command.

Source text

SKILL.md · Apache-2.0
---
name: lua
description: Lua development guidelines covering tables, metatables, error handling, game development, and performance optimization.
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Lua Development

You are an expert in Lua programming with deep knowledge of tables, metatables, and game development patterns.

## Core Principles

- Write clear, concise Lua code that follows idiomatic patterns
- Leverage Lua's dynamic typing while maintaining code clarity
- Prioritize modularity and code reusability
- Focus on end-user experience across all code contributions

## Lua-Specific Practices

- Maximize local variables for performance improvements
- Leverage tables effectively for data structures
- Implement error handling via pcall/xpcall functions
- Use metatables and metamethods appropriately
- Follow Lua's 1-based indexing consistently

## Naming Conventions

- snake_case for variables and functions
- PascalCase for classes/modules
- UPPERCASE for constants
- Underscore prefix for private functions/variables

## Code Organization

- Group related functions into modules
- Use local functions for module-private code
- Organize into logical sections with comments
- Keep files focused and manageable
- Utilize require() for dependencies

## Error Handling

- Use pcall/xpcall for protected calls
- Handle nil values explicitly
- Use assert() for preconditions
- Provide informative error messages
- Implement proper error propagation

## Performance Optimization

- Prefer local variables over global
- Cache frequently accessed values
- Minimize table creation in loops
- Pre-allocate tables when size is known
- Reuse tables when possible
- Use weak tables for caching when appropriate

## Memory Management

- Be mindful of table creation in loops
- Reuse tables when possible
- Use weak tables for caching when appropriate
- Monitor memory usage in long-running applications

## Metatables and OOP

- Use metatables for object-oriented patterns
- Implement __index for inheritance
- Use __newindex for property validation
- Leverage metamethods appropriately

## Game Development

- Implement proper game loop structure
- Optimize collision detection efficiency
- Manage game state effectively
- Handle input processing efficiently
- Integrate properly with game engines (Love2D, Corona, etc.)

## Testing and Documentation

- Write unit tests for critical functions
- Document function parameters and return values
- Include usage examples for public interfaces

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

All skills for Programming languages →

From the same set168

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor