The fastest way to produce a non-trivial new FiveM resource through an agent is to invoke the grill workflow. It forces the agent to ask every architectural question before any file is written.
Triggering the workflow
> /agent_api:scaffold-fivem-resource> สร้าง resource ใหม่ที่...
> create a new fivem resource for ...
> build a script that ...The intent-detection path works in every client. The slash-command path is Claude Code only (other clients don't surface MCP prompts).
What the agent will do
It cannot skip steps — its mandatory contract is loaded into context.
Step 0 — preferences first. Before the tree, the agent calls list_preferences. For every saved preference (structure / coding / ui-design) it asks, one at a time, whether to adopt it as the guideline for this resource — and biases the rest of its recommendations toward the ones you accept. Set these up in the dashboard Preferences tab.
The agent also reviews the conversation and skips questions you've already answered (confirming instead of re-asking). Question tree in order:
- Identity — name, description, author
- Layout — one file vs multi-file with
server/,client/,shared/,config/subfolders. Flat layouts forbidden. - Module style — globals via manifest vs
return {}+lib.require(needs ox_lib) - Config split —
config/shared.lua,config/client.lua,config/server.lua. The last one stays server-side and is the only safe place for secrets. - Framework — standalone, ESX, QBCore, ox_core, multiple
- ox_lib — yes / no
- oxmysql — none / yes (+ list of tables to own)
- UI — none / yes
- UI stack — pure HTML+JS / Vite framework
- Framework choice — Vue 3 / React / Svelte / Solid / Preact
- State management — built-in / Pinia/Zustand/etc / none
- CSS approach — plain / scoped / Tailwind / UnoCSS
- Animations — none / CSS transitions / framework transitions / GSAP
- Validation — none / hand-rolled / Zod/Valibot
- Icons — none / inline SVG / Lucide / Phosphor
- Open key / command — F6 +
/<name>recommended - NUI focus model — modal / overlay / hybrid
- Lifecycle — start, playerDropped, stop behaviour
- Audit + rate limit — what to log, what to throttle
Every question carries lettered options (A / B / C / D …) and a "Recommended:" line, so you can reply with just a letter or "ok" / "เอา" and move on. Before it builds, the agent replays everything as a numbered summary; to revise a decision, say edit <number> referring to that line.
Then it builds
Once you confirm the summary, the agent walks the scaffolding phase:
create_resourcerefresh_resources- If UI = Vite:
run_shell npm create vite ...,run_shell npm install, editvite.config,run_shell npm run build write_fileevery Lua / config file (sandbox-checked)ensure_resource- If state didn't reach
started:tail_console, propose a fix, ask before rewriting
You see every step. Nothing happens silently.