スキル一覧に戻る
yu-sz

lua-standard

by yu-sz

0🍴 0📅 2026年1月25日
GitHubで見るManusで実行

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.b intentionally: 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: Over vim.api.nvim_set_keymap
  • Use vim.notify: Over print() 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: Over vim.fn for filesystem

8. Review Checklist

  1. Global variables → add local
  2. Missing LuaCATS annotations → add ---@param / ---@return
  3. Keymaps without desc → require description
  4. print() for messages → use vim.notify
  5. Missing error handling for IO → add pcall
  6. Deprecated APIs → suggest modern alternatives
  7. Non-snake_case naming → rename
  8. 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

レビュー

💬

レビュー機能は近日公開予定です