# luau-best-practices

A skill for writing, reviewing, and refactoring Roblox Luau code, with guidance on project structure, error handling, cleanup, and server-side checks.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 577 installs · ★ 5
- Author: dig1t
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/dig1t/skills/tree/HEAD/luau-best-practices/SKILL.md
- Updated: 2026-10-01
- HTML: https://affpapa.org/en/nevibecode/skills/luau-best-practices

## What it does

This skill gives an agent working rules for Roblox Luau: naming, file layout, `Server`, `Client`, `Shared`, and `Packages` organization, plus service and controller patterns. It covers when to use `pcall` around failing external calls and how to keep private state separate from a module’s public API.

The guidance also addresses event cleanup, `Maid` or `Janitor` usage, remote-call validation, and server authority. It recommends modern `task` APIs instead of older scheduling calls. Client-provided values must not define game state; the server checks the input and calculates the result.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add dig1t/skills --skill luau-best-practices -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/luau-best-practices/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/luau-best-practices/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add dig1t/skills --skill luau-best-practices -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/luau-best-practices/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add dig1t/skills --skill luau-best-practices -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/luau-best-practices/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install dig1t/skills luau-best-practices
```

2. **Manually: put the files in place**
- File: `.github/skills/luau-best-practices/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add dig1t/skills --skill luau-best-practices -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/dig1t/skills --path luau-best-practices
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/luau-best-practices/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add dig1t/skills --skill luau-best-practices -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/dig1t/skills/tree/HEAD/luau-best-practices/SKILL.md

## When to use it
- review Roblox Luau for style violations
- structure services and controllers by responsibility
- trace leaks from undisconnected events
- validate remote-call inputs on the server
- replace legacy waiting and scheduling calls

## Example prompts
- Review this Roblox module against Luau best practices and suggest concrete changes.
- Find memory leaks in the project and inspect event cleanup.
- Rewrite this remote handler so the server validates input and computes the result.

## Similar
- [roblox-luau-patterns](https://affpapa.org/en/nevibecode/skills/roblox-luau-patterns.md) — skill · 2100 installs
- [roblox-luau-core](https://affpapa.org/en/nevibecode/skills/roblox-luau-core.md) — skill · 1900 installs
- [roblox-luau](https://affpapa.org/en/nevibecode/skills/roblox-luau.md) — skill · 6400 installs
- [roblox-networking](https://affpapa.org/en/nevibecode/skills/gamedev-skills-roblox-networking.md) — skill · 3800 installs
- [roblox-game-development](https://affpapa.org/en/nevibecode/skills/roblox-game-development.md) — skill · 2200 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
