luau-type-expert — Claude Code skill: Luau types in strict mode
luau-type-expert works through Luau type errors and gets a file to --!strict: generics, unions, narrowing with type(), and :: casts.
no license 308 installs ★ 5 updated 2026-10-01
npx skills add dig1t/skills --skill luau-type-expert -a claude-codeWhat luau-type-expert does
Reach for this skill when luau-lsp or luau-analyze reports a type problem and you want the annotation fixed rather than silenced. It covers the three file modes (--!nocheck, --!nonstrict, --!strict), annotation syntax, generic functions and aliases with constraints, discriminated unions, and narrowing that follows type(), typeof() and truthiness checks. Early returns keep their narrowing, which is what guard clauses need.
Four reference files come with it: api_reference.md, common-errors.md, performance.md and lint-rules.md. The error table maps messages like the X-to-Y conversion complaint to a concrete fix, and the lint file goes through all 28 rules.
Typed metatables get their own walkthrough: declaring __index, the constructor and methods so setmetatable doesn't collapse the object to any. For .luaurc the skill explains languageMode, path aliases such as @shared and per-rule lint switches.
A cast only passes when one side is a subtype of the other or any — otherwise the error stays put. CLI analysis runs through luau-lsp analyze, and a Roblox codebase needs --sourcemap=sourcemap.json, or the instance tree won't line up.
What it helps with
- Clear a "Type X could not be converted into Y" error in a module
- Move an existing file to
--!strictwithout a pile of new errors - Type a metatable-based class with its constructor and
__index - Set up
.luaurcaliases and lint rules - Load
.d.luauglobals forluau-lsp analyze
Example prompts for the agent
- Why does
luau-lspflag a type error inInventory.luau, and how do I fix it? - Convert
PlayerData.luauto--!strictand explain each change - Write the type for a
Vector2class with a metatable sosetmetatablekeeps the type
How to install luau-type-expert
1Skills CLI (Vercel)
npx skills add dig1t/skills --skill luau-type-expert -a claude-code2Manually: put the files in place
~/.claude/skills/luau-type-expert/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/luau-type-expert/
1Skills CLI (Vercel)
npx skills add dig1t/skills --skill luau-type-expert -a codex2Manually: put the files in place
.agents/skills/luau-type-expert/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dig1t/skills --skill luau-type-expert -a cursor2Manually: put the files in place
.cursor/skills/luau-type-expert/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dig1t/skills luau-type-expert2Manually: put the files in place
.github/skills/luau-type-expert/SKILL.md1Skills CLI (Vercel)
npx skills add dig1t/skills --skill luau-type-expert -a gemini-cli2Platform CLI
gemini skills install https://github.com/dig1t/skills --path luau-type-expertManually: put the files in place
.devin/skills/luau-type-expert/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add dig1t/skills --skill luau-type-expert -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about luau-type-expert
How do I install luau-type-expert in Claude Code?
Run npx skills add dig1t/skills --skill luau-type-expert -a claude-code. The skill file ends up at ~/.claude/skills/luau-type-expert/SKILL.md.
What does luau-type-expert do?
It guides Luau type annotations and works through checker errors: generics, unions, narrowing inside conditionals, casts, typed metatables, .d.luau files and .luaurc setup.
Why does a :: cast leave the error in place?
A cast is accepted only when one operand is a subtype of the other or any. Unrelated types keep the message, so the annotation itself needs changing.