Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dig1t/skills --skill luau-type-expert -a claude-code
Open on GitHub

What 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 --!strict without a pile of new errors
  • Type a metatable-based class with its constructor and __index
  • Set up .luaurc aliases and lint rules
  • Load .d.luau globals for luau-lsp analyze

Example prompts for the agent

  • Why does luau-lsp flag a type error in Inventory.luau, and how do I fix it?
  • Convert PlayerData.luau to --!strict and explain each change
  • Write the type for a Vector2 class with a metatable so setmetatable keeps the type

How to install luau-type-expert

1Skills CLI (Vercel)

npx skills add dig1t/skills --skill luau-type-expert -a claude-code

2Manually: put the files in place

~/.claude/skills/luau-type-expert/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/luau-type-expert/

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.

Similar skills

All skills for Programming languages →

From the same set3

Project sponsors

Companies that keep this analytics open