Automated summary
Optimizes Shopify store performance: Liquid rendering, asset weight, CDN images, Core Web Vitals and Hydrogen caching.
Strengths
- A Liquid anti-pattern table (nested loops, all_products inside loops, include vs render) with the recommended fix for each.
- Copy-ready Liquid snippets for responsive srcset, loading="lazy" and fetchpriority="high" on the LCP image.
- Forces a live search of current Shopify and web.dev docs before writing code, reducing stale API usage.
- Covers both classic Liquid themes and Hydrogen storefronts.
Limitations
- The body stops at LCP: the Hydrogen, preloading and CDN strategy sections advertised in the description are not actually detailed.
- No measurement or verification workflow (Lighthouse, Theme Speed Report) to confirm before/after gains.
- Does not address scripts injected by third-party apps or Shopify plan constraints.
Use when a Shopify store is slow and you need to trim Liquid/JS weight or improve LCP and CLS.
Avoid when the bottleneck comes from third-party apps or checkout logic outside theme control, or when the store isn't on Shopify.
Security analysis
CautionThe skill grants powerful tooling (Bash, Write, Edit, network fetch) but all instructions point to legitimate performance work: fetching Shopify/web.dev docs and editing theme or Hydrogen files. There is no obfuscation, no curl|sh piping, no rm -rf, no attempts to move secrets off-box, and no instruction to disable safety controls. The write/edit/bash access on a live storefront theme still warrants caution because changes could break a production theme, but the risk is ordinary and appropriate to the task.
- •Declares Bash, Write, and Edit tools, which can modify theme files and execute local commands
- •WebSearch/WebFetch allow outbound network requests, though only for documentation lookups
- •No credential handling, secret access, or destructive command patterns present
Examples
My Shopify homepage hero image is the LCP element and takes 3.8s to appear. Show me the Liquid I need to preload it with fetchpriority and a responsive srcset.Here is my collection.liquid template with a nested loop calling all_products[handle]. Rewrite it to remove the O(n²) rendering and switch {% include %} to {% render %}.Review my Shopify theme and propose a plan to improve Core Web Vitals: inline critical CSS, defer non-critical JS, and lazy-load below-the-fold images.name: shopify-performance description: 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. allowed-tools: Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch
Shopify Performance Optimization
Before writing code
Fetch live docs:
- Web-search
site:shopify.dev theme performancefor theme optimization - Web-search
site:shopify.dev hydrogen cachingfor Hydrogen caching strategies - Web-search
site:web.dev core web vitalsfor current CWV guidelines and thresholds - Web-search
site:shopify.dev image optimization cdnfor image URL transforms - Web-search
site:shopify.dev theme speed reportfor Shopify's built-in speed metrics
Liquid Rendering Performance
Template Optimization
- Minimize Liquid logic — complex loops and conditionals slow server-side rendering
- Use
{% render %}(not{% include %}) — isolated scope prevents variable conflicts - Avoid nested loops —
O(n²)in Liquid is expensive - Limit
forloopiterations withlimit:parameter - Pre-compute values with
{% assign %}instead of repeating expressions
Object Access
- Access specific properties:
{{ product.title }}not{{ product | json }} - Avoid
all_products[handle]in loops — each is a separate data lookup - Use section settings to pass data instead of global lookups
- Minimize use of
{{ content_for_header }}scripts (managed by Shopify — cannot remove, but minimize additional scripts)
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
- Minimize CSS — remove unused styles
- Use
{{ 'style.css' | asset_url | stylesheet_tag }}for proper caching - Critical CSS: inline above-the-fold styles in
<head> - Defer non-critical CSS:
media="print" onload="this.media='all'"
JavaScript
- Defer non-critical JS:
<script defer>or dynamicimport() - Minimize JS bundles — Shopify themes don't need frameworks for most UI
- Use native browser APIs over jQuery
- Load third-party scripts asynchronously (
asyncattribute) - Avoid render-blocking scripts in
<head>
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:
- Use
loading="lazy"for below-the-fold images - Use
fetchpriority="high"for LCP image - Set explicit
widthandheightto prevent layout shift - Shopify CDN automatically serves WebP/AVIF when supported
- URL parameters:
?width=,?height=,?crop=,?format=
Fetch live docs: Web-search
site:shopify.dev image_url filter parametersfor current CDN transform options — new parameters are added over time.
Core Web Vitals
LCP (Largest Contentful Paint)
Target: < 2.5 seconds
- Preload hero/LCP image:
<link rel="preload" as="image" href="{{ image | image_url: width: 1200 }}"> - Use
fetchpriority="high"on LCP image - Avoid lazy-loading above-the-fold images
- Minimize render-blocking CSS and JS
- Use server-side rendering (Liquid or Hydrogen SSR)
CLS (Cumulative Layout Shift)
Target: < 0.1
- Set explicit
widthandheighton all images and media - Reserve space for dynamic content (ads, embeds, lazy-loaded images)
- Avoid inserting content above existing content after page load
- Use
aspect-ratioCSS property for responsive media containers - Avoid dynamically injected banners or pop-ups that shift content
INP (Interaction to Next Paint)
Target: < 200ms
- Minimize main-thread blocking JavaScript
- Break up long tasks with
requestIdleCallbackorsetTimeout(fn, 0) - Use CSS for animations and transitions (not JS)
- Debounce event handlers (scroll, resize, input)
- Avoid synchronous layout thrashing (read-then-write DOM patterns)
Fetch live docs: CWV thresholds and measurement methodology evolve. Web-search
site:web.dev core web vitals thresholdsfor 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
- Use
defer()in loaders for non-critical data - Critical data renders immediately, deferred data streams in
- Show loading states with
<Suspense>+<Await> - Preload routes with
<Link prefetch="intent">
Shopify CDN
Shopify's global CDN:
- Automatic for all theme assets and images
- Cache-Control headers managed by Shopify
- Image transformations via URL parameters
- No manual CDN configuration needed for themes
- Asset fingerprinting for cache busting
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
- Measure before optimizing — use Lighthouse, WebPageTest, Shopify's theme speed report
- Focus on LCP image optimization first (biggest impact for most stores)
- Lazy-load everything below the fold
- Minimize third-party scripts (analytics, chat widgets, social embeds)
- Use Shopify's built-in analytics over custom tracking scripts where possible
- For Hydrogen: cache aggressively, stream non-critical data, preload routes
- Test on real devices and slow connections (3G throttling)
- Set explicit dimensions on all media to prevent CLS
- Use
font-display: swapfor custom fonts
Fetch the Shopify performance documentation, Core Web Vitals guides, and Hydrogen caching docs for exact optimization techniques and current best practices before implementing.
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/shopify-performance-optimization-mrzxupyl/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/shopify-performance-optimization-mrzxupyl' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/shopify-performance-optimization-mrzxupyl/download' --output '.skill-downloads/shopify-performance-optimization-mrzxupyl/SKILL.md.part' && mv '.skill-downloads/shopify-performance-optimization-mrzxupyl/SKILL.md.part' '.skill-downloads/shopify-performance-optimization-mrzxupyl/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/shopify-performance-optimization-mrzxupyl/SKILL.md' && test -s '.skill-downloads/shopify-performance-optimization-mrzxupyl/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/shopify-performance' && cp -R '.skill-downloads/shopify-performance-optimization-mrzxupyl' '.claude/skills/shopify-performance'Cursor
test -f '.skill-downloads/shopify-performance-optimization-mrzxupyl/SKILL.md' && test -s '.skill-downloads/shopify-performance-optimization-mrzxupyl/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/shopify-performance' && cp -R '.skill-downloads/shopify-performance-optimization-mrzxupyl' '.cursor/skills/shopify-performance'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/shopify-performance-optimization-mrzxupyl'openskills read 'shopify-performance-optimization-mrzxupyl'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/shopify-performance-optimization-mrzxupyl/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.