agentleFS
mocchaleramocchalera/mockup-to-code-skill/skills/responsive-image-delivery/SKILL.md

responsive-image-delivery

Skill0 starsChanged 4 months agoISCView on GitHub

Audit and optimize adopted web image assets without changing art direction. Use after mockup-to-code or another visual implementation has selected final imagery, especially when pages risk multi-megabyte images, missing intrinsic dimensions, weak LCP delivery, invalid or misleading srcset/sizes, upscaled variants, or absent HTML integration evidence.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After a pass, emit the parent manifest receipt from the mockup work root and store it at specialistReports.mediaDelivery:

    line 49
  2. Very specific:

    Write derivatives only beneath the explicit --output-dir.

    line 63
  3. Distinctive:

    Treat AVIF/WebP as capability-dependent.

    line 65
  4. Distinctive:

    Do not change focal point, crop, overlays, lettering, or other art direction.

    line 68
  5. Distinctive:

    Run focused tests with:

    line 74

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Responsive Image Delivery

Turn approved raster assets into measured responsive delivery. Preserve composition, crop, aspect ratio, color profile, and source files.

Workflow

  1. Identify the actual page image set and explicitly name every likely LCP asset. Do not guess LCP from filename alone.
  2. Record codec support before choosing formats:

    SKILL_ROOT="${SKILL_ROOT:-${CODEX_HOME:-$HOME/.codex}/skills}"
    "$SKILL_ROOT/mockup-to-code/scripts/skill-pack-python" \
      "$SKILL_ROOT/responsive-image-delivery/scripts/media_delivery.py" capabilities
  3. Generate derivatives only with an explicit output directory. Keep originals outside that directory and never overwrite them:

    SKILL_ROOT="${SKILL_ROOT:-${CODEX_HOME:-$HOME/.codex}/skills}"
    "$SKILL_ROOT/mockup-to-code/scripts/skill-pack-python" \
      "$SKILL_ROOT/responsive-image-delivery/scripts/media_delivery.py" optimize \
      --input public/images/hero.jpg \
      --output-dir public/images/generated \
      --widths 480,768,1024,1440,1920 \
      --formats auto \
      --report work/media-delivery-optimize.json
  4. Integrate generated files into <picture>/<img>. Derive sizes from the implemented layout at each breakpoint; never use 100vw as an unverified placeholder. Keep width and height attributes at the correct aspect ratio. For LCP images, use fetchpriority="high" and do not use loading="lazy".
  5. Audit the real HTML and delivery directory. A pass requires resolved srcset width candidates, a non-empty sizes, intrinsic-ratio evidence, declared LCP behavior, budget compliance, and no upscaling:

    SKILL_ROOT="${SKILL_ROOT:-${CODEX_HOME:-$HOME/.codex}/skills}"
    "$SKILL_ROOT/mockup-to-code/scripts/skill-pack-python" \
      "$SKILL_ROOT/responsive-image-delivery/scripts/media_delivery.py" audit \
      --input public/images/hero.jpg \
      --variant-dir public/images/generated \
      --html out/index.html \
      --lcp public/images/hero.jpg \
      --report work/media-delivery-report.json
  6. Validate the report against media-delivery-report-v1.schema.json. If inspection or generation cannot run, copy media-delivery-report.blocked.json, fill its blocker, and do not claim pass.
  7. After a pass, emit the parent manifest receipt from the mockup work root and store it at specialistReports.mediaDelivery:

    SKILL_ROOT="${SKILL_ROOT:-${CODEX_HOME:-$HOME/.codex}/skills}"
    "$SKILL_ROOT/mockup-to-code/scripts/skill-pack-python" \
      "$SKILL_ROOT/responsive-image-delivery/scripts/media_delivery.py" receipt \
      --report work/media-delivery-report.json --root .

    Non-passing reports cannot emit {contract,path,sha256}.

Hard rules

  • Preserve every original byte-for-byte. The optimizer hashes each source before and after generation.
  • Write derivatives only beneath the explicit --output-dir; refuse conflicting existing files unless --overwrite is passed.
  • Resize proportionally with no crop and never emit or declare a candidate wider or taller than its source.
  • Treat AVIF/WebP as capability-dependent. Report read/write support and fall back to JPEG for opaque images or PNG for alpha; never relabel bytes with a different extension.
  • Apply file-size and dimension budgets to files actually delivered by HTML. Apply the stricter LCP byte budget to every declared LCP candidate.
  • Require width descriptors (320w), resolvable candidate files, and truthful descriptor-to-intrinsic-width equality. Do not accept density descriptors as responsive-width evidence.
  • Do not change focal point, crop, overlays, lettering, or other art direction. Escalate those changes back to visual design.

Tool contract

scripts/media_delivery.py uses Pillow plus the standard library. Run --help for budget, quality, format, and input options. It emits deterministic, sorted JSON with top-level schemaVersion: media-delivery-report/v1; reports omit timestamps. auto always includes a source-compatible fallback and adds writable AVIF/WebP encoders. Unsupported explicitly requested codecs become blockers while supported outputs remain inspectable.

Run focused tests with:

SKILL_ROOT="${SKILL_ROOT:-${CODEX_HOME:-$HOME/.codex}/skills}"
"$SKILL_ROOT/mockup-to-code/scripts/skill-pack-python" -m unittest discover \
  -s "$SKILL_ROOT/responsive-image-delivery/tests" -p 'test_*.py'

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.