This skill analyzes an article and inserts inline figure prompts or generates all figures, returning ready-to-use references for quick publishing.
npx playbooks add skill invalidandnull/article-figure-spot-skill --skill skills
Finds all positions in an article that benefit from a figure, then either outputs the article with inline prompt placeholders (author generates and inserts images later) or generates all figures in one run using the built-in image script and saves them so the author can insert image links.
Article content can be provided in either way:
/article-figure-spot path/to/article.md).When only pasted text is given, infer options from context or ask once for --prompts-only vs --generate and density if ambiguous.
Scripts live in the scripts/ subdirectory of this skill.
${SKILL_DIR}/scripts/generate-image.mjs| Script | Purpose |
|--------|---------|
| scripts/generate-image.mjs | Calls OpenAI image API; reads prompt from file(s), writes image to given path. Runs with Node (no Bun). |
Invocation (generate mode, one figure):
node ${SKILL_DIR}/scripts/generate-image.mjs --promptfiles prompts/NN-type-slug.md --image figure-spot/{topic-slug}/NN-type-slug.png --ar 16:9
Environment: The script needs OPENAI_API_KEY. It loads .env from the current working directory and from the skill directory (SKILL_DIR). Optional: OPENAI_BASE_URL, OPENAI_IMAGE_MODEL (default in script).
| Mode | Invocation | Result |
|------|------------|--------|
| Prompts only | --prompts-only or default when no image-gen available | Article with inline prompt blocks at each spot; author runs image gen per prompt and inserts. |
| Generate all | --generate | Prompts written to files, image-generation command run for each; images saved; article emitted with image paths ready to paste. |
# Prompts only: output article with inline figure prompts (no image gen)
/article-figure-spot path/to/article.md
/article-figure-spot path/to/article.md --prompts-only
# Generate all: spot positions, create prompts, run image gen, save images
/article-figure-spot path/to/article.md --generate
# Optional: control density and output dir
/article-figure-spot article.md --generate --density rich --out-dir figures
| Option | Description |
|--------|-------------|
| --prompts-only | Only insert prompt placeholders; do not run image generation. |
| --generate | Run image generation for every spotted position and save images. |
| --density <level> | sparse (2–3 figures), medium (4–6), rich (7+). Default: medium. |
| --out-dir <dir> | Root directory for prompt files and generated images. Default: figure-spot/{topic-slug}/. |
| --lang <code> | Language for prompts and alt text (e.g. en, zh). Default: detect from article. |
Copy and track:
Figure Spot Progress:
- [ ] Step 1: Load article and analyze structure
- [ ] Step 2: Identify figure positions → placement list
- [ ] Step 3: Confirm positions with user (optional but recommended)
- [ ] Step 4a (prompts-only): Write output article with inline prompts
- [ ] Step 4b (generate): Create prompt files → run image gen → save images → write output article with image refs
- [ ] Step 5: Summary and insert instructions
figure-spot/{topic-slug}/source.md for reference.Use rules in [references/position-rules.md](references/position-rules.md):
For each position record:
Respect --density: sparse 2–3, medium 4–6, rich 7+ figures.
Present the placement list:
<!-- FIGURE N: [anchor description] -->
<!-- PROMPT: [full image-generation prompt in 1–3 sentences] -->
<!-- FILE: NN-{type}-{slug}.png -->
<!-- END FIGURE -->
PROMPT and FILE lines to run their image-generation tool and then replace the block with .Prompt content should follow [references/prompt-guide.md](references/prompt-guide.md) (concise, scene/layout, aspect ratio).
figure-spot/{topic-slug}/ or --out-dir).prompts/NN-{type}-{slug}.md, with the full image-generation prompt (see [references/prompt-guide.md](references/prompt-guide.md)).node ${SKILL_DIR}/scripts/generate-image.mjs --promptfiles <path-to-prompt.md> --image <path-to-output.png> --ar 16:9
Use the same aspect ratio for all article figures (e.g. 16:9) unless the user asks otherwise.
.Image generation is built-in: The skill uses its own scripts/generate-image.mjs, which calls the OpenAI image API (run with Node). The user must set OPENAI_API_KEY (in .env next to the skill or in the current directory) for --generate to work.
结束时必须向用户提供插图与文中插入位置对照,让用户明确「哪张图插在文章哪里」:
| 图片文件 | 文中插入位置 |
|----------|----------------|
| 01-concept-three-layers.png | 在 ## 复盘的三个层次 这一节段落后 |
| 02-process-four-steps.png | 在段首为「推荐流程(四步)」的段落之后 |
article-with-figures.md 路径。Default layout under figure-spot/{topic-slug}/:
figure-spot/{topic-slug}/
├── source.md # Copy of or link to source article
├── placement.md # Table: index, anchor, role, prompt summary, filename
├── prompts/
│ ├── 01-concept-xxx.md
│ └── 02-process-yyy.md
├── 01-concept-xxx.png
├── 02-process-yyy.png
└── article-with-figures.md # (generate mode) article with image refs inserted
Slug: 2–4 words from article topic, kebab-case. If directory exists, append timestamp.
Details: [references/prompt-guide.md](references/prompt-guide.md).
| File | Content |
|------|---------|
| [references/position-rules.md](references/position-rules.md) | What to illustrate and what to skip. |
| [references/prompt-guide.md](references/prompt-guide.md) | How to write each figure prompt. |
| [references/output-layout.md](references/output-layout.md) | Dir structure and file naming. |
scripts/generate-image.mjs (OpenAI image API, run with Node). Set OPENAI_API_KEY in .env in the skill directory or cwd.Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.