# How to prompt an AI agent for a game UI task

> A useful game UI prompt names the screen, the files and contract the agent should read, the game behavior to connect, and the checks that define success. It also states what the agent must leave alone and what it should report as unverified.

Source: https://envyui.com/blog/game-ui-ai-prompts-that-work
Editorial date: 2026-10-25

“Make a polished inventory” leaves the agent to guess the layout, data and rules. A better request identifies one player action and gives the agent the files needed to complete it. The improvement comes from the information and checks, not a special phrase.

## Replace adjectives with constraints

Suppose you want an inventory screen. Instead of asking for something “modern,” say that the player needs to see item names and quantities, select an item with a controller and retain a readable layout at the game's target resolution. Provide an existing visual reference if one exists.

| Vague request | Information the agent can act on |
|---|---|
| Make the inventory work | Selecting a slot sends the selected item ID to the existing inventory system |
| Make it responsive | Test the stated target resolutions and safe area |
| Support controllers | Set initial focus and test directional navigation and cancel |
| Make it production ready | Run named checks and report what was not verified |

Do not ask the agent to invent your economy or decide how unavailable items behave. Give it those rules or ask it to flag the missing decision.

## Supply the actual interface

For a UI built in Envy, export the [AI handoff package](/docs/handoff). Give the agent the UI document, `AGENTS.md`, `contract.json`, runtime instructions and reference renders if you include them. The contract lists event names and data paths; your game project supplies the implementation behind them.

Mention the target engine and relevant project instructions. If the UI has scenarios for empty, full or error states, point the agent to them. Screen renders show a reference appearance, but they do not prove runtime input or game behavior.

## A prompt you can adapt

```text
Task: Connect the supplied inventory screen to our Godot game.

Read the project instructions and the handoff package first.
Use the supplied Envy document and runtime. Read contract.json
for exact event names and data paths.

Supply inventory data from the existing inventory system. Route
item-selection events to that system using the documented payload.
Keep validation and item ownership in the game. Do not rebuild
the screen or change unrelated systems.

Acceptance: an empty inventory opens, a populated inventory shows
the current items, selection sends the correct item ID after
reordering, and controller focus can reach the selectable slots.
Run the relevant document and game checks. Report files changed,
checks run, and any case you could not verify.
```

Replace each example with the names and conditions in your own project. If no controller is available in the test environment, the report should say so rather than claiming it passed.

## Review the result in two passes

First inspect the interface: do names, types, units and payloads match the contract? Then run the game: does the player action reach the real system, and does the UI reflect the result? An empty event handler or static sample data is a starting point, not a finished integration.

If the task changes the UI document, validate it and review the diff. If it changes the contract, update the game and the checks together. [Envy's agent guide](/ai) describes the available handoff and MCP tools; the [contract guide](/blog/game-ui-contract-ai-agents) covers what the interface should contain.

## Questions people ask

### Can one prompt describe the entire game UI?

It can, but a screen or interaction with explicit acceptance checks is easier to inspect. Break a larger task into small pieces that can be run and reviewed.

### Should a prompt include a screenshot?

A screenshot is useful for visual intent, but add the UI document, state and interaction details. Pixels alone do not tell the agent what a control does.

### How can I check an AI-generated UI change?

Inspect the diff and run relevant document and game checks. Exercise the screen with representative data and inputs, and distinguish tests actually run from suggestions.
