image-optimization-requirements

image-optimization-requirements is a cursor rule for Cursor from adobecom/express-milo. It costs 3,013 tokens per session, scanned A, a copy of image-optimization-requirements, Apache-2.0.

A rule set for loading and sizing images on webpages, especially the first large image users see. That first visible image is often called the largest contentful paint, or LCP, image.

In plain words
What is it for?
Use it when implementing hero images and other early-page images. It specifies eager loading, high fetch priority, dimensions, responsive image handling, and a 100 KB pre-LCP budget.
Why use it?
It helps reduce the data downloaded before the page becomes useful and avoids making the main image load too late or at an unsuitable size.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when implementing hero images and other early-page images. It specifies eager loading, high fetch priority, dimensions, responsive image handling, and a 100 KB pre-LCP budget.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/adobecom/express-milo/image-optimization-requirements
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/adobecom/express-milo

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for image-optimization-requirements

README.md
[![agentmods](https://agentmods.dev/badge/rules/adobecom/express-milo/image-optimization-requirements/github.svg)](https://agentmods.dev/rules/adobecom/express-milo/image-optimization-requirements)
Your own site
<a href="https://agentmods.dev/rules/adobecom/express-milo/image-optimization-requirements"><img src="https://agentmods.dev/badge/rules/adobecom/express-milo/image-optimization-requirements/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for image-optimization-requirements

Your own site · 80×15
<a href="https://agentmods.dev/rules/adobecom/express-milo/image-optimization-requirements"><img src="https://agentmods.dev/badge/rules/adobecom/express-milo/image-optimization-requirements.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,013 This file is loaded in full into every session.
When invoked 3,013 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.03013 $0.03013
Opus 5.5 $0.01205 $0.01205
Sonnet 5.5 $0.00603 $0.00603
Haiku 4.5 $0.00301 $0.00301

Measured 1mo ago against content hash b3c361e2d74a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

image-optimization-requirements scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to image-optimization-requirements — 78 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/image-optimization-requirements.mdc · 370 lines

How it starts

The opening of the file, as written. The whole thing — 370 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Image Optimization Performance Rules - Three-Phase Strategy

APPLY: EVERY QUERY - CRITICAL PERFORMANCE RULE

AEM Bandwidth Budget Management (CRITICAL)

Based on AEM's performance guidelines:

  • 100kb total payload before LCP including all images, CSS, JS
  • Single origin only before LCP (no CDN/external image connections)
  • LCP target: 1560ms on mobile for Lighthouse 100 score

Phase E (Eager) - LCP Image Optimization (REQUIRED)

For first section hero/marquee images that are LCP candidates:

// ✅ REQUIRED for LCP candidate images (Phase E)
const optimizeLCPImage = (img, block) => {
  const isFirstSection = block.closest('.section') === document.querySelector('.section');
  const isFirstImage = img === block.querySelector('img');
  
  if (isFirstSection && isFirstImage) {
    // Phase E: Critical LCP optimization
    img.removeAttribute('loading');
    img.setAttribute('loading', 'eager');  
    img.setAttribute('fetchpriority', 'high');
    
    // Calculate optimal size for bandwidth budget
    const optimalWidth = getOptimalImageSize();
    const aspectRatio = getImageAspectRatio(img);
    
    img.setAttribute('width', optimalWidth);
    img.setAttribute('height', Math.round(optimalWidth * aspectRatio));
    
    // Preload only if within bandwidth budget
    const estimatedSize = estimateImagePayload(img.src, optimalWidth);
    if (payloadTracker.canLoadResource(estimatedSize)) {
      preloadLCPImage(img.src, optimalWidth);
    } else {
      console.warn('LCP image exceeds bandwidth budget, consider optimization');
    }
  }
};

// ✅ REQUIRED - Bandwidth-aware image preloading
const preloadLCPImage = (src, width) => {
  const link = document.createElement('link');
  link.rel = 'preload';
  link.as = 'image';
  link.href = `${src}?width=${width}&format=webp&optimize=medium`;
  link.fetchPriority = 'high';
  document.head.appendChild(link);
};

Bandwidth Budget Calculation (REQUIRED)

Read the full file on GitHub · 370 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 370 lines · 3,013 tokens per session scan A b3c361e2d74a

Subscribe to this mod's changes

image-optimization-requirements is a cursor rule published in the GitHub repository adobecom/express-milo (6 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 3,013 tokens to every session, about $0.0121 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to image-optimization-requirements, differing in 78 lines, and is treated as a copy.