dimensions
Qué hace
Esta skill comprueba las etiquetas de imagen de un sitio web en busca de tamaños sin definir. Es para desarrolladores que quieren páginas que se mantengan estables mientras cargan.
Cuándo usarla
- ✓Cuando el contenido de tu página salta a medida que terminan de cargar las fotos.
- ✓Cuando añades nuevas imágenes a una página o plantilla.
- ✓Cuando tu página obtiene malas puntuaciones en las comprobaciones de estabilidad del diseño.
Link de la skill
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/dimensions/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“¿Puedes encontrar imágenes de mi sitio que no tengan ancho y alto?”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
Tu agente analiza las etiquetas de imagen e informa de las que no tienen ancho ni alto. Sugiere añadir las dimensiones reales de la imagen para que el navegador reserve espacio antes de que cargue.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Set explicit width and height on images
Images without explicit dimensions are the most common cause of Cumulative Layout Shift (CLS), a Core Web Vitals metric. When images load and cause layout jumps, users accidentally click the wrong element—a frustrating experience that Google penalises in search rankings. A CLS score above 0.1 is considered 'needs improvement'; above 0.25 is 'poor'.
Quick Reference
- Reserve findings for meaningful content images; decorative micro-SVGs or ornament-only assets are low-priority exceptions when CSS already reserves stable space
- Example low-risk exception:
<img src="/divider.svg" alt="" aria-hidden="true">should not be flagged on its own without evidence of visible layout shift - Always set
widthandheightattributes on<img>matching the image's intrinsic dimensions - Pair with
height: autoin CSS to keep the image fluid while preserving the aspect ratio - Missing dimensions are the leading cause of Cumulative Layout Shift (CLS) from images
- Browsers derive
aspect-ratiofrom these attributes—do not set arbitrary placeholder values
Check
Scan all <img> elements in the codebase. Identify any that are missing either the width or height attribute. Also check <source> elements inside <picture>—dimensions should be on the <img> fallback. Report each image missing dimensions with its file path and line number. Note: SVG icons under 32px, tiny decorative SVG ornaments with stable CSS sizing, and images loaded as CSS backgrounds are exempt.
Fix
For each <img> missing width/height: 1) Add the intrinsic pixel dimensions as attributes (e.g., width="800" height="450"). 2) Use CSS max-width: 100% and height: auto on the element to keep it responsive. 3) The attribute values must match the image's intrinsic aspect ratio—do not set arbitrary numbers. 4) For dynamically sized images, calculate the aspect ratio and use the CSS aspect-ratio property as a fallback. 5) Skip purely decorative micro assets when the snippet already shows stable sizing and there is no evidence of layout shift risk. Show the before and after HTML for each fixed image.
Explain
Explain why width and height attributes on <img> prevent Cumulative Layout Shift (CLS). When a browser parses HTML, it does not yet know an image's dimensions—without explicit attributes, the browser initially renders a 0-height placeholder, then jumps the layout when the image loads. With width and height set, the browser calculates the aspect ratio from the attributes and reserves space immediately, eliminating the shift. This became especially important as modern browsers use the aspect-ratio CSS property derived from these HTML attributes.
Code Review
Review image assets, markup, and delivery configuration related to Set explicit width and height on images. Flag exact files or components where format choice, sizing, or loading behavior violates the rule, and describe how to confirm the fix in DevTools.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/images/dimensions
Preguntas frecuentes
¿Por qué las imágenes sin tamaño causan problemas?
El navegador no sabe cuánto espacio dejar, así que el texto de debajo se mueve cuando aparece la imagen.
¿Se incluyen los iconos decorativos pequeños?
La skill trata las imágenes decorativas diminutas como prioridad baja, ya que rara vez mueven el contenido que las rodea.
¿Qué puntuación se considera buena?
La skill indica que un desplazamiento de diseño inferior a 0,1 se considera bueno, y superior a 0,25 se considera deficiente.
Detalles
Descripción original del autor
Use when reviewing image assets, markup, and CDN or build transforms related to Set explicit width and height on images. Check encoded size, rendered size, loading strategy, and above-the-fold impact together. Separate real CLS risks from tiny decorative SVGs or ornament-only assets that are unlikely to move surrounding content.
Popularidad
- Estrellas en GitHub
- 75 mil
- Posición en el ranking
- #2815
- Licencia
- MIT
- Actualizada
- 31/10/2026
Comentarios
- …
Más skills de este repositorio
frontendchecklist
75 milRevisa código frontend y páginas en vivo con más de 380 reglas de accesibilidad, velocidad, SEO y seguridad, usando una herramienta de línea de comandos.
frontend-checklist-global
75 milAudita un proyecto frontend con las 386 reglas de Front-End Checklist y ofrece una corrección concreta para cada problema encontrado.
404-page
75 milComprueba que tu página de no encontrado ofrezca enlaces útiles y devuelva un estado 404 real, para ayudar a los visitantes perdidos a encontrar su camino.
about-page
75 milRevisa si tu sitio tiene una página Sobre nosotros clara que explique quién lo dirige, para generar confianza en los visitantes y en los buscadores.
Skills parecidas
angular-developer
280 milAyuda a tu agente con código de Angular y la estructura del proyecto. Útil para empezar proyectos, crear partes de código o mejorar el rendimiento y la accesibilidad.
frontend-a11y
280 milAyuda a tu agente a hacer que las interfaces web sean accesibles para todos. Asegura que sitios y apps funcionen bien con lectores de pantalla y navegación por teclado.
frontend-patterns
280 milHace que tu agente aplique patrones modernos en desarrollo frontend. Optimiza el rendimiento, gestiona el estado y sigue buenas prácticas en React y Next.js.