Skip to content

Add image-gen-rules skill and enforce packaging fidelity + exact output size#1

Open
EclairAikome wants to merge 2 commits into
masterfrom
feat/generate-image-fidelity-size
Open

Add image-gen-rules skill and enforce packaging fidelity + exact output size#1
EclairAikome wants to merge 2 commits into
masterfrom
feat/generate-image-fidelity-size

Conversation

@EclairAikome

@EclairAikome EclairAikome commented May 28, 2026

Copy link
Copy Markdown
Owner

Summary

Hardening + knowledge-capture for the image generation pipeline, surfaced while producing the AminoVITAL "Pre / During / Post" carousel (content plan post #6). Three script fixes plus a new skill that binds the operating rules to the script.

Script changes (scripts/generate-image.mjs)

  • Packaging fidelity — strengthened the product-reference instruction in both the free-quota (codex relay) and API (images.edit) paths to require image-to-image / edit mode and explicitly forbid redrawing, re-typesetting, translating, or rearranging any text/graphic on the package. Previously the model silently redrew packaging (wrong amino-acid mg figures, shuffled callouts).
  • Exact output size — codex/image_gen ignores the requested dimensions, so files came out at assorted sizes (1122x1402, 1003x1568, …). Free-quota output is now center-cropped via sharp (fit: cover, ratio-preserving, no distortion) to the exact target size (1088x1360) before saving. (Size normalization is free-quota only; API relies on OpenAI's size param.)

New skill bound to the script

  • scripts/SKILL.md (image-gen-rules) — captures the workflow, style, HSA-compliance rules, and the recurring codex/gpt-image pitfalls learned over multiple sessions:
    • workflow: one image at a time, one SKU per image, never generate the logo, communicate in Chinese;
    • style: AV-HK "小清新" placed-product look, varied compositions, gold/white type + PRE/DURING/POST timeline;
    • HSA: "amino acid nutrition / fuel / supports the body", no efficacy/recovery claims;
    • pitfalls + fixes: auto-logo creep, gravity/sloped-table, picture-in-picture nesting, and the aspect-ratio ⇄ crop ⇄ stretch chain.
  • CLAUDE.md — mandatory clause: the skill MUST be read/followed before running or reasoning about scripts/generate-image.mjs, binding the two together (loaded every session, so it is enforced project-wide).

Notes for reviewer

  • Scope is limited to scripts/generate-image.mjs, scripts/SKILL.md, and CLAUDE.md; unrelated uncommitted asset changes in the working tree are intentionally excluded.
  • Size normalization uses fit: cover (center crop) to avoid distortion; near-4:5 outputs are essentially lossless.

🤖 Generated with Claude Code

EclairAikome and others added 2 commits May 29, 2026 00:20
- Strengthen the product-reference instruction in BOTH free-quota and API
  paths: require image-to-image / edit mode and forbid redrawing,
  re-typesetting, translating, or rearranging any text on the package, so
  generated packaging is taken from the original reference photo.
- Normalize free-quota output to the exact target size: codex/image_gen
  ignores the requested dimensions, so center-crop the saved file to the
  target (e.g. 1088x1360) via sharp.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- scripts/SKILL.md: a skill capturing the workflow, style, HSA-compliance and
  codex/gpt-image pitfalls (auto-logo, gravity, picture-in-picture nesting,
  aspect-ratio/crop/stretch) learned while building the AminoVITAL carousel.
- CLAUDE.md: mandatory clause requiring the skill be read/followed before
  running or reasoning about scripts/generate-image.mjs, binding the two.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@EclairAikome EclairAikome changed the title Enforce packaging fidelity and exact output size in generate-image Add image-gen-rules skill and enforce packaging fidelity + exact output size May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant