npx skills add ...
npx skills add hyva-themes/hyva-ai-tools --skill hyva-render-media-image
Generate responsive image code for Hyvä Theme templates using the Media view model. This skill should be used when the user wants to render images in a Hyvä template, create responsive picture elements, add hero images, product images, or any image that needs responsive breakpoints. Trigger phrases include "render image", "add image to template", "responsive image", "picture element", "hero image", "responsive banner", "image for mobile and desktop", or "banner image".
npx skills add hyva-themes/hyva-ai-tools --skill hyva-render-media-image
Generate responsive <picture> elements for Hyvä Theme templates using the \Hyva\Theme\ViewModel\Media view model.
The user may provide image data in one of these ways:
Option A: Direct values - Ask the user for:
pub/media/ (e.g., wysiwyg/hero.jpg, catalog/product/...)Option B: PHP variable - The user provides a variable name (e.g., $imageData, $heroImage). Inform the user of the required array structure documented in references/rendering-images.md under ## Image Configuration Format.
Refer to references/rendering-images.md for the complete API reference, code examples, and all configuration options.
Choose the appropriate pattern:
| Scenario | Pattern to Use |
|---|---|
| Single image, literal values | Single Image Example |
| Single image from variable | Wrap in array: [$imageData] |
| Multiple images from variable | Pass directly: $images |
| Different images for mobile/desktop | Responsive Images with Media Queries |
Need to style the <picture> wrapper | Picture Element Attributes |
Base template:
| Image Type | Attributes |
|---|---|
| Hero/LCP (above fold) | 'loading' => 'eager', 'fetchpriority' => 'high' |
| Below fold | 'loading' => 'lazy' |
references/rendering-images.md - Complete API reference with method signature, all configuration options, code examples, and best practices