---
name: delivery-preflight
description: "Use this before delivering (especially before saying 'done' or 'sending it to you') to run one machine verification pass: non-compliant filenames, size mismatches, banned words, missing delivery notes, INDEX not updated, 0-byte files, duplicate placement. Also use it when the user complains 'why is the size wrong again', 'the naming is a mess', 'you said done but files are missing'."
---

> Original skill · commissioned by the user · English edition, 2026-11-12

# Pre-Delivery Machine Verification

You cannot see the difference between 900×383 and 901×383 by eye, and you cannot remember whether INDEX was updated. **Hand this gate to a script**; it does exactly one thing: turn "I thought I had shipped it" into a PASS/FAIL table.

## When to use

- A batch of assets is finished and you are about to reply "done"
- The user says "send it to me" or "can this batch go out"
- The last delivery was caught on size / naming / missing-file problems, and this is the re-check after rework
- The platform directory keeps filling up and you suspect duplicate placement

Do not use it for: a small edit to a single file (just look at it), pure text answers.

## One command

```powershell
$S = "<SKILL_DIR>\scripts"
python $S\preflight.py --dir "<WORKSPACE>\wechat-official-account\<YYYYMMDD>_<batch-topic>" `
                        --kind wechat --index "<WORKSPACE>\wechat-official-account\INDEX.md"
```

Exit codes: `0` pass (may carry WARN) | `1` has a FAIL → **you may not say it is complete**.

`--kind`: `wechat` (900×383 / 500×500 / 1080×1440) | `xiaohongshu` (1080×1440) | `douyin` (cover 1080×1920) | `generic` (checks naming and file hygiene only).
`--json` gives machine-readable output, convenient for wiring into other scripts.

## What it checks

| Code | What it checks | Typical failure |
|---|---|---|
| `NAME` | `YYYYMMDD_<topic>_<purpose>[_vN].ext` | `cover.png`, `untitled-1.png` |
| `BANNED` | final version / final / new / latest / copy | "really-final.png" |
| `SIZE` | Matches the size against the purpose keyword | A square cover delivered at 400×400 when 500×500 is required |
| `NOTE` | `00-delivery-notes.md` exists and is >50 characters | Only images left, no notes |
| `INDEX` | The platform `INDEX.md` is newer than the deliverables | Assets delivered, index never updated |
| `ZERO` | 0-byte files | An empty image left behind by an interrupted render |
| `DUP` | The same filename also present in the parent directory | One batch of assets, one copy in each place |

## Hard rules

1. **A FAIL may not be dismissed as "a minor issue".** Either fix it, or write in the delivery notes why it is not fixed and who approved that.
2. Size matching relies on the **purpose keyword in the filename**; when the naming is wrong `SIZE` is skipped — so a `NAME` FAIL has the highest priority.
3. After fixing you must **re-run** and paste the PASS output as delivery evidence; do not just say "fixed" in words.
4. This script checks spec compliance, not looks. For looks use `visual-quality-gate`; for clean typesetting use `workspace-hygiene`.

## Common mistakes

| What people do | Consequence |
|---|---|
| Run it once and never re-run after fixing | Fixing A breaks B and the delivery carries the new error |
| Use `--kind generic` to save effort | The size check never runs, so nothing was verified |
| Judge whether INDEX was updated by the newest timestamp in the directory | Timestamps can be altered by copying/extracting; the script compares mtime and still has blind spots — scan the INDEX content by eye |
| Treat WARN as FAIL and tear everything down | WARN is a hint (e.g. duplicate placement); handle it as needed |

## Acceptance

```powershell
python $S\preflight.py --dir <delivery-dir> --kind <platform> --index <INDEX.md>
# expected last line: Result: PASS (FAIL 0 / WARN n)
```
