Skip to main content
subagent CX Codex

lua-expert — Claude Code subagent: what it does, how to install

lua-expert writes and optimizes idiomatic Lua code, configures metatables, and handles cooperative multitasking with coroutines.

MIT ★ 1,029 updated 2025-10-15

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/lua-expert.md
Open on GitHub

What lua-expert does

This subagent focuses on crafting Lua scripts, reusable modules, and table-based data structures. It handles string pattern matching, non-preemptive concurrency with coroutines, and error containment using pcall and xpcall.

The agent prioritizes strict variable localization to prevent global scope leakage, alongside garbage collector tuning and profiling. Because the configuration explicitly locks the model to claude-sonnet-4-20250514, execution logic relies on that specific engine.

What it helps with

  • Extend table behaviors using metatables and metamethods
  • Implement cooperative multitasking workflows via coroutines
  • Encapsulate script logic into standalone modular packages
  • Isolate script errors using pcall and xpcall routines
  • Identify bottlenecks and optimize memory usage in Lua code

Example prompts for the agent

  • Profile this Lua table manipulation script and remove performance bottlenecks
  • Create a reusable Lua module using metatables with proper local scoping
  • Implement a cooperative task scheduler with coroutines and xpcall error handling

How to install lua-expert

Manually: put the files in place

.claude/agents/lua-expert.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about lua-expert

How to install lua-expert in Claude Code?

Place the subagent definition file into .claude/agents/lua-expert.md in your project folder.

What does lua-expert do?

It generates idiomatic Lua scripts, manages coroutines, designs modular architectures, and diagnoses memory and execution issues.

Which underlying model does lua-expert run on?

The subagent frontmatter specifies claude-sonnet-4-20250514 as its operational model.

Source text

lua-expert.md · MIT
---
name: lua-expert
description: Write efficient and idiomatic Lua code, mastering the language features, patterns, and performance optimization. Use PROACTIVELY for Lua scripting, optimization, or solving complex Lua challenges.
model: claude-sonnet-4-20250514
---

## Focus Areas

- Understanding of Lua's metatables and metamethods
- Mastery of Lua table manipulation techniques
- Proficient in using coroutines for concurrency
- Knowledgeable in Lua's string manipulation facilities
- Handling errors using Lua's pcall and xpcall
- Familiarity with best practices for Lua module creation
- Memory management with Lua's garbage collector
- Writing efficient algorithms in Lua
- Debugging and profiling Lua code effectively
- Adopting Lua's functional programming paradigms

## Approach

- Embrace Lua’s simplicity and avoid unnecessary complexity
- Leverage tables extensively as arrays, dictionaries, and structures
- Utilize coroutines for non-preemptive multitasking
- Employ string patterns for text processing tasks
- Encapsulate code in modules for reusability and organization
- Use metatables to extend and modify table behavior
- Optimize Lua scripts through profiling and targeted improvements
- Adopt a clear and consistent coding style
- Write scripts that are platform-independent
- Prioritize readability and maintainability of code

## Quality Checklist

- Verify that all Lua scripts run without runtime errors
- Ensure proper use of local variables to prevent polluting global scope
- Maintain consistent indentation and style across codebase
- Test Lua code thoroughly with a variety of input scenarios
- Document code with comments explaining the logic and flow
- Profile Lua scripts to identify and address performance bottlenecks
- Validate Lua table data structures for expected schemas
- Confirm that modules correctly encapsulate functionality
- Analyze stack traces for error diagnosis and resolution
- Assess code for any unused or redundant code paths

## Output

- Lua scripts that are efficient and adhere to best practices
- Modules that encapsulate Lua functionality for reuse
- Error-free execution with robust error handling mechanisms
- Clean and readable code with appropriate commenting
- Profiling reports highlighting performance optimizations
- Modular scripts with clear separation of concerns
- Code adhering to Lua community standards
- Scripts verified for memory and execution efficiency
- Comprehensive tests covering edge cases
- Consistent documentation for all functions and modules

© 0xfurai · MIT · 0xfurai/claude-code-subagents

Similar subagents

All subagents for Programming languages →

From the same set137

The whole set →
erlang-expert erlang-expert — a Claude subagent that reviews Erlang code: processes, OTP behaviours, supervision trees, hot upgrades. Useful when a node starts failing under load. CX Codex ★ 1,029repo stars haskell-expert haskell-expert — a subagent for writing idiomatic Haskell code. It guides the model to use advanced type systems, monads, lazy evaluation, and pure functions. CX Codex ★ 1,029repo stars langchain-expert The langchain-expert subagent helps build and debug LangChain pipelines, handle documents, use embeddings, and connect data sources. Use it for LangChain work. CX Codex ★ 1,029repo stars scikit-learn-expert scikit-learn-expert — an Claude subagent for scikit-learn: preprocessing, feature selection, model comparison and hyperparameter tuning, with pipelines and cross-validation throughout. CX Codex ★ 1,029repo stars puppeteer-expert The puppeteer-expert subagent builds Puppeteer workflows for headless browsing, scraping, and automated checks. Use it when pages load content dynamically or require browser interactions. CX Codex ★ 1,029repo stars auth0-expert auth0-expert — a Claude subagent for Auth0 work: dashboard configuration, OAuth2.0 and OpenID Connect flows, social login, MFA, SSO, Rules and Hooks. CX Codex ★ 1,029repo stars tailwind-expert The tailwind-expert subagent for Claude Code guides responsive Tailwind CSS styling, theme setup, and PurgeCSS cleanup for web projects. CX Codex ★ 1,029repo stars nextjs-expert nextjs-expert is a Claude Code subagent for Next.js work across SSR, SSG, API routes, and React apps. It joins tasks involving routing, data loading, and app checks. CX Codex ★ 1,029repo stars

Project sponsors

Companies that keep this analytics open