How the GPT‑Image2 Agent Skill Processes User Requests in freestylefly/awesome‑gpt‑image‑2
The agent skill processes user requests through a deterministic, rule‑based pipeline: language detection, target output classification, template matching against a curated style library, optional candidate presentation, and structured prompt assembly with copy‑ready output.
The GPT‑Image2 style‑library skill transforms vague user intent into production‑ready image generation prompts according to the open‑source repository freestylefly/awesome-gpt-image-2. This agentic skill combines a curated dataset of reverse‑engineered GPT‑Image2 cases with explicit workflow rules defined in SKILL.md. Understanding how the agent skill processes user requests helps developers extend the system or debug prompt generation failures.
Agent Registration and Configuration
The skill registers itself in the OpenAI agent ecosystem through agents/openai.yaml. This YAML file supplies metadata that agent frameworks consume:
display_name– human‑readable skill labelshort_description– quick capability summarydefault_prompt– fallback instruction when user input is ambiguous
# From agents/skills/gpt-image-2-style-library/agents/openai.yaml
display_name: "GPT-Image2 Style Library"
short_description: "Generate optimized prompts for GPT-Image2 using reverse-engineered style templates"
default_prompt: "Analyze the user's image request and match it to the best-fitting template from the style library."
The default_prompt value seeds the agent's reasoning before any user‑specific processing begins.
Step‑by‑Step Request Processing Workflow
Step 1: Language Detection
The skill commits to response language parity. It analyzes the user's input to determine Chinese or English, then generates all subsequent output—including prompts, rationales, and constraints—in that language. This rule appears verbatim in SKILL.md: "Detect the user's language and answer in that language."
Step 2: Target Output Identification
The skill classifies the user's desired deliverable into a Category from the style library. Valid categories include UI design, poster, product photography, illustration, scenes, and storytelling. This classification determines which subset of templates the matching algorithm prioritizes.
From SKILL.md: "Identify the user's target output … This determines which Category from the style library to prioritize."
Step 3: Template Matching Hierarchy
The skill applies fixed‑priority selection rules from style-library.md:
- Category — explicit product type or domain
- Visual style tag — descriptive aesthetic keywords
- Scene tag — context, environment, or narrative setting
- Closest example cases — nearest neighbors from >500 reverse‑engineered samples
This ordering guarantees deterministic behavior: a "futuristic product render" request always matches product category templates before considering scene‑based alternatives.
Step 4: Candidate Presentation (Optional Fork)
When multiple templates score equally, the skill pauses for user disambiguation. It returns 2–3 candidates with concise rationales, then awaits selection. This prevents arbitrary prompt construction when user intent remains ambiguous.
Workflow rule: "If several are plausible, present 2‑3 options … and ask the user to choose."
Step 5: Prompt Construction with Structured Blocks
Upon template selection, the skill assembles the final prompt from six explicit blocks defined in SKILL.md:
| Block | Purpose |
|---|---|
| Subject & task | Core entity and action |
| Composition & layout | Framing, perspective, spatial arrangement |
| Visual style & materials | Aesthetic direction, textures, rendering approach |
| Text & label requirements | Copy, typography, readability constraints |
| Aspect ratio & output format | Technical specifications |
| Constraints & negative details | Exclusions, avoided elements, quality guardrails |
This block structure ensures prompts remain complete yet modular—developers can override single blocks without rewriting entire prompts.
Step 6: Output Formatting with Language Defaults
The skill always emits content in this order:
- Copy‑ready prompt first — immediately usable in GPT‑Image2
- Concrete constraints — exact text strings, aspect ratios, readability rules
- Modification offer — explicit yes/no gate for refinement
For Chinese requests, the skill applies Chinese‑specific defaults (full‑width punctuation, Simplified Chinese technical terms, local aspect‑ratio conventions). For English requests, it defaults to ASCII punctuation and imperial/metric agnostic specifications.
Code Example: End‑to‑End Interaction
Below is a representative user interaction demonstrating all processing stages.
User input:
用 gpt-image-2-style-library 技能生成城市生命系统图谱
Skill output:
### Selected Template
**Template:** City life system map
**ID:** scene-storytelling
**Category:** Scenes & Storytelling
**Styles:** Scenes, Illustration
**Scenes:** Story, Social
### Prompt (copy‑ready)
/imagine prompt: 城市生命系统图谱, 俯视视角, 细节丰富的街道与建筑, 霓虹灯光, 未来城市氛围, 4:3, 高分辨率, --ar 4:3 --v 5
### Constraints
- Text: 必须包含 "城市" 与 "系统图谱"。
- Aspect Ratio: 4:3(宽高比)。
- Layout: 采用俯视构图,主体位于画面中心。
- Negative Details: 避免过度写实的阴影、无关的文字标签。
Would you like to modify any part of the prompt? (yes/no)
The output demonstrates: Chinese language parity, category‑driven template selection (Scenes & Storytelling), visual/style tag matching (Illustration, Story), and full block‑structured assembly with copy‑first formatting.
Maintenance and Synchronization Pipeline
The skill remains synchronized with its data source through automated regeneration. The scripts/generate-style-skill.mjs script consumes data/style-library.json and produces references/style-library.md:
# Regenerate reference from source data
npm run generate:skill
This script executes three operations:
- Parses
data/style-library.jsoncontaining >500 GPT‑Image2 cases - Rebuilds
references/style-library.mdwith updated categories, tags, and constraints - Ensures
SKILL.mdreferences remain valid
Developers install the updated skill into local Codex environments via:
npm run install:skill
The package.json in the skill folder defines both scripts, making the maintenance loop reproducible.
Key Source Files and Their Roles
| File | Responsibility |
|---|---|
agents/skills/gpt-image-2-style-library/SKILL.md |
Canonical workflow, selection rules, output formatting, and maintenance instructions |
agents/skills/gpt-image-2-style-library/agents/openai.yaml |
Agent registration metadata for OpenAI‑compatible frameworks |
agents/skills/gpt-image-2-style-library/references/style-library.md |
Human‑readable template reference used during matching |
scripts/generate-style-skill.mjs |
Build script syncing JSON data to markdown reference |
data/style-library.json |
Source‑of‑truth dataset with reverse‑engineered cases |
agents/skills/gpt-image-2-style-library/package.json |
NPM script definitions for generate:skill and install:skill |
Summary
- The agent skill processes user requests through six deterministic stages from language detection to copy‑ready output.
- Template matching follows strict priority: Category → Visual style → Scene → Example cases.
- All behavior is explicitly documented in
SKILL.mdand data‑driven viastyle-library.json. - Language parity is enforced throughout—Chinese inputs yield Chinese prompts, constraints, and rationales.
- Automated regeneration via
generate-style-skill.mjskeeps the skill synchronized with its underlying dataset.
Frequently Asked Questions
How does the skill handle ambiguous user requests?
The skill pauses and presents 2–3 candidate templates with brief rationales, then requires explicit user selection. This prevents arbitrary prompt construction when target output classification yields multiple valid categories or style combinations.
Can I modify the template matching priority?
The matching order—Category, then Visual style, then Scene, then Example cases—is hardcoded in SKILL.md and style-library.md. To change this behavior, fork the repository and edit these files, then regenerate the skill with npm run generate:skill.
What happens when the underlying style data updates?
Running npm run generate:skill executes scripts/generate-style-skill.mjs, which rebuilds references/style-library.md from data/style-library.json. The skill immediately uses updated templates without code changes, then reinstall via npm run install:skill to propagate to your agent 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 →