json-structured-prompting — Claude Code rule: what it does
json-structured-prompting defines a JSON architecture for complex image prompts with multiple subjects, explicit positioning, and variable templates.
AGPL-3.0 ★ 78,316 updated 2026-10-24
.claude/rules/json-structured-prompting.mdWhat json-structured-prompting does
This rule establishes a standard schema for describing visual compositions using structured fields instead of loose sentences. Prompts are separated into isolated blocks: environment parameters, an array of subjects with specific coordinates and actions, artistic medium details, and camera settings such as focal length or lighting angle.
The framework covers multi-entity interactions via assigned identifiers, multi-layered spatial depth, and parameter placeholders for automated asset generation. Each segment maintains dedicated keys for hex color accents and composition balance.
Raw JSON must be flattened into descriptive prose before feeding it into image models, as diffusion pipelines interpret natural descriptive sentences far better than nested syntax.
What it helps with
- organize multi-character scenes with clear spatial positions
- isolate lighting and camera settings from artistic style
- build reusable prompt templates with variable replacement
- separate foreground, midground, and background focus levels
Example prompts for the agent
- Structure a multi-character detective scene using the json-structured-prompting schema
- Create a product photography JSON layout with specific hex color values and lighting
- Convert this scene JSON definition into natural language prose for image generation
How to install json-structured-prompting
Manually: put the files in place
.claude/rules/json-structured-prompting.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/json-structured-prompting.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/json-structured-prompting.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/json-structured-prompting.mdManually: put the files in place
.clinerules/json-structured-prompting.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about json-structured-prompting
How to install json-structured-prompting in Claude Code?
Place the rule file into your project at .claude/rules/json-structured-prompting.md.
What is the purpose of json-structured-prompting?
It prevents attribute bleeding in complex scenes by separating subjects, environmental mood, camera setup, and stylistic references into dedicated keys.
Should the raw JSON be passed directly to the image generator?
No, the guideline requires converting the completed JSON object into fluent descriptive prose before executing the generation call.