lua-standards

Enforce Lua best practices with LuaLS, StyLua, and luacheck.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/dungle-scrubs/agent-config --skill lua-standards
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lua-standards
Source: https://github.com/dungle-scrubs/agent-config/tree/main/stow/shared/skills/lua-standards
Command: npx skills add https://github.com/dungle-scrubs/agent-config --skill lua-standards

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Lua projects often suffer from global leakage, inconsistent formatting, and weak typing, making maintenance hard. This Skill provides a structured set of standards to prevent these issues, ensuring safer, cleaner Lua code and conversations.

Core Features & Use Cases

  • Local scope everywhere: enforce local variables and avoid polluting the global namespace.
  • Typing annotations: LuaLS EmmyLua-style annotations for IDE support and checks.
  • Formatting and linting: StyLua for formatting and luacheck for linting across projects.
  • Error handling and modules: pcall/xpcall patterns and a clean module pattern for safe exports.

Use case: Apply these standards when building Neovim configs, Hammerspoon scripts, LÖVE2D games, or any Lua project to improve readability and reliability.

Quick Start

Install and configure LuaLS, StyLua, and luacheck, then run formatting and linting across your Lua codebase.

Frequently Asked Questions about lua-standards

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent global variable leakage in Lua projects?

Prevent global leakage in Lua by enforcing consistent local scope for all variables and modules. This approach stops namespace pollution, ensuring safer and cleaner code across Neovim configs, Hammerspoon scripts, and LÖVE2D games.

What's the best way to handle errors safely in Lua scripting?

Handle errors safely in Lua by using pcall and xpcall patterns for robust execution. These functions catch exceptions during runtime, preventing crashes and ensuring reliable module exports in game scripting and configuration scenarios.

How do I add type checking to Lua for better IDE support?

Add type checking to Lua using LuaLS EmmyLua-style annotations. This provides strict IDE static analysis and autocompletion, improving readability and maintenance across Lua projects by catching type errors before runtime.

Does StyLua work with luacheck for formatting and linting Lua code?

Yes, StyLua works with luacheck to standardize Lua code quality. StyLua enforces consistent code formatting while luacheck performs static linting, together preventing weak typing and inconsistent styles across projects.

Can I apply these Lua best practices to Neovim and LÖVE2D configurations?

Yes, you can apply these Lua standards to Neovim and LÖVE2D configurations. The practices enforce local scoping, explicit module patterns, and safe error handling, improving reliability across various Lua application environments.

Why does my Lua code fail when requiring external modules?

Lua module requires often fail without safe error handling. Using pcall during module imports catches missing file errors gracefully, while explicit module patterns ensure clean exports and prevent global namespace pollution.