Illustrative photo by Fotis Fotopoulos on Unsplash; not a screenshot of the example project.
Three example swords can tell an AI generator what your inventory data should look like. They cannot make the fourth sword valid.
That is the useful distinction behind few-shot prompting: examples guide generation; validation decides what your game accepts. The two belong together, especially when a tiny prototype starts accumulating real content.
Start with one item contract
Imagine a deliberately small inventory format:
{"id": "moss_blade", "slot": "weapon", "power": 12}
Your prompt can include this and a couple of other examples. But what happens when the next response uses damage instead of power, returns "12" as text, or invents a fourth slot category?
Here is a complete JSON Schema for this toy item format:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {"type": "string", "pattern": "^[a-z][a-z0-9_]*$"},
"slot": {"enum": ["weapon", "armor", "consumable"]},
"power": {"type": "integer", "minimum": 0, "maximum": 100}
},
"required": ["id", "slot", "power"],
"additionalProperties": false
}
The 0–100 range is a design choice for this example, not a recommended balance range for every game. So are the three slot labels. Replace them with your actual content contract rather than treating the example as a universal item system.
Two keywords do different jobs
The official JSON Schema object reference makes an easy-to-miss point: listing a field under properties does not make it required. Extra fields are also allowed by default.
That means a schema can look impressively detailed while still accepting an empty object.
required says which keys must exist. additionalProperties: false rejects unexpected keys in this simple, uncombined schema. Neither replaces the other.
Try these fixtures with a Draft 2020-12 validator:
- The original
moss_bladeobject should pass. - Removing
powershould fail. - Changing its value to the string
"12"should fail. - Adding a
damagekey should fail. - Setting
powerto 101 or -1 should fail. - Using
helmetas the slot should fail under this particular contract.
The schema and these cases, plus invalid identifier and boolean-power cases, were checked with Python's jsonschema Draft202012Validator: nine fixtures passed their expected outcomes. This is a small structural check, not a game-engine integration test.
Keep creativity before the import boundary
The April 2026 Game Vibe-Coding Glossary describes few-shot prompting as providing concrete examples of the pattern you want. That is useful for game-specific output: the examples can show your naming style, tone and data shape together.
I would turn that into a four-step content workflow:
- Supply approved examples and the current schema.
- Generate a small batch into a review area, not directly into live game data.
- Parse the JSON, validate each item, and report the exact failing field without silently changing the schema to accommodate it.
- Review accepted items in the game before promoting them into the content build.
Keep the original invalid response when requesting a correction. Otherwise a helpful-looking repair can hide the pattern you need to fix in the prompt or importer. If your importer intentionally supports unknown metadata, document that choice instead of blindly closing every object.
Valid is not balanced
Two individually valid objects can still share the same ID. A valid weapon can trivialize your opening boss. A correctly shaped consumable can have an unlicensed name or an inappropriate description.
Those require separate batch checks, editorial review and playtesting. A schema is one boundary, not a certificate that content is fun, safe or ready to ship.
The payoff is more room for creative experimentation: you can ask for unusual loot without asking your importer to guess what the generator meant.
Which game-data mistake would you catch first: duplicate IDs, unexpected fields, or values outside your design range?
Full KRI ZEK AI game-development glossary article.
Download Altered Brilliance: https://play.google.com/store/apps/details?id=tech.krizek.alteredbrilliance
Global website: https://global.krizek.tech
Pre-register for Arzenal Human Health: https://play.google.com/store/apps/details?id=tech.krizek.arzenal
Join The Power Of Gaming: https://discord.gg/sbYSPcCqJn
Top comments (0)