roblox-luau-types — скилл для Claude Code: типы Luau в Roblox
Скилл для аннотаций типов Luau: дженерики, юнионы, сужение типов, строгий режим, экспорт типов из модулей. Пригодится при миграции на --!strict.
npx skills add TabooHarmony/roblox-brain --skill roblox-luau-types -a claude-codeЧто делает roblox-luau-types
Скилл добавляет агенту справочник по системе типов Luau. Он подсказывает, когда ставить --!strict, --!nonstrict или --!nocheck, как устроен новый солвер типов и почему keyof, rawkeyof, setmetatable<T, M>, type function и члены read без него не работают. Ошибки в таких местах обычно значат неверный солвер, а не неверный синтаксис.
Философия простая: сначала вывод типов, аннотации — только на границах (параметры, возвращаемые значения, экспорты). Локальные переменные размечать не нужно. Отдельный раздел про запечатанные и незапечатанные таблицы: незааннотированная локальная таблица остаётся открытой для новых полей, пока её не аннотируют, не вернут из функции или пока не кончится область видимости. Собирайте таблицу целиком до аннотации.
Ещё внутри: юнионы и размеченные юнионы с сужением по kind, сужение через typeof, IsA и утверждения, опциональные ключи { [K]: V? }, литеральные юнионы для закрытых словарей, дженерики вида function first<T>(list: {T}): T?, экспорт export type Foo для потребителей модуля. Про приведение :: сказано прямо: это для сужения слишком общего вывода, а не для сокрытия ошибок. И важное ограничение — аннотации договариваются с компилятором, а не с рантаймом: Remotes, DataStore, HttpService и атрибуты всё равно требуют проверок.
Какие задачи решает
- разметить типы в модуле перед миграцией на
--!strict - разобраться, почему
keyofилиtype functionне проходят проверку типов - сделать размеченный юнион и сузить его по полю
kind - вынести типы из модуля через
export typeдля других файлов - закрыть таблицу от новых полей аннотацией, а не вручную
Примеры запросов агенту
- добавь аннотации типов в этот модуль и включи
--!strict - почему тут ошибка типов на
keyof— проверь солвер - сделай размеченный юнион для состояний загрузки и сузь его по
kind
Как установить roblox-luau-types
1Через Skills CLI (Vercel)
npx skills add TabooHarmony/roblox-brain --skill roblox-luau-types -a claude-code2Вручную: положить файлы
~/.claude/skills/roblox-luau-types/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/roblox-luau-types/
1Через Skills CLI (Vercel)
npx skills add TabooHarmony/roblox-brain --skill roblox-luau-types -a codex2Вручную: положить файлы
.agents/skills/roblox-luau-types/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add TabooHarmony/roblox-brain --skill roblox-luau-types -a cursor2Вручную: положить файлы
.cursor/skills/roblox-luau-types/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install TabooHarmony/roblox-brain roblox-luau-types2Вручную: положить файлы
.github/skills/roblox-luau-types/SKILL.md1Через Skills CLI (Vercel)
npx skills add TabooHarmony/roblox-brain --skill roblox-luau-types -a gemini-cli2Командой платформы
gemini skills install https://github.com/TabooHarmony/roblox-brain --path skills/core/roblox-luau-typesВручную: положить файлы
.devin/skills/roblox-luau-types/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add TabooHarmony/roblox-brain --skill roblox-luau-types -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о roblox-luau-types
Как установить roblox-luau-types в Claude?
Выполните npx skills add TabooHarmony/roblox-brain --skill roblox-luau-types -a claude-code. Скилл встанет в ~/.claude/skills/roblox-luau-types/SKILL.md.
Что делает roblox-luau-types?
Даёт агенту справочник по типам Luau: строгость, вывод типов, сужение, юнионы, дженерики, экспорт типов и типизированные метатаблицы. Агент опирается на него при правке аннотаций и разборе ошибок проверки типов.
Нужен ли новый солвер типов Luau?
Для keyof, rawkeyof, setmetatable<T, M>, type function и членов read — да. В проектах с nocheck и nonstrict он включён по умолчанию, а строгим проектам нужен Workspace.UseNewLuauTypeSolver = Enabled.
Исходный текст
SKILL.md · MIT
---
name: roblox-luau-types
description: "Use when adding or fixing Luau type annotations: generics, unions, narrowing, strict mode, sealed tables, module type exports, typed metatables."
when_to_use: "Also for type checker errors and warnings, --!strict migration, luau-lsp diagnostics, and reviewing typed APIs."
last_reviewed: 2026-10-14
sources:
- https://raw.githubusercontent.com/Roblox/creator-docs/main/content/en-us/luau/type-checking.md
- https://luau.org/types/type-functions/
- https://luau.org/types/tables
- https://raw.githubusercontent.com/Kampfkarren/kampfkarren-luau-guidelines/main/README.md
---
# Luau Type System
## When to Load
Load for Luau annotations, inference, narrowing, strictness, exports, and solver features. Syntax: `roblox-luau-core`; lifecycle/scheduling: `roblox-luau-patterns`.
## Quick Reference
**Strictness:** `--!strict` for maintained code, `--!nonstrict` while transitioning, `--!nocheck` only for legacy or generated code. Directives and project settings select the mode; never assume one global default.
**New solver gate:** `keyof`, `rawkeyof`, `setmetatable<T, M>`, `type function`s, and `read` members need the new type solver. On by default for `nocheck`/`nonstrict` projects; strict projects need `Workspace.UseNewLuauTypeSolver = Enabled` (Scripting). Errors here usually mean wrong solver, not wrong syntax.
**Inference philosophy:** Infer first; annotate boundaries (params, returns, exports). Don't annotate every local.
**Sealed vs unsealed tables:** An unannotated local table stays open to new fields until annotated, returned from a function, or its scope exits; annotation seals it. Build tables fully before annotating; passing a table to a typed function does not seal it.
**Unions:** `local id: string | number` is a union; prefer tagged unions (`type State<T> = {kind:"loading"} | {kind:"ready", value:T}`) and discriminate on `kind` to narrow.
**Narrowing:** `typeof`, `IsA`, assertions, and tagged discriminants refine types; examples in full.md.
**Missing keys:** use `{ [K]: V? }` when lookups may miss; narrow before use.
**Closed vocabularies:** prefer literal unions; `never` checks can flag missing branches. Keep requires statically resolvable. Practitioner guidance: full.md.
**Generics:** Use when input→output type matters: `function first<T>(list: {T}): T?`, or `type Result<T> = {success: boolean, value: T?}`. Never replace with `any`.
**Type exports:** `export type Foo = {...}` at module boundaries; consumers use `Types.Foo`.
**Object typing:** `typeof(setmetatable({} :: CounterData, Counter))` types precise self; the new solver adds `setmetatable<T, M>` directly.
**Casts (::):** For narrowing overly generic inference, never for hiding errors.
**Trust boundaries:** Annotations contract with the compiler, not runtime data. Remotes, DataStores, HttpService, and attributes still need checks; inside a trusted boundary, let types carry the load.
**Review:** no hidden `any`, premature sealing, unchecked casts, or solver-blind rewrites.
> Full reference: see `references/full.md`
© TabooHarmony · MIT · TabooHarmony/roblox-brain