Handoff theme documentation

Agent guide

How the Handoff theme is built and the rules to follow when you change or configure it. Read DESIGN.md before any visual work. When the official Shopify documentation contradicts this file, the documentation wins: say so and fix this file.

Priorities

Apply this order to every decision: 1. small screens, 2. content that AI assistants can read and quote (GEO), 3. search engines (SEO), 4. large screens.

Architecture

Online Store 2.0, blocks first.

layout/theme.liquid      document shell: head, header group, <main>, footer group
templates/*.json         one JSON template per page type, lists sections
sections/*.liquid        thin containers, no interface of their own
sections/*-group.json    header and footer section groups
blocks/*.liquid          theme blocks: all interface lives here
snippets/*.liquid        markup without settings, reused by blocks and sections
assets/base.css          tokens, reset, base type, layout, shared controls, header, breadcrumb, section containers
assets/product.css       first screen of product pages (gallery, buy area), product pages only
assets/collection.css    first screen of collection and search pages, those pages only
assets/home.css          first screen of the home page (hero, facts)
assets/block-<name>.css  styles of one block, loaded where the block is rendered (also snippet-<name>.css, section-<name>.css)
assets/loader.js         the only script on first paint, loads components on demand
assets/<name>.js         one ES module per interactive component (custom element)
config/                  theme settings schema and data
locales/                 storefront strings

Rules:

Patterns already in place

GEO blocks

These blocks carry the facts that AI assistants and search engines read and quote. All of them render on the server, mark their root with data-check="<block name>", and render nothing at all when they have no content (so a section that holds only empty blocks hides itself, heading included).

Block Reads Fallback
quick-answer text metafield of the page's product, collection, article, or page (custom.quick_answer) "Answer" setting
at-a-glance product metafields listed as "Label: namespace.key" lines, plus delivery time and return window from theme settings none: an empty row is left out
specs-table product metafields listed as "Label: namespace.key" lines, plus SKU, barcode, weight of the selected variant none
compatibility-table product metafield, list of metaobjects with name, model_codes, status, note (custom.compatibility) _compatibility-row child blocks
faq metafield of the page's resource, list of metaobjects with question, answer (custom.faq) _faq-item child blocks
who-its-for two product metafields, lists of text (custom.who_its_for, custom.not_for) two textarea settings, one point per line
shipping-returns-summary Shipping and Returns theme settings none
buying-guide-intro collection metafield, rich text or text (custom.buying_guide) "Body text" setting
related-guides product metafield, list of articles or pages (custom.related_guides) none
article-products article metafield, list of products (custom.related_products) product list setting

Rules for these blocks:

Naming

CSS

JavaScript

Liquid performance

Accessibility (WCAG 2.2 AA)

GEO and SEO

Settings map (theme settings)

Group Ids Used by
Colors color_* snippets/css-variables.liquid
Typography type_heading_font, type_body_font, type_data_font, type_body_size snippets/css-variables.liquid
Layout layout_page_width .page-width
Logo and favicon logo, logo_width, favicon header, layout head
Product product_image_fit, product_blend_images galleries and cards
Cart cart_type cart drawer or cart page
Social media social_*_link footer icons, sameAs in structured data
Brand identity brand_legal_name, brand_description, brand_email, brand_phone, brand_address_* Organization structured data
Shipping shipping_countries, shipping_handling_days_min and _max, shipping_transit_days_min and _max, shipping_business_days, shipping_rate, shipping_free_threshold delivery summary near the buy button, shippingDetails
Returns returns_days, returns_fees, returns_shipping_fee, returns_method, returns_countries, returns_policy_url returns summary, hasMerchantReturnPolicy

When you configure a store: enter only facts that match the store's legal pages and Shopify settings. Leave a field empty rather than guess. An empty field is omitted from the page and from the structured data.

Configuring a store

When the task is to set up a store, not to change code, follow setup/AI-SETUP.md of the theme documentation. In short:

  1. Theme settings first: identity (Logo and favicon, Colors, Typography), Brand identity, Social media, Shipping, Returns. They live in config/settings_data.json under current. Write them on an unpublished copy of the theme, or in the theme editor.
  2. Metafield and metaobject definitions next (setup/metafields.json), then the values, product by product, from the merchant's own documents.
  3. Templates last: each JSON template lists sections, each section lists blocks. Add a GEO block where its facts exist. A block without data renders nothing on the storefront and shows help in the theme editor.
  4. Finish with proof: node setup/checks/run.mjs, then the readiness panel of the theme editor, which lists what is still missing on the page.

Rules: ask before every write, say what will change, never invent a value, and keep the page, the structured data, and the store policies saying the same thing.

Do not

Checks

Run from the repository root (the folder above theme/).

shopify theme check --path theme        Liquid, schema, asset sizes
node scripts/check-generic.mjs          no store-specific data in theme/
node scripts/check-no-stylesheet-tag.mjs  no {% stylesheet %} tag anywhere
node scripts/check-asset-budgets.mjs    strict size budgets for the theme's own JavaScript and CSS
npx playwright test                     small screens first, axe-core (needs BASE_URL)
npm run test:cart-live                  the one test on a real cart, on the reference Mac, before a merge
node scripts/check-jsonld.mjs <url>     structured data: valid, one block per type, required fields
node scripts/check-no-js.mjs <url>      title, price, description, GEO blocks in the raw HTML
node scripts/check-images-alt.mjs <url> every image has a description
node setup/checks/run.mjs --store <url> --product <path>   all final checks of a configured store

.theme-check.yml extends theme-check:recommended. Fix the Liquid instead of adding exceptions.

The accelerated checkout button is never rendered with the product page. {{ form | payment_button }} in the page makes Shopify add an 83 KB script and a stylesheet to the head. The button lives in sections/product-payment-button.liquid and is fetched by assets/express-payment.js after the first-screen image, into a slot of the final height. Do not put payment_button back in a block or a section that renders with the page.

No test changes a real cart in CI. Shopify's bot protection challenges cart changes made by an automated browser from shared addresses, then every page that follows. The tests of the cart interface replay responses recorded on the store (tests/cart-replay.mjs, tests/recordings/cart.json). When you change the cart markup or the cart JavaScript, run npm run test:cart-live on the reference Mac: it follows a real purchase up to the checkout button, with and without JavaScript, and records the responses again. Commit the recording when it says it changed. Run it once per merge, not more: three real runs within an hour got the reference Mac challenged too (24/11/2026).

How a change of loading order is judged. For a change that only moves when something loads (a script, a font, a stylesheet, a button), two measures are needed, both by the comparison rules (scripts/lighthouse-compare.mjs: copies in alternation, a pair of identical copies for the noise). The standard script must show no loss beyond the noise, and real throttling (LH_THROTTLING=devtools) must show a gain beyond the noise. The simulated model of the standard script does not see resources competing for the line: real throttling is what measures it.

Every optimization has a test that proves it is active in the page as served. A speed or loading optimization (late fonts, a deferred script, a lazy image, a preload that was removed) can be switched off by one condition that never matches, and nothing looks broken. So each one comes with a test that reads the served HTML or the loaded page and checks the optimized state itself, like web fonts wait for the first-screen image in tests/foundation.spec.mjs. A measure alone is not a proof: it only says the page was fast that day.