Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Analyze articles and generate contextual illustrations using Type × Style two-dimension approach across multiple AI providers.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/workflow.md
1# Detailed Workflow Procedures23## Step 1: Pre-check45### 1.0 Detect & Save Reference Images ⚠️ REQUIRED if images provided67Check if user provided reference images. Handle based on input type:89| Input Type | Action |10|------------|--------|11| Image file path provided | Copy to `references/` subdirectory → can use `--ref` |12| Image in conversation (no path) | **ASK user for file path** with AskUserQuestion |13| User can't provide path | Extract style/palette verbally → append to prompts (NO frontmatter references) |1415**CRITICAL**: Only add `references` to prompt frontmatter if files are ACTUALLY SAVED to `references/` directory.1617**If user provides file path**:181. Copy to `references/NN-ref-{slug}.png`192. Create description: `references/NN-ref-{slug}.md`203. Verify files exist before proceeding2122**If user can't provide path** (extracted verbally):231. Analyze image visually, extract: colors, style, composition242. Create `references/extracted-style.md` with extracted info253. DO NOT add `references` to prompt frontmatter264. Instead, append extracted style/colors directly to prompt text2728**Description File Format** (only when file saved):29```yaml30---31ref_id: NN32filename: NN-ref-{slug}.png33---34[User's description or auto-generated description]35```3637**Verification** (only for saved files):38```39Reference Images Saved:40- 01-ref-{slug}.png ✓ (can use --ref)41- 02-ref-{slug}.png ✓ (can use --ref)42```4344**Or for extracted style**:45```46Reference Style Extracted (no file):47- Colors: #E8756D coral, #7ECFC0 mint...48- Style: minimal flat vector, clean lines...49→ Will append to prompt text (not --ref)50```5152---5354### 1.1 Determine Input Type5556| Input | Output Directory | Next |57|-------|------------------|------|58| File path | EXTEND.md `default_output_dir` (default: `imgs-subdir`). If not configured, confirm in 1.2. | → 1.2 |59| Pasted content | `illustrations/{topic-slug}/` | → 1.4 |6061**Backup rule for pasted content**: If `source.md` exists in target directory, rename to `source-backup-YYYYMMDD-HHMMSS.md` before saving.6263### 1.2-1.4 Configuration (file path input only)6465Check preferences and existing state, then ask ALL needed questions in ONE AskUserQuestion call (max 4 questions).6667**Questions to include** (skip if preference exists or not applicable):6869| Question | When to Ask | Options |70|----------|-------------|---------|71| Output directory | No `default_output_dir` in EXTEND.md | `{article-dir}/imgs/` (Recommended), `{article-dir}/`, `{article-dir}/illustrations/`, `illustrations/{topic-slug}/` |72| Existing images | Target dir has `.png/.jpg/.webp` files | `supplement`, `overwrite`, `regenerate` |73| Article update | Always (file path input) | `update`, `copy` |7475**Preference Values** (if configured, skip asking):7677| `default_output_dir` | Path |78|----------------------|------|79| `same-dir` | `{article-dir}/` |80| `imgs-subdir` | `{article-dir}/imgs/` |81| `illustrations-subdir` | `{article-dir}/illustrations/` |82| `independent` | `illustrations/{topic-slug}/` |8384### 1.5 Load Preferences (EXTEND.md) ⛔ BLOCKING8586**CRITICAL**: If EXTEND.md not found, MUST complete first-time setup before ANY other questions or steps. Do NOT proceed to reference images, do NOT ask about content, do NOT ask about type/style — ONLY complete the preferences setup first.8788```bash89# macOS, Linux, WSL, Git Bash90test -f .baoyu-skills/baoyu-article-illustrator/EXTEND.md && echo "project"91test -f "${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-article-illustrator/EXTEND.md" && echo "xdg"92test -f "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md" && echo "user"93```9495```powershell96# PowerShell (Windows)97if (Test-Path .baoyu-skills/baoyu-article-illustrator/EXTEND.md) { "project" }98$xdg = if ($env:XDG_CONFIG_HOME) { $env:XDG_CONFIG_HOME } else { "$HOME/.config" }99if (Test-Path "$xdg/baoyu-skills/baoyu-article-illustrator/EXTEND.md") { "xdg" }100if (Test-Path "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md") { "user" }101```102103| Result | Action |104|--------|--------|105| Found | Read, parse, display summary → Continue |106| Not found | ⛔ **BLOCKING**: Run first-time setup ONLY ([config/first-time-setup.md](config/first-time-setup.md)) → Complete and save EXTEND.md → Then continue |107108**Supports**: Watermark | Preferred type/style | Custom styles | Language | Output directory109110---111112## Step 2: Setup & Analyze113114### 2.1 Analyze Content115116| Analysis | Description |117|----------|-------------|118| Content type | Technical / Tutorial / Methodology / Narrative |119| Illustration purpose | information / visualization / imagination |120| Core arguments | 2-5 main points to visualize |121| Visual opportunities | Positions where illustrations add value |122| Recommended type | Based on content signals and purpose |123| Recommended density | Based on length and complexity |124125### 2.2 Extract Core Arguments126127- Main thesis128- Key concepts reader needs129- Comparisons/contrasts130- Framework/model proposed131132**CRITICAL**: If article uses metaphors (e.g., "电锯切西瓜"), do NOT illustrate literally. Visualize the **underlying concept**.133134### 2.3 Identify Positions135136**Illustrate**:137- Core arguments (REQUIRED)138- Abstract concepts139- Data comparisons140- Processes, workflows141142**Do NOT Illustrate**:143- Metaphors literally144- Decorative scenes145- Generic illustrations146147### 2.4 Analyze Reference Images (if provided in Step 1.0)148149For each reference image:150151| Analysis | Description |152|----------|-------------|153| Visual characteristics | Style, colors, composition |154| Content/subject | What the reference depicts |155| Suitable positions | Which sections match this reference |156| Style match | Which illustration types/styles align |157| Usage recommendation | `direct` / `style` / `palette` |158159| Usage | When to Use |160|-------|-------------|161| `direct` | Reference matches desired output closely |162| `style` | Extract visual style characteristics only |163| `palette` | Extract color scheme only |164165---166167## Step 3: Confirm Settings ⚠️168169**Do NOT skip.** Use ONE AskUserQuestion call with max 4 questions. **Q1, Q2, Q3 are ALL REQUIRED.**170171### Q1: Preset or Type ⚠️ REQUIRED172173Based on Step 2 content analysis, recommend a preset first (sets both type & style). Look up [style-presets.md](style-presets.md) "Content Type → Preset Recommendations" table.174175- [Recommended preset] — [brief: type + style + why] (Recommended)176- [Alternative preset] — [brief]177- Or choose type manually: infographic / scene / flowchart / comparison / framework / timeline / mixed178179**Default**: if Step 2 found no strong content signal, the recommended preset MUST be `hand-drawn-edu` (infographic + sketch-notes + macaron — warm cream paper, black hand-drawn lines, soft pastel blocks). This is the universal fallback.180181**If user picks a preset → skip Q3** (type & style both resolved).182**If user picks a type → Q3 is REQUIRED.**183184### Q2: Density ⚠️ REQUIRED - DO NOT SKIP185- minimal (1-2) - Core concepts only186- balanced (3-5) - Major sections187- per-section - At least 1 per section/chapter (Recommended)188- rich (6+) - Comprehensive coverage189190### Q3: Style ⚠️ REQUIRED (skip if preset chosen in Q1)191192If EXTEND.md has `preferred_style`:193- [Custom style name + brief description] (Recommended)194- [Top compatible core style 1]195- [Top compatible core style 2]196- Other (see full Style Gallery)197198If no `preferred_style` (present Core Styles first):199- [Best compatible core style] (Recommended)200- [Other compatible core style 1]201- [Other compatible core style 2]202- Other (see full Style Gallery)203204**Core Styles** (simplified selection):205206| Core Style | Maps To | Best For |207|------------|---------|----------|208| `hand-drawn` | sketch-notes | **Default.** Warm cream paper, black hand-drawn lines, pastel blocks — educational infographics, concept explainers, onboarding, general knowledge articles |209| `minimal-flat` | notion | General, knowledge sharing, SaaS |210| `sci-fi` | blueprint | AI, frontier tech, system design |211| `editorial` | editorial | Processes, data, journalism |212| `scene` | warm/watercolor | Narratives, emotional, lifestyle |213| `poster` | screen-print | Opinion, editorial, cultural, cinematic |214215**Default recommendation**: when Step 2 surfaces no strong content signal, recommend **`hand-drawn-edu`** preset (→ infographic + sketch-notes + macaron) as the primary option in Q1. When the user picks a type manually without a preferred_style, recommend `sketch-notes` first in Q3.216217Style selection based on Type × Style compatibility matrix (styles.md).218**In Step 5.1**, read `styles/<style>.md` for visual elements and rendering rules.219220### Q4: Palette (optional)221222If preset did not specify a palette, and the user may benefit from a palette override, offer available palettes:223224- Default (use style's built-in colors) (Recommended)225- `macaron` — soft pastel blocks on warm cream226- `warm` — warm earth tones, no cool colors227- `neon` — vibrant neon on dark backgrounds228229**Skip if**: preset already resolved palette, or `preferred_palette` set in EXTEND.md.230231See Palette Gallery in [styles.md](styles.md#palette-gallery) and full specs in `palettes/<palette>.md`.232233### Q5: Image Text Language ⚠️ REQUIRED when article language ≠ EXTEND.md `language`234235Detect article language from content. If different from EXTEND.md `language` setting, MUST ask:236- Article language (match article content) (Recommended)237- EXTEND.md language (user's general preference)238239**Skip only if**: Article language matches EXTEND.md `language`, or EXTEND.md has no `language` setting.240241### Display Reference Usage (if references detected in Step 1.0)242243When presenting outline preview to user, show reference assignments:244245```246Reference Images:247| Ref | Filename | Recommended Usage |248|-----|----------|-------------------|249| 01 | 01-ref-diagram.png | direct → Illustration 1, 3 |250| 02 | 02-ref-chart.png | palette → Illustration 2 |251```252253---254255## Step 4: Generate Outline256257Save as `{output-dir}/outline.md` (all paths below are relative to the output directory determined in Step 1.1/1.2):258259```yaml260---261type: infographic262density: balanced263style: blueprint264image_count: 4265references: # Only if references provided266- ref_id: 01267filename: 01-ref-diagram.png268description: "Technical diagram showing system architecture"269- ref_id: 02270filename: 02-ref-chart.png271description: "Color chart with brand palette"272---273274## Illustration 1275276**Position**: [section] / [paragraph]277**Purpose**: [why this helps]278**Visual Content**: [what to show]279**Type Application**: [how type applies]280**References**: [01] # Optional: list ref_ids used281**Reference Usage**: direct # direct | style | palette282**Filename**: 01-infographic-concept-name.png283284## Illustration 2285...286```287288**Requirements**:289- Each position justified by content needs290- Type applied consistently291- Style reflected in descriptions292- Count matches density293- References assigned based on Step 2.4 analysis294295---296297## Step 5: Generate Images298299### 5.1 Create Prompts ⛔ BLOCKING300301**Every illustration MUST have a saved prompt file before generation begins. DO NOT skip this step.**302303For each illustration in the outline:3043051. **Create prompt file**: `{output-dir}/prompts/NN-{type}-{slug}.md`3062. **Include YAML frontmatter**:307```yaml308---309illustration_id: 01310type: infographic311style: custom-flat-vector312---313```3143. **Load style specs**: Read `styles/<style>.md` for visual elements, style rules, and rendering instructions3154. **Load palette specs** (if palette specified): Read `palettes/<palette>.md` for colors and background. Palette colors **replace** the style's default Color Palette. If no palette specified, use the style's built-in colors.3165. **Follow type-specific template** from [prompt-construction.md](prompt-construction.md), using rendering from style + colors from palette (or style default)3176. **Prompt quality requirements** (all REQUIRED):318- `Layout`: Describe overall composition (grid / radial / hierarchical / left-right / top-down)319- `ZONES`: Describe each visual area with specific content, not vague descriptions320- `LABELS`: Use **actual numbers, terms, metrics, quotes from the article** — NOT generic placeholders321- `COLORS`: Specify hex codes from palette (or style default) with semantic meaning322- `STYLE`: Describe line treatment, texture, mood, character rendering per style rules323- `ASPECT`: Specify ratio (e.g., `16:9`)3247. **Apply defaults**: composition requirements, character rendering, text guidelines, watermark3258. **Backup rule**: If prompt file exists, rename to `prompts/NN-{type}-{slug}-backup-YYYYMMDD-HHMMSS.md`326327**Verification** ⛔: Before proceeding to 5.2, confirm ALL prompt files exist:328```329Prompt Files:330- prompts/01-infographic-overview.md ✓331- prompts/02-infographic-distillation.md ✓332...333```334335**DO NOT** pass ad-hoc inline text to `--prompt` without first saving prompt files. The generation command should either use `--promptfiles prompts/NN-{type}-{slug}.md` or read the saved file content for `--prompt`.336337**Execution choice**:338- If multiple illustrations already have saved prompt files and the task is now plain generation, use batch generation by default.339- Prefer the chosen backend's native batch / multi-task interface when available.340- If the backend has no native batch interface but the runtime can issue parallel tool calls, dispatch up to `generation_batch_size` tasks at a time. Default: `4`. The current user request overrides EXTEND.md.341- Generate sequentially only when neither backend batch nor runtime parallel calls are available.342- Use subagents only when each illustration still needs separate prompt rewriting, style exploration, or other per-image reasoning before generation. Do not use subagents just to parallelize rendering.343344**CRITICAL - References in Frontmatter**:345- Only add `references` field if files ACTUALLY EXIST in `references/` directory346- If style/palette was extracted verbally (no file), append info to prompt BODY instead347- Before writing frontmatter, verify: `test -f references/NN-ref-{slug}.png`348349### 5.2 Select Generation Skill350351Follow the `## Image Generation Tools` rule at the top of `SKILL.md`. Concretely:352353- If `imagegen` is in your available-skills list (Codex), use it — invoke via the `Skill` tool with `skill: "imagegen"`.354- Else if the EXTEND.md pin is available, use it.355- Else if exactly one non-native backend is installed, use it.356- Else, ask the user.357358**Do not generate SVG, HTML, or any code-based vector as a substitute for the raster image.** If no raster backend can be resolved, ask the user how to proceed.359360### 5.3 Process References ⚠️ REQUIRED if references saved in Step 1.0361362**DO NOT SKIP if user provided reference images.** For each illustration with references:3633641. **VERIFY files exist first**:365```bash366test -f references/NN-ref-{slug}.png && echo "exists" || echo "MISSING"367```368- If file MISSING but in frontmatter → ERROR, fix frontmatter or remove references field369- If file exists → proceed with processing3703712. Read prompt frontmatter for reference info3723. Process based on usage type:373374| Usage | Action | Example |375|-------|--------|---------|376| `direct` | Add reference path to `--ref` parameter | `--ref references/01-ref-brand.png` |377| `style` | Analyze reference, append style traits to prompt | "Style: clean lines, gradient backgrounds..." |378| `palette` | Extract colors from reference, append to prompt | "Colors: #E8756D coral, #7ECFC0 mint..." |3793804. Check image generation skill capability:381382| Skill Supports `--ref` | Action |383|------------------------|--------|384| Yes (e.g., baoyu-image-gen with Google) | Pass reference images via `--ref` |385| No | Convert to text description, append to prompt |386387**Verification**: Before generating, confirm reference processing:388```389Reference Processing:390- Illustration 1: using 01-ref-brand.png (direct) ✓391- Illustration 2: extracted palette from 02-ref-style.png ✓392```393394### 5.4 Apply Watermark (if enabled)395396Add: `Include a subtle watermark "[content]" at [position].`397398### 5.5 Generate3994001. Build a generation task list from saved prompt files:401- `prompt_file`: `{output-dir}/prompts/NN-{type}-{slug}.md`402- `output_file`: `{output-dir}/NN-{type}-{slug}.png`403- `aspect_ratio`: from prompt frontmatter or prompt body404- `refs`: only verified `direct` references from prompt frontmatter4052. **Backup rule**: Before dispatching a task, if its output image already exists, rename it to `NN-{type}-{slug}-backup-YYYYMMDD-HHMMSS.{ext}`.4063. Dispatch tasks in batches:407- Native batch backend: send all eligible tasks, or chunks of `generation_batch_size` if the backend has a practical limit.408- Runtime parallel calls: issue up to `generation_batch_size` image calls concurrently, then continue with the next chunk.409- Sequential fallback: process one task at a time.4104. After each completed task, record: "Generated X/N: filename".4115. On failure: retry the failed task once from the same saved prompt file. Keep successful outputs and continue.412413---414415## Step 6: Finalize416417### 6.1 Update Article418419Insert after corresponding paragraph, using path relative to article file:420421| `default_output_dir` | Insert Path |422|----------------------|-------------|423| `imgs-subdir` | `` |424| `same-dir` | `` |425| `illustrations-subdir` | `` |426| `independent` | `` (relative to cwd) |427428Alt text: concise description in article's language.429430### 6.2 Output Summary431432```433Article Illustration Complete!434435Article: [path]436Type: [type] | Density: [level] | Style: [style]437Location: [directory]438Images: X/N generated439440Positions:441- 01-xxx.png → After "[Section]"442- 02-yyy.png → After "[Section]"443444[If failures]445Failed:446- NN-zzz.png: [reason]447```448