# GPT-Image2 Style Library Structure: Complete Guide to the JSON-Driven Catalog

> Explore the GPT-Image2 style library structure. Learn how the JSON catalog organizes tags, categories, styles, scenes, and templates for powerful visual generation.

- Repository: [苍何/awesome-gpt-image-2](https://github.com/freestylefly/awesome-gpt-image-2)
- Tags: architecture
- Published: 2026-08-29

---

**The GPT-Image2 style library is a hierarchical JSON catalog stored in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/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`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/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`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/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 identification
- **`templateAnchor`** – Links the category to its default template prefix (e.g., `tpl-ui`, `tpl-poster`)
- **`cover`** – Path to a preview image for documentation
- **`id`**, **`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 value
- **`styles`** and **`scenes`** – Arrays for filtering
- **`tags`** – Additional metadata tags
- **`useWhen`** – Multilingual description of ideal use cases
- **`guidance`** – Structured prompt blocks that the skill assembles
- **`pitfalls`** – Common mistakes to avoid
- **`exampleCases`** – 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`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/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:

1. **Match Category** – Identify the broad visual domain
2. **Match Style** – Narrow by visual language
3. **Match Scene** – Refine by narrative context
4. **Select Example** – Choose from `exampleCases` or present alternatives
5. **Build Prompt** – Assemble the final output using the template's `guidance` and `pitfalls` fields

## 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:

```javascript
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:

```javascript
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:

```javascript
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`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json)** – The master catalogue containing all tags, categories, styles, scenes, and templates ([source](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json))
- **[`agents/skills/gpt-image-2-style-library/SKILL.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/SKILL.md)** – Defines the skill workflow, maintenance commands, and human-readable documentation ([source](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/SKILL.md))
- **`scripts/generate-style-skill.mjs`** – Node.js script that regenerates skill assets from the JSON source ([source](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/scripts/generate-style-skill.mjs))
- **`scripts/install-skill.mjs`** – Installs generated skills into a local Codex skill folder ([source](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/scripts/install-skill.mjs))
- **[`docs/templates.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/docs/templates.md)** – Markdown rendering of the library for documentation and UI display ([source](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/docs/templates.md))

## Summary

- The **GPT-Image2 style library structure** centers on [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json), which organizes visual generation metadata into five hierarchical sections.
- **Templates** contain the actionable data, including `guidance` blocks for prompt construction and `pitfalls` for 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 `en` and `zh` fields across titles, descriptions, and guidance text.
- Programmatic access is straightforward using standard Node.js `fs` operations to filter by `anchor`, `value`, or `keywords` fields.

## Frequently Asked Questions

### What is the main data source for the GPT-Image2 style library?

The canonical source is **[`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/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`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/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`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json). After generation, use **`scripts/install-skill.mjs`** to deploy the updated skill to your local Codex environment.