← スキル一覧に戻る

lua-standard
by yu-sz
⭐ 0🍴 0📅 2026年1月25日
SKILL.md
name: lua-standard description: "Lua/Neovim coding standards. Use when: writing or reviewing Lua code (*.lua) for Neovim plugins or configuration."
Lua/Neovim Standard
1. Scoping & Variables
- Always use
local: Never pollute global namespace - Stateless modules: Avoid module-scope mutable state; pass dependencies as arguments
- Use
vim.g/vim.bintentionally: Only for Vim options, not general state
2. Type Annotations (LuaCATS)
Required annotations for functions:
---@param name type---@return type
Example:
---@param opts { silent?: boolean, desc: string }
---@return nil
local function setup_keymap(opts)
end
3. Naming Conventions
- Variables/Functions:
snake_case - Boolean:
is_,has_,can_prefix - Constants:
SCREAMING_SNAKE_CASE - Private functions:
_prefix
4. Neovim API Best Practices
- Keymaps must have
desc: Required for which-key discoverability - Use
<Plug>mappings: In plugins, expose for user customization - Prefer
vim.keymap.set: Overvim.api.nvim_set_keymap - Use
vim.notify: Overprint()for user messages
5. Error Handling
- Use
pcall/xpcall: For operations that may fail - Early returns: Check preconditions first
- Validate inputs: Check nil before operations
6. Module Pattern
local M = {}
function M.public_function()
end
local function private_helper()
end
return M
7. Performance
- Cache requires: Store at module top
- Prefer
vim.uv: Overvim.fnfor filesystem
8. Review Checklist
- Global variables → add
local - Missing LuaCATS annotations → add
---@param/---@return - Keymaps without
desc→ require description print()for messages → usevim.notify- Missing error handling for IO → add
pcall - Deprecated APIs → suggest modern alternatives
- Non-snake_case naming → rename
- Module-level mutable state → refactor
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です