# History Comics Produce

> Orchestrate the full history-comics production pipeline: author bilingual story files with history-comics-content, then generate panel images through topview-generate / topview-mcp, save them under the comic folder, and keep the website cover in sync. Use when the user asks to produce, 出图, generate comic images, run the full pipeline, or turn a prompt.md into finished art.

- Skill: `nealst/history-comics-produce` (Agent Skill)
- Install (CLI): `npx skillmds@latest add nealst/history-comics-produce`
- Raw SKILL.md: https://api.skillmd.com/api/skills/nealst/history-comics-produce/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: nealst (https://skillmd.com/u/nealst)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/nealst/history-comics-produce

---


# History Comics — Produce (Content + Topview)

This skill is the **orchestrator**. It does not replace the other two skills.

| Skill | Owns |
| --- | --- |
| `history-comics-content` | `meta.json`, `story.md`, `story.en.md`, `prompt.md` |
| `topview-generate` | Topview MCP auth, boards, credits, image submit/poll/upload |
| `history-comics-produce` | Sequencing, file layout, character-sheet lock, QA, local save |

Read both sibling skills before executing. Never invent Topview REST calls or
run `topview-generate/scripts/*.py`. Use host MCP tools from `topview-mcp`
(`topview_*`, `ta_*`) exactly as `topview-generate` specifies.

Do **not** use this skill for Amazon / Shopee / TikTok Shop / YouTube research.

---

## Target layout

Every produced comic must end as:

```
content/<country>/<period>/<slug>/
├── meta.json
├── story.md
├── story.en.md
├── prompt.md
├── images/
│   ├── 00-character-sheet.png
│   ├── 01.png
│   ├── 02.png
│   └── manifest.json
└── comic.png                 # website cover = panel 01
```

`comic.png` stays at the comic root because the current site reads
`/content/.../comic.png` and `hasImage` is true when any image file exists
in the comic directory.

---

## When to run which phase

| User ask | Phase A content | Phase B images |
| --- | --- | --- |
| “写这个典故 / 生成条目 / scaffold” | Yes | No, unless they also ask to 出图 |
| “出图 / generate images / produce the comic” | Only if the four files are missing or stale | Yes |
| “完整做一遍 / full pipeline” | Yes | Yes |

If `prompt.md` is missing or still a legacy one-paragraph stub, run Phase A
first. Do not invent image prompts ad hoc.

---

## Phase A — Author the entry

Follow `history-comics-content` in full. Stop after its validation checklist
passes. Then continue to Phase B only when the user asked for images or a
full pipeline.

---

## Phase B — Generate images with Topview

Follow `topview-generate` Common Agent Workflow for every MCP action:
connect → auth if needed → pick/create board → live generation config →
submit → poll the same `taskId` → return URLs.

### B0 — Preconditions

1. Confirm `topview-mcp` is connected. If discovery fails or tools are
   missing, invoke host `mcp_auth`. If it returns a URL, send that exact URL
   and wait for the user to confirm sign-in. Do not switch to another image
   API.
2. Read `prompt.md`. Extract, in order:
   - every fenced `English Prompt (Copy below)` block (these are the only
     prompts that may be submitted);
   - the character English descriptors from `分镜规划`;
   - the count-sensitive prop ledger.
3. Call `topview_get_generation_config` with `type=image` for both
   `text_to_image` and `image_edit`. Prefer **GPT Image 2** when present
   (best bilingual text). Use `models[].submitModel` exactly.
4. Call `topview_get_credit` before the first chargeable submit. Present
   one plan: panel count, model, `16:9`, resolution (`2K` if supported),
   estimated credits, and whether later panels may auto-proceed. “Just do
   it” / “直接出图” counts as auto-proceed for the rest of this comic.
5. Reuse one board for the comic. Prefer an existing board named
   `history-comics / <中文标题>`; otherwise `topview_create_board` with
   that name.

### B1 — Character sheet (required lock)

Before any story panel, generate **one** character-sheet image.

- `taskType`: `text_to_image`
- Prompt: same global style + period palette as `prompt.md`; all named
  characters standing in a row, full-body, neutral stance, no speech
  balloons, no extra extras, each with the exact bilingual name label from
  the Series Bible (`晏子 / Yan Zi`). No story action.
- `aspectRatio`: `16:9` (or the closest live-config value)
- `generateCount`: 1

Poll to `success`, download the image to
`images/00-character-sheet.png`, then upload it with the Topview upload
flow (`ta_upload_credential` → PUT bytes → `ta_upload_check_file`). Keep
the resulting `fileId` as `characterSheetFileId` for every later panel.

Do not skip the sheet. Text-only character descriptions are not enough for
cross-panel consistency.

### B2 — Panels in order

For panel `N` of `1..K`:

1. Take the Nth English Prompt **verbatim**. Do not shorten it.
2. Submit `image_edit` (not plain text-to-image) with:
   - `prompt` = that English Prompt
   - `inputImageFileIds` = `[characterSheetFileId]` plus the previous
     accepted panel `fileId` when `N > 1`
   - `aspectRatio`: `16:9`
   - `generateCount`: 1
   - same `boardId` and model as the sheet
3. Poll `topview_query_task` with the same `taskType` and `taskId` until
   `success` or `fail`. Timeouts are not failures; keep polling.
4. QA the result against the panel's Chinese description and prop ledger
   (character colors, peach/sword counts, no gore, bilingual text present).
   One `image_edit` revision is allowed per panel if a ledger item is
   wrong. After a second failure, stop that panel, keep the last URL, and
   continue.
5. Download the accepted image to `images/0N.png` (`01.png`, `02.png`, …).
   Upload it if a later panel will reference it and you do not already
   have a reusable `fileId`.
6. Independent panels must still run **in order**. Do not parallelize
   story panels; later frames depend on earlier `fileId`s.

If live config has no `image_edit`, fall back to `text_to_image` with the
same verbatim prompt, and say so in the handoff. Still generate the
character sheet first so a later edit pass can lock likeness.

### B3 — Save locally

Write `images/manifest.json`:

```json
{
  "boardId": "",
  "model": "",
  "generatedAt": "YYYY-MM-DD",
  "characterSheet": {
    "local": "images/00-character-sheet.png",
    "fileId": "",
    "taskId": "",
    "url": ""
  },
  "panels": [
    {
      "index": 1,
      "local": "images/01.png",
      "fileId": "",
      "taskId": "",
      "url": ""
    }
  ]
}
```

Copy `images/01.png` to `comic.png` at the comic root (website cover).
Do not overwrite an existing `comic.png` unless this run produced a new
panel 01.

After files are on disk, tell the user to run `cd web && npm run build:content`
if they want the site index to pick up `hasImage`.

### B4 — Handoff text

Keep the user-facing summary short. For each panel list the local path and
the download URL. Include the board link only when both `boardId` and
`boardTaskId` are known:

`https://www.topview.ai/board/{boardId}?boardResultId={boardTaskId}`

---

## Hard rules

- Do not submit a shortened or rewritten English Prompt.
- Do not generate gore, weapon-to-body contact, corpses, or scary close-ups.
  If Topview returns safety code `6001`, revise only the unsafe clause and
  retry once.
- Do not resubmit a still-running task.
- Do not route Topview creative tools through `get_tool_schema` / `call_tool`.
- Do not modify the official `topview-generate` skill. If its MCP sequence
  changes, follow that skill, not this file's examples.

## Current site gap

The website still shows a **single** `comic.png`. Multi-panel files in
`images/` are the source of truth for production. Do not change `web/` from
this skill unless the user explicitly asks to render a panel gallery.

