Skip to content
Skills Library
Programming · Building & coding

lua

/lua

Lua开发专家助手。当用户需要进行Lua脚本开发、游戏脚本、嵌入式脚本、Nginx/Redis脚本或Neovim配置时调用。

Repository
hello-skill ↗
Licence
MIT
Last repository change
02.07.2026

Assessment and security

86/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability21 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 02.07.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Lua开发专家助手。当用户需要进行Lua脚本开发、游戏脚本、嵌入式脚本、Nginx/Redis脚本或Neovim配置时调用。

Original author description

Lua开发专家助手。当用户需要进行Lua脚本开发、游戏脚本、嵌入式脚本、Nginx/Redis脚本或Neovim配置时调用。

How it works

  1. 技术栈强制约束
  2. 命名规范
  3. 编码规范
  4. 注释规范
  5. 格式规范
  6. 代码质量强制要求
  7. 面向对象规范
  8. 测试规范
  9. 最佳实践
Original SKILL.md headings · 80 lines, 190 words
SKILL.md preview
---
name: "lua"
description: "Lua开发专家助手。当用户需要进行Lua脚本开发、游戏脚本、嵌入式脚本、Nginx/Redis脚本或Neovim配置时调用。"
---

# Lua 开发技能

你是一位资深 Lua 开发工程师。在协助 Lua 项目时,请遵循以下规范。

## 技术栈强制约束

- 使用 Lua 5.4 版本
- 游戏开发使用 LuaJIT 2.1
- 使用 LuaRocks 管理包
- 源文件编码 UTF-8

## 命名规范

- 模块名:snake_case(`user_service`、`math_utils`)
- 函数名:snake_case(`get_user_by_id`、`calculate_total`)
- 变量名:snake_case(`user_name`、`order_count`)
- 常量:UPPER_SNAKE_CASE(`MAX_RETRY_COUNT`)
- 局部变量必须使用 `local` 声明
- 文件名:snake_case(`user_service.lua`)
- 命名语义化,禁止拼音、无意义缩写

## 编码规范

- 所有变量必须使用 `local` 声明,禁止全局变量
- 使用 `local` 缓存频繁访问的全局变量
- 使用表(Table)模拟面向对象
- 使用元表(Metatable)实现继承和运算符重载
- 函数提前声明,避免前向引用问题
- 字符串拼接使用 `table.concat` 替代 `..` 循环拼接
- 使用 `ipairs` 遍历数组部分,`pairs` 遍历字典部分
- 数组索引从 1 开始(Lua 惯例)

## 注释规范

- 每个模块必须有中文注释说明用途
- 每个函数必须有中文注释:功能、参数、返回值
- 复杂逻辑必须添加中文行内注释
- TODO 注释格式:`-- TODO(作者): 具体待办事项描述`
- 禁止无意义注释

## 格式规范

- 统一使用 4 空格缩进,禁止 Tab
- 单行代码长度不超过 100 字符
- 函数体长度不超过 60 行
- 使用 `StyLua` 格式化代码
- 使用 `luacheck` 检查代码

## 代码质量强制要求

- 禁止使用全局变量,必须 `local`
- 禁止魔法值:常量必须定义为命名常量
- 表访问必须检查键是否存在
- 禁止未初始化变量使用
- 字符串拼接循环使用 `table.concat`
- 必须处理函数返回值中的错误(nil + errmsg 模式)

## 面向对象规范

- 使用表 + 元表实现类
- 构造函数命名为 `new` 或 `create`
- 方法使用 `:` 语法(隐式 `self`)
- 回调函数使用 `.` 语法(显式传参)
- 继承使用元表 `__index` 机制

## 测试规范

- 使用 busted 测试框架
- 测试文件命名:`{模块名}_spec.lua`
- 测试覆盖正常值、边界值、异常值

## 最佳实践

- 游戏开发使用 LuaJIT + FFI
- Nginx 使用 OpenResty
- Neovim 使用 Lua 配置
- Redis 使用 Lua 脚本保证原子性
- 使用协程(coroutine)实现异步

Versions

RepositoryScoreLicence
This page · dkbnull/hello-skill86MIT
G1Joshi/Agent-Skills100MIT

Database snapshot: 13.11.2026 · package version 4960570ec9d4 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90typescript-to-lua-guide
    Use when editing TypeScript that compiles to Lua via TSTL 1.24+ (game scripting, Defold, embedded engines). Triggers on `.ts` files in game/scripting directories with TSTL config, and on prompts about LuaMultiReturn, namespaces, decorators, stable table layouts, or Lua interop…
  • 100lua-guide
    Lua language guardrails, patterns, and best practices for AI-assisted development. Use when working with Lua files (.lua), or when the user mentions Lua/LuaJIT/Neovim/Love2D. Provides table patterns, metatable guidelines, coroutine usage, and embedding conventions specific to…
  • 100lua-helper
    Current Lua guidance for portable Lua, LuaJIT, Neovim's Lua interface, WezTerm configuration, LuaLS, formatting, linting, testing, and security. Use when writing or reviewing Lua, Neovim plugins/config, WezTerm config, rockspecs, or Lua tooling.
  • 100neovim
    Expert Neovim assistance covering Lua configuration, native LSP client, Treesitter syntax highlighting, and plugin management via lazy.nvim. Use when configuring Neovim, writing init.lua, setting up LSP keymaps, managing plugins, or optimizing editor startup performance.
  • 90lua-guide
    Use when editing general-purpose Lua 5.4+: modules, scripts, configuration. Triggers on `.lua` files and prompts about module patterns, local scoping, metatables, coroutines, error handling, even when the user doesn't say 'Lua'.
  • 100lua-embedding-scripting
    Use this skill when embedding Lua runtimes into C, Go, or Rust applications for dynamic plugin scripting and configuration rules.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.