ForkFree

Prompts / Coding

Generate Strict JSON Spec From Description

You get a clean, machine-readable JSON object that matches your rules on the first try. It works because the model reads the rules first, then checks its own answer against each one before replying.

Worked in our testThe JSON has exactly the contract fields with valid types and ranges. The body is wider than tall (90 by 70) and closed with Z. The eyes sit above centre and well inside the outline. The output is one code block followed by a "Checked: none" line.

The prompt

Act as a careful generator of structured data that must pass a strict validator.

Task: Turn the plain-language description below into a single JSON object that follows the contract exactly.

Description: {item_description}
Contract: {json_contract}

Steps:
1. List every field in the contract and note its type, allowed range and whether it is required.
2. Choose concrete values for each field that match the description, keeping all numbers inside the stated ranges.
3. Build the JSON object using only the fields in the contract, with no extra keys or comments.
4. Check your object against each rule in the contract one by one, and fix any breach before replying.

Output: Reply with one valid JSON code block and nothing else. After it, add a single line starting "Checked:" that lists any rule you had to correct, or says "none".

Change the parts in curly braces. Use it when you need a chat model to produce config, data or design files that a validator or program will read without edits.

What happened when we ran it

We sent

Act as a careful generator of structured data that must pass a strict validator.

Task: Turn the plain-language description below into a single JSON object that follows the contract exactly.

Description: A friendly mascot for our bakery's chat widget: a round loaf of bread, slightly wider than it is tall, with the eyes sitting in the upper middle of the loaf so it looks cheerful. It should feel chunky and simple, with no fine detail.
Contract: Fields: version (integer, must be 1), id (lowercase string, letters and hyphens only), name (string, up to 30 characters), body.path (one SVG path string, drawn inside a 0 0 100 100 box, closed with Z), eyes.x and eyes.y (numbers 0 to 100, the centre of the eyes), eyes.spacing (number 5 to 40, distance between the eyes), eyes.scale (number 0.5 to 2, eye size). The eyes must sit inside the body outline. No other keys are allowed.

Steps:
1. List every field in the contract and note its type, allowed range and whether it is required.
2. Choose concrete values for each field that match the description, keeping all numbers inside the stated ranges.
3. Build the JSON object using only the fields in the contract, with no extra keys or comments.
4. Check your object against each rule in the contract one by one, and fix any breach before replying.

Output: Reply with one valid JSON code block and nothing else. After it, add a single line starting "Checked:" that lists any rule you had to correct, or says "none".

The model replied

```json { "version": 1, "id": "loaf-buddy", "name": "Loaf Buddy", "body": { "path": "M5 53 C5 30 25 18 50 18 C75 18 95 30 95 53 C95 76 75 88 50 88 C25 88 5 76 5 53 Z" }, "eyes": { "x": 50, "y": 42, "spacing": 22, "scale": 1.2 } } ``` Checked: none

Run on Claude Sonnet 5.5, 12 Nov 2026. Automatic check: 5 out of 5.

Mentioned for

Claude, ChatGPT, Gemini

Where it came from

Found on GitHub, shared by DominikScholz: DominikScholz/open-bot-avatar.

This is our own version of the idea, written and tested by us. The original may differ.

More coding prompts

Coding Partly worked
Match Ownership Wording to Change Size

You get a tightly scoped code change, plus a separate list of things the AI spotted but left alone. It works because you state how far the AI may go, so a sense of "ownership" does not trigger unrequested refactoring.

Found on Web, shared by explainx.ai
Coding Worked in our test
Turn Vague Bug Reports Into Concrete Objectives

You get a bug fix broken into a reproduction, a minimal change and a regression test, each checked against clear objectives. Concrete objectives stop the model drifting into large rewrites or guessing at what "fixed" means.

Found on Web, shared by David Ch (@chhddavid)
Coding Struggled in our test
Root-Cause Bug Fix With Honest Testing

You get a small, targeted fix with a test that proves it, plus an honest list of what was and was not checked. It works because it sets a clear goal, limits the scope, and tells the AI when to carry on and when to stop.

Found on Web, shared by Rizki Murtadha (Promptessor)