Shopify performance

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Shopify performance is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Optimize Shopify performance — Liquid rendering, asset optimization, CDN strategies, Core Web Vitals, Hydrogen caching, image optimization, preloading, and lazy loading. Use when improving Shopify store speed.

How to use this skill

Skill file

Shopify Performance Optimization

Before writing code

Fetch live docs:

  1. Web-search site:shopify.dev theme performance for theme optimization
  2. Web-search site:shopify.dev hydrogen caching for Hydrogen caching strategies
  3. Web-search site:web.dev core web vitals for current CWV guidelines and thresholds
  4. Web-search site:shopify.dev image optimization cdn for image URL transforms
  5. Web-search site:shopify.dev theme speed report for Shopify's built-in speed metrics

Liquid Rendering Performance

Template Optimization

Object Access

Liquid Anti-Patterns

| Anti-Pattern | Why It's Slow | Better Approach |

|-------------|--------------|-----------------|

| Nested for loops | O(n²) rendering | Flatten data, use single loop |

| all_products[handle] in loop | Data fetch per iteration | Pass products via section settings |

| {% include %} with variables | Shared scope causes conflicts | Use {% render %} (isolated) |

| Complex {% if %} chains | Evaluated every render | Simplify conditions, use {% case %} |

| Unused sections in templates | Rendered even if hidden | Remove from JSON template |

Asset Optimization

CSS

JavaScript

Images

Shopify CDN image optimization:

# Responsive images with srcset
{{ image | image_url: width: 800 }}
{{ image | image_url: width: 400 }}

# Srcset pattern
<img
  srcset="{{ image | image_url: width: 400 }} 400w,
         {{ image | image_url: width: 800 }} 800w,
         {{ image | image_url: width: 1200 }} 1200w"
  sizes="(max-width: 600px) 400px, (max-width: 1000px) 800px, 1200px"
  src="{{ image | image_url: width: 800 }}"
  alt="{{ image.alt }}"
  loading="lazy"
  width="{{ image.width }}"
  height="{{ image.height }}"
>

Key image practices:

Fetch live docs: Web-search site:shopify.dev image_url filter parameters for current CDN transform options — new parameters are added over time.

Core Web Vitals

LCP (Largest Contentful Paint)

Target: < 2.5 seconds

CLS (Cumulative Layout Shift)

Target: < 0.1

INP (Interaction to Next Paint)

Target: < 200ms

Fetch live docs: CWV thresholds and measurement methodology evolve. Web-search site:web.dev core web vitals thresholds for current targets.

Hydrogen Caching

Cache Strategies

// Pattern: apply cache strategy to storefront query
const data = await storefront.query(QUERY, {
  cache: CacheLong(),  // products, collections
});

const cart = await storefront.query(CART_QUERY, {
  cache: CacheShort(), // dynamic data
});

| Strategy | Use For |

|----------|---------|

| CacheLong() | Products, collections, pages |

| CacheShort() | Cart, personalized content |

| CacheNone() | Customer-specific data |

| CacheCustom({...}) | Fine-tuned scenarios |

Fetch live docs for exact TTL values — Hydrogen caching defaults may change across versions.

Streaming SSR

Shopify CDN

Shopify's global CDN:

Measurement Tools

| Tool | What It Measures |

|------|-----------------|

| Shopify Theme Speed Report | Overall theme score in admin |

| Google Lighthouse | CWV + performance audit |

| WebPageTest | Real-world loading waterfall |

| Chrome DevTools Performance | JS profiling, layout shifts |

| Search Console CWV Report | Field data from real users |

Best Practices

Fetch the Shopify performance documentation, Core Web Vitals guides, and Hydrogen caching docs for exact optimization techniques and current best practices before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.