# Detailed Workflow Procedures ## Step 1: Pre-check ### 1.0 Detect & Save Reference Images ⚠️ REQUIRED if images provided | Input Type | Action | |------------|--------| | Image file path provided | Copy to `references/` subdirectory → can use `--ref` | | Image in conversation (no path) | **ASK user for file path** with AskUserQuestion | | User can't provide path | Extract style/palette verbally → append to prompts (NO frontmatter references) | **If user provides file path**: 1. Copy to `references/NN-ref-{slug}.png` 2. Create description `references/NN-ref-{slug}.md`: ```yaml --- ref_id: NN filename: NN-ref-{slug}.png --- [User's description or auto-generated description] ``` 3. Verify files exist, then report: `Reference Images Saved: 01-ref-{slug}.png ✓ (can use --ref)` **If user can't provide path**: 1. Analyze image visually; extract colors, style, composition 2. Create `references/extracted-style.md` with the extracted info 3. Do NOT add `references` to prompt frontmatter — append extracted style/colors to the prompt text instead 4. Report: `Reference Style Extracted (no file): Colors: #E8756D coral, ... Style: ... → Will append to prompt text (not --ref)` --- ### 1.1 Determine Input Type | Input | Output Directory | Next | |-------|------------------|------| | File path | EXTEND.md `default_output_dir` (default: `imgs-subdir`). If not configured, confirm in 1.2. | → 1.2 | | Pasted content | `illustrations/{topic-slug}/` | → 1.4 | **Backup rule for pasted content**: If `source.md` exists in target directory, rename to `source-backup-YYYYMMDD-HHMMSS.md` before saving. ### 1.2-1.4 Configuration (file path input only) Ask ALL needed questions in ONE AskUserQuestion call (max 4). Skip any whose preference exists or doesn't apply: | Question | When to Ask | Options | |----------|-------------|---------| | Output directory | No `default_output_dir` in EXTEND.md | `{article-dir}/imgs/` (Recommended), `{article-dir}/`, `{article-dir}/illustrations/`, `illustrations/{topic-slug}/` | | Existing images | Target dir has `.png/.jpg/.webp` files | `supplement`, `overwrite`, `regenerate` | | Article update | Always (file path input) | `update`, `copy` | `default_output_dir` values → paths: see Output Directory in SKILL.md. ### 1.5 Load Preferences (EXTEND.md) ⛔ BLOCKING If EXTEND.md is not found, complete first-time setup before ANY other question or step (no reference images, content, or type/style questions first). ```bash # macOS, Linux, WSL, Git Bash test -f .baoyu-skills/baoyu-article-illustrator/EXTEND.md && echo "project" test -f "${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-article-illustrator/EXTEND.md" && echo "xdg" test -f "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md" && echo "user" ``` ```powershell # PowerShell (Windows) if (Test-Path .baoyu-skills/baoyu-article-illustrator/EXTEND.md) { "project" } $xdg = if ($env:XDG_CONFIG_HOME) { $env:XDG_CONFIG_HOME } else { "$HOME/.config" } if (Test-Path "$xdg/baoyu-skills/baoyu-article-illustrator/EXTEND.md") { "xdg" } if (Test-Path "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md") { "user" } ``` | Result | Action | |--------|--------| | Found | Read, parse, display summary → Continue | | Not found | ⛔ Run first-time setup ONLY ([config/first-time-setup.md](config/first-time-setup.md)) → save EXTEND.md → continue | **Supports**: Watermark | Preferred type/style | Custom styles | Language | Output directory --- ## Step 2: Setup & Analyze ### 2.1 Analyze Content | Analysis | Description | |----------|-------------| | Content type | Technical / Tutorial / Methodology / Narrative | | Illustration purpose | information / visualization / imagination | | Core arguments | 2-5 main points to visualize (main thesis, key concepts, comparisons, proposed framework) | | Visual opportunities | Positions where illustrations add value | | Recommended type | Based on content signals and purpose | | Recommended density | Based on length and complexity | If the article uses metaphors (e.g., "电锯切西瓜"), do NOT illustrate literally — visualize the **underlying concept**. ### 2.3 Identify Positions **Illustrate**: core arguments (REQUIRED), abstract concepts, data comparisons, processes/workflows. **Do NOT illustrate**: metaphors literally, decorative scenes, generic illustrations. ### 2.4 Analyze Reference Images (if provided in Step 1.0) For each reference: visual characteristics (style, colors, composition), subject, suitable sections, matching types/styles, and a usage recommendation: | Usage | When to Use | |-------|-------------| | `direct` | Reference matches desired output closely | | `style` | Extract visual style characteristics only | | `palette` | Extract color scheme only | --- ## Step 3: Confirm Settings ⚠️ **Do NOT skip.** ONE AskUserQuestion call, max 4 questions. **Q1, Q2, Q3 are ALL REQUIRED** (Q3 skipped only when a preset is chosen). ### Q1: Preset or Type ⚠️ REQUIRED Recommend a preset from [style-presets.md](style-presets.md) "Content Type → Preset Recommendations": - [Recommended preset] — [brief: type + style + why] (Recommended) - [Alternative preset] — [brief] - Or choose type manually: infographic / scene / flowchart / comparison / framework / timeline / mixed **Default**: if Step 2 found no strong content signal, the recommended preset MUST be `hand-drawn-edu` (infographic + sketch-notes + macaron). If the user then picks a type manually without a `preferred_style`, recommend `sketch-notes` first in Q3. Preset picked → skip Q3. Type picked → Q3 REQUIRED. ### Q2: Density ⚠️ REQUIRED - minimal (1-2) - Core concepts only - balanced (3-5) - Major sections - per-section - At least 1 per section/chapter (Recommended) - rich (6+) - Comprehensive coverage ### Q3: Style ⚠️ REQUIRED (skip if preset chosen in Q1) - If EXTEND.md has `preferred_style`: [custom style + brief] (Recommended), top 2 compatible core styles, Other (full Style Gallery) - Otherwise: best compatible core style (Recommended), 2 other compatible core styles, Other (full Style Gallery) Core Styles, gallery, and the Type × Style compatibility matrix: [styles.md](styles.md). In Step 5.1, read `styles/