GPT-Image2 Style Library Structure: Complete Guide to the JSON-Driven Catalog
The GPT-Image2 style library is a hierarchical JSON catalog stored in data/style-library.json that organizes visual generation capabilities into five interconnected sections—Tag Labels, Categories, Styles, Scenes, and Templates—to power the matching workflow defined in agents/skills/gpt-image-2-style-library/SKILL.md.
The freestylefly/awesome-gpt-image-2 repository provides a comprehensive, data-driven approach to structured image generation through its GPT-Image2 style library structure. This architecture enables the skill to translate natural language requests into precise, production-ready prompts by mapping user intent against a curated database of visual styles and templates.
Core Components of the GPT-Image2 Style Library
The library defined in data/style-library.json consists of five distinct sections that work together to enable precise template selection.
Tag Labels
The Tag Labels section provides multilingual display names for all tag groups. Each entry maps a tag identifier to its English (en) and Chinese (zh) translations, enabling the skill to generate language-aware output for international users.
Categories
Categories represent high-level visual domains such as UI & Interfaces or Posters & Typography. Each category object contains:
anchor– A searchable slug used by the skill for identificationtemplateAnchor– Links the category to its default template prefix (e.g.,tpl-ui,tpl-poster)cover– Path to a preview image for documentationid,value,title,description– Core metadata fields
Styles
Styles define the visual language identifiers (e.g., 3D, Brand, Illustration) that appear in a template's styles array. Each style includes optional keywords that assist the matching engine in locating relevant templates through fuzzy matching algorithms.
Scenes
Scenes capture the narrative or usage context (e.g., Tech, Commerce, Story) through contextual tags. Like styles, scenes carry keywords to help narrow template selection based on the intended setting or mood.
Templates
Templates form the operational core of the library, serving as concrete prompt blueprints. A typical template entry includes:
id– Unique identifier (e.g.,ui-screenshot-system)anchor– Template slug (e.g.,tpl-ui)category– Links to a category valuestylesandscenes– Arrays for filteringtags– Additional metadata tagsuseWhen– Multilingual description of ideal use casesguidance– Structured prompt blocks that the skill assemblespitfalls– Common mistakes to avoidexampleCases– Array of real-world case IDs demonstrating the template
The Matching Workflow: From Intent to Prompt
According to the skill definition in agents/skills/gpt-image-2-style-library/SKILL.md, the library powers a specific matching workflow. The skill first detects the user's language and identifies the target output type. It then executes a hierarchical matching process:
- Match Category – Identify the broad visual domain
- Match Style – Narrow by visual language
- Match Scene – Refine by narrative context
- Select Example – Choose from
exampleCasesor present alternatives - Build Prompt – Assemble the final output using the template's
guidanceandpitfallsfields
Working with the Style Library Programmatically
The JSON structure enables direct programmatic access for custom tooling or third-party integrations.
Loading and Listing Categories
To load the library and enumerate available categories:
import fs from 'fs';
import path from 'path';
const libPath = path.resolve('data/style-library.json');
const lib = JSON.parse(fs.readFileSync(libPath, 'utf8'));
console.log('Available categories:');
for (const cat of lib.categories) {
console.log(`- ${cat.title.en} (${cat.id})`);
}
Finding Templates by Criteria
To locate templates matching specific category, style, and scene constraints:
function findTemplate({categoryId, styleId, sceneId}) {
const {templates, categories, styles, scenes} = lib;
// Resolve human‑readable names (optional)
const cat = categories.find(c => c.id === categoryId);
const style = styles.find(s => s.id === styleId);
const scene = scenes.find(s => s.id === sceneId);
// Filter templates that match all three criteria
return templates.filter(t =>
t.category === cat.value &&
t.styles.includes(style.value) &&
t.scenes.includes(scene.value)
);
}
const matches = findTemplate({categoryId: 'cat-poster', styleId: 'brand', sceneId: 'commerce'});
console.log('Matching templates:', matches.map(t => t.title.en));
Assembling Production Prompts
To convert a selected template into a ready-to-use prompt:
function buildPrompt(template) {
const {guidance, pitfalls, title} = template;
// Simple concatenation of the English guidance blocks
const prompt = guidance.en.join('\n');
return `${title.en}\n---\n${prompt}\n---\n# Pitfalls to avoid\n${pitfalls.en.join('\n')}`;
}
// Assume we have a template object from the previous search
const prompt = buildPrompt(matches[0]);
console.log(prompt);
Key Files and Maintenance Infrastructure
The repository maintains the library through several critical files:
data/style-library.json– The master catalogue containing all tags, categories, styles, scenes, and templates (source)agents/skills/gpt-image-2-style-library/SKILL.md– Defines the skill workflow, maintenance commands, and human-readable documentation (source)scripts/generate-style-skill.mjs– Node.js script that regenerates skill assets from the JSON source (source)scripts/install-skill.mjs– Installs generated skills into a local Codex skill folder (source)docs/templates.md– Markdown rendering of the library for documentation and UI display (source)
Summary
- The GPT-Image2 style library structure centers on
data/style-library.json, which organizes visual generation metadata into five hierarchical sections. - Templates contain the actionable data, including
guidanceblocks for prompt construction andpitfallsfor quality control. - The matching workflow follows a strict progression: Category → Style → Scene → Example, ensuring precise template selection.
- Multilingual support is built into the schema through
enandzhfields across titles, descriptions, and guidance text. - Programmatic access is straightforward using standard Node.js
fsoperations to filter byanchor,value, orkeywordsfields.
Frequently Asked Questions
What is the main data source for the GPT-Image2 style library?
The canonical source is data/style-library.json in the repository root. This file contains the complete catalog of Tag Labels, Categories, Styles, Scenes, and Templates that power the skill's matching algorithm.
How does the skill match user requests to specific templates?
According to agents/skills/gpt-image-2-style-library/SKILL.md, the skill executes a hierarchical filtering process: it first identifies the Category, then filters by Style, narrows by Scene, and finally selects from available Examples or presents alternatives before assembling the final prompt using the template's guidance field.
What fields are essential in a template definition?
Every template must include id, anchor, title, category, styles, and scenes. For prompt generation, the guidance field (containing structured prompt blocks) and pitfalls field (listing common errors) are critical for producing high-quality outputs.
How do I regenerate the skill assets after modifying the JSON library?
Run the scripts/generate-style-skill.mjs script to regenerate skill assets from the updated data/style-library.json. After generation, use scripts/install-skill.mjs to deploy the updated skill to your local Codex environment.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →