← All craftbooks

Thumbnail Generator

Media: imagesevalv1.0.0released 2026-06-05workflow: build-loop

Derive a consistent set of thumbnails or responsive size-variants from a folder of source images — square crops for grids, srcset widths for the web, smart-cropped to keep the subject centered — and emit them with predictable names. Scope the target sizes, crop strategy, and naming convention FIRST so the output plugs straight into a gallery or srcset, then build every variant and confirm the matrix is complete. Covers thumbnails, responsive images, srcset, image variants, gallery tiles, and preview generation.

Steps

Entry step: scope. Each step names the specialist role it wants; the full working prompt is expandable.

  1. Scope the variantsplannerentry

    lock sizes, crop strategy, format, and naming

    Show working prompt
    1) List the source images and their dimensions. 2) Decide the variant matrix: the target sizes (e.g. 1x square 200px for grid tiles, plus srcset widths 320/640/1024), the aspect ratio per variant (square thumb vs preserved ratio), and the crop strategy (center vs subject-aware smart crop). 3) Choose output format(s) (e.g. WebP + JPEG fallback) and quality. 4) Lock a naming convention that encodes size, e.g. <name>-200.jpg, <name>-640w.webp, so it drops into srcset. 5) Write an acceptance-criteria checklist: 'every source yields every named variant', 'square thumbs are exactly NxN and keep the subject', 'srcset widths match the spec', 'filenames follow the convention', 'no upscaling beyond source dimensions'. 6) Record matrix + checklist via write_task_note AND to notes/scope.md.
  2. Build the variantsdeveloper

    generate every variant per source with the naming convention

    Show working prompt
    1) Read scope.md. 2) Prefer a small rerunnable script (ImageMagick/sharp/Pillow) over manual edits. 3) For each source image, generate every variant in the matrix: square thumbs cropped to keep the subject centered (smart-crop if available, else center-crop), srcset widths scaled preserving ratio, in the chosen format(s) and quality. 4) Never upscale past the source's native size — skip-and-log a variant the source is too small for. 5) Write outputs to out/ using the exact naming convention. 6) Build a tiny index.html (optional but encouraged) or at least a manifest line proving the srcset wiring. 7) write_task_note the out/ folder and the produced-vs-expected variant counts. Good looks like: a complete, predictably-named matrix ready for a gallery or srcset.
  3. Evaluatereviewer

    Grade the deliverable against every acceptance criterion. All pass → finish; any fail → loop back and fix the gap.

    Show working prompt
    1) Open out/ and verify the variant matrix is complete: each source has each named variant (PASS/FAIL on count). 2) Probe a sample: square thumbs are exactly the target NxN and the subject is still in frame; srcset widths match spec (PASS/FAIL). 3) Confirm filenames follow the naming convention so they'd work in srcset. 4) Confirm no variant was upscaled beyond its source. 5) Write PASS/FAIL per criterion with measured numbers. Any gap → loop back to build to fill missing/incorrect variants.
    
    Then route — this is the whole point of the loop:
    
    - **Every criterion PASSES →** call `advance_task_step({ ref, stepId: "evaluate", next: "finish" })`.
    - **Any criterion FAILS →** write the specific gaps to notes, then call `advance_task_step({ ref, stepId: "evaluate", next: "build" })` to loop back. The builder fixes exactly those gaps.
    
    Never route to `finish` while any criterion is unmet. The build phase's completion gate already blocked a grossly-incomplete deliverable; your job is the judgment an automated check cannot make (does it actually work, read well, look right). After ~3 unproductive loops, stop and report DONE_WITH_CONCERNS so the user can step in.
  4. Finishdeveloper

    All acceptance criteria met. Stamp a short summary and report DONE.

    Show working prompt
    Every acceptance criterion passed. Write a one-paragraph DONE summary to task notes via `write_task_note`: what was built, the deliverable path(s), and a one-line confirmation that each criterion is met. Then report DONE.

Triggers

Phrases that suggest this craftbook to a crew.

Source

View this craftbook on GitHub · MIT license