Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ Generate images after the Markdown is ready, so prompts come from the title, art
- Match the article's overall visual tone.
- Constraints: no text unless explicitly requested, no logos, no watermark, central-safe visual focus.
- Ordinary inline illustrations:
- Default count: 3
- Use 2 for short articles and 4 for long or highly structured articles.
- There is no default image count. Choose zero or more images from the article's actual structure.
- Decide section by section whether the content needs a supporting art image, an infographic, or no image.
- Paths: `imgs/illustration-1.png`, `imgs/illustration-2.png`, etc.
- Place each image after the most relevant major section.
- Match the meaning and emotional style of the nearby paragraphs.
Expand All @@ -107,6 +107,24 @@ Generate images after the Markdown is ready, so prompts come from the title, art
- An infographic's purpose is to replace the corresponding text, not repeat it.
- Remove only the text whose complete meaning is accurately represented by the infographic. Preserve surrounding analysis, caveats, and transitions.
- Treat this as an allowed image-backed structural edit, while preserving the article's meaning.
- Prefer an infographic for dense comparisons, model-selection matrices, timelines, or decision trees when exact values can be represented clearly.
- Do not force every table into an image: retain an HTML-rendered table when exact numbers, multiple columns, or mobile readability make it safer than generated artwork.
- When generating an infographic, paste the complete source block being visualized directly into the image-generation prompt, including its original headings, labels, values, caveats, and explanatory text. Then describe the visual tone, readability, audience, and output format.
- Do not pre-impose a card grid, table, node layout, column structure, or other composition unless the user requests one. Let the image model choose the information architecture from the source content.
- Ask the model to make the source text part of the visual composition, not an afterthought. Inspect every generated label, number, unit, and line break; regenerate with a targeted correction if any content is wrong or unreadable.
- Only use local text overlay as a fallback when the generated text remains unreliable after a targeted regeneration or when the user explicitly asks for deterministic typesetting.

### Image and infographic selection gate

Before generating any inline image, make a short section map:

| Content shape | Preferred treatment |
| --- | --- |
| Atmosphere, concept, narrative transition | Ordinary editorial art |
| Exact comparison, pricing, benchmark, timeline, process, or decision tree | Infographic or HTML table |
| Short list with no visual relationship | No image unless it materially improves comprehension |

The final image count must be justified by the section map. Never add images merely to reach a quota.

Keep all final images under the article's `imgs/` directory. Inspect generated images before use and regenerate any image that does not match the content or shared visual style.

Expand All @@ -125,6 +143,26 @@ After generating images:
- Do not insert the cover image into the body unless the user asks for it.
- For an infographic, replace the corresponding information block with the image link instead of leaving duplicate text.

## Table Rendering Quality Gate

Markdown tables are fragile in the WeChat pipeline. Before rendering:

1. Keep every table row adjacent. Do not leave blank lines between the header, separator, and body rows.
2. Use a valid separator row with the same column count as the header.
3. Do not generate a table by joining every Markdown line with a blank-line separator.
4. Preserve exact numeric values; if a table is converted to an infographic, remove only the fully represented table text.

After preparing the Markdown, run `md-to-wechat.ts` or the API dry-run and inspect the generated HTML:

```bash
$BUN_X "{skillDir}/scripts/md-to-wechat.ts" "post-to-wechat/yyyy-MM-dd/slug/slug.md" \
--theme default --color blue > /tmp/mp-render.json
HTML_PATH=$(node -e 'process.stdout.write(JSON.parse(require("fs").readFileSync("/tmp/mp-render.json","utf8")).htmlPath)')
test "$(rg -o '<table' "$HTML_PATH" | wc -l | tr -d " ")" -eq "<expected table count>"
```

The expected table count is the number of Markdown tables intentionally retained after any infographic replacements. Do not publish if a retained table is rendered as plain pipe-delimited paragraphs or if the count is wrong.

## Publishing Workflow

Load config from these paths in priority order:
Expand Down Expand Up @@ -167,4 +205,11 @@ $BUN_X "{skillDir}/scripts/wechat-api.ts" "post-to-wechat/yyyy-MM-dd/slug.md" \
--dry-run
```

After successful publishing, report the title, account, image count, and that the article was saved as a draft and not mass-sent.
The dry-run must confirm all of the following before publishing:

- The intended number of retained tables appears as HTML `<table>` elements.
- The intended number of inline image placeholders is present.
- The cover path exists and is horizontal.
- No Markdown table contains blank lines between rows.

After successful publishing, report the title, account, image count, retained table count, and that the article was saved as a draft and not mass-sent.