Skip to main content
skill CX Codex

fivem-nui — Claude Code skill: FiveM NUI interfaces

fivem-nui — a skill for building HTML/CSS/JS interfaces in FiveM resources: manifest setup, Lua-browser messaging, callbacks and focus handling.

MIT 649 installs ★ 20 updated 2026-10-17

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add germanfndez/fiveai-skills --skill fivem-nui -a claude-code
Open on GitHub

What fivem-nui does

The agent assembles ui_page, declares files in fxmanifest.lua, wires Lua client to browser via SendNUIMessage and RegisterNUICallback, manages keyboard and mouse focus. The skill includes rules for manifest structure, callback handling, server-side validation and debugging with F8 and Chrome DevTools.

Every RegisterNUICallback handler must call cb(...) on every execution path, or the browser request hangs. The agent moves state-changing logic, amounts, prices and ids to the server instead of leaving them in NUI: data from the browser arrives at the client, the client forwards it to the server, the server validates it again. The skill loads when SendNUIMessage, SetNUIFocus or RegisterNUICallback is mentioned.

What it helps with

  • build an HTML/CSS/JS interface for a FiveM resource
  • wire Lua client to browser with SendNUIMessage and RegisterNUICallback
  • declare ui_page and files in fxmanifest.lua
  • manage keyboard and mouse focus in NUI
  • validate browser data on the server

Example prompts for the agent

  • Build an NUI shop menu, buttons on the left, close on Escape
  • Add ui_page to the manifest and register the buyItem callback
  • Show how to send a message from Lua to the browser with SendNUIMessage

How to install fivem-nui

1Skills CLI (Vercel)

npx skills add germanfndez/fiveai-skills --skill fivem-nui -a claude-code

2Manually: put the files in place

~/.claude/skills/fivem-nui/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/fivem-nui/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about fivem-nui

How to install fivem-nui in Claude Code?

Run npx skills add germanfndez/fiveai-skills --skill fivem-nui -a claude-code, the skill will land in ~/.claude/skills/fivem-nui/SKILL.md.

What does fivem-nui do?

The skill teaches the agent to build NUI interfaces for FiveM: declare ui_page in the manifest, wire Lua and browser with SendNUIMessage and RegisterNUICallback, manage focus and validate data on the server.

Why does the NUI callback hang?

If RegisterNUICallback does not call cb(...) on every execution path, the browser request hangs. The agent will add a cb({}) call even in error cases.

Source text

SKILL.md · MIT
---
name: fivem-nui
description: "Trigger: NUI, ui_page, SendNUIMessage, SetNUIFocus, RegisterNUICallback, HTML/CSS/JS for FiveM, FiveM menu UI. Build FiveM NUI pages, wire Lua-browser messaging, callbacks and focus."
license: MIT
metadata:
  author: germanfndez
  version: "1.0.0"
---

# FiveM NUI

HTML/CSS/JS interfaces for FiveM: manifest setup, Lua-to-browser messages, NUI callbacks and focus handling.

## Activation Contract

Load this skill when the user asks to create or edit a FiveM UI, writes HTML/CSS/JS inside a resource, sets `ui_page`, or asks about `SendNUIMessage`, `SetNUIFocus` or `RegisterNUICallback`.

## Hard Rules

- Declare `ui_page` and include every UI file in `files` in `fxmanifest.lua`; a missing file silently fails to load.
- Reference assets with `https://cfx-nui-<resource>/path`; the `nui://` protocol is deprecated.
- `RegisterNUICallback` handlers must ALWAYS call `cb(...)` (at least `cb({})`), or the browser request hangs.
- Browser calls callbacks with `fetch('https://' + GetParentResourceName() + '/<name>', { method: 'POST', body: JSON.stringify(...) })`; the URL name must match the registered name exactly.
- `SetNUIFocus(keyboard, mouse)`: always call `SetNUIFocus(false, false)` when closing the UI.
- NUI callbacks run on the CLIENT. Validate their data client-side, then re-validate on the server before any state change; never trust UI-sent prices, amounts or ids.
- Minimize `SendNUIMessage` calls: batch updates rather than sending per frame.
- Debug with F8 and Chrome DevTools; test the page in a browser with a mock mode.

## Decision Gates

| Direction | Mechanism |
|---|---|
| Lua to browser | `SendNUIMessage({ type = ..., data = ... })` + `window.addEventListener('message')` |
| Browser to Lua | `fetch` POST to `https://<resource>/<callback>` + `RegisterNUICallback` |
| Browser wants server data | callback to Lua client, then a server callback |
| Show / hide cursor | `SetNUIFocus(true, true)` / `SetNUIFocus(false, false)` |
| Keyboard only | `SetNUIFocus(true, false)` |

## Execution Steps

1. Add `ui_page` and `files` to the manifest (read rules/setup.md).
2. Build `index.html`, CSS and JS; listen for `message` events keyed by `type`.
3. Register Lua callbacks for every action the UI can request; call `cb` on every path.
4. Manage focus on open/close; handle `Escape` to close.
5. Forward any state-changing action to the server and validate there.

## Output Contract

Return the manifest entries, the HTML/CSS/JS files, and the Lua client script with callbacks and focus handling. Keep security-relevant logic on the server.

## References

- rules/setup.md — folder layout, manifest, build tools, common mistakes.
- rules/fullscreen-nui.md — SendNUIMessage, SetNUIFocus, focus stack, assets, devtools.
- rules/nui-callbacks.md — RegisterNUICallback, fetch, async, errors, security.
- rules/best-practices.md — performance, security, state, error handling, testing.
- rules/reference-links.md — official docs and natives reference.

Upstream docs: https://docs.fivem.net/docs/scripting-manual/nui-development/

© germanfndez · MIT · germanfndez/fiveai-skills

Similar skills

All skills for Frontend and UI →

From the same set12

The whole set →
fivem-security fivem-security reviews FiveM server handlers and rewrites them so the server stops trusting client input. Useful when cheaters fire forged events at your resource. CX Codex +1 566installs fivem-basics fivem-basics — a FiveM Lua skill that lays out a resource across client, server and shared, writes the manifest and wires the sides with events and exports. CX Codex +1 509installs lua-basics lua-basics — a skill that makes your coding agent follow Lua conventions for FiveM resources: naming, locals, tables and error handling. CX Codex +1 436installs fivemanage Teaches the agent to use the Fivemanage SDK: capture player screenshots, upload images and push logs to the dashboard via exports.fmsdk. CX Codex +1 367installs esx-framework esx-framework keeps an AI coding agent inside the ESX Legacy API when it writes FiveM resources: server and client sides, player objects, callbacks, jobs, money. CX Codex +1 319installs qbcore-framework qbcore-framework helps build FiveM resources on qb-core by generating server and client Lua code with argument validation, callback handling, and proper Player object methods. CX Codex +1 272installs oxmysql This Claude Code skill writes server-side SQL for FiveM through oxmysql. It activates for database queries and migrations from mysql-async. CX Codex +1 124installs oxlib This Claude Code skill helps write Lua code with ox_lib in FiveM resources. It activates for UI, zones, commands, and client-server requests. CX Codex +1 117installs

Project sponsors

Companies that keep this analytics open