hydrogen / hydrogen
Shopify/hydrogen/packages/hydrogen/AGENTS.md
What's in it
- Hydrogen development notes
- When designing APIs
- When writing documentation
- When writing code
- When writing UI code
# Hydrogen development notes ## When designing APIs - Deep modules, small API surface: the fewest amount of arguments/options necessary for functions and constructors - Make holding it wrong impossible: if there is a way to misuse your API by accident, it is designed wrong. ## When writing documentation - Do not over-document. If the Typescript LSP covers it, do not add thorough documentation. E.g.: listing the entire list of exports of a module, interfaces etc. - Write packaged skills from the consumer project's perspective. Do not reference repository-only paths under `examples/` or `templates/`. - Tag a declaration `@publicDocs` when a storefront developer could use it: functions, components, and constants from the entry points, the low-level pieces the framework bindings are built on, and what a public factory such as `createCartComponents()` returns. `@shopify/generate-docs` harvests the tag for shopify.dev and pulls in the types it can read out of a tagged signature's text. That crawl is a regex over PascalCase names, so it misses indexed-access types, call-signature object types, and the generic arguments of an async return. Tag a type only when the harvester output lacks it, such as `RequestScopedPrivateStorefrontClient` or `ShopifyGlobal`; run the harvester on a scratch copy and diff the entry keys to check, because TypeScript reachability is not the test. A plain `const` takes its page from its annotation type and has no entry of its own. Declarations in generated or vendored files are exempt. - `@private` on a field of a tagged type hides it from shopify.dev. `@internal` does not hide anything there. It marks fields and helpers that no entry point exports. Never put `@internal` on an entry-point export: tools that filter on it, such as API reports or TypeDoc `excludeInternal`, would hide the declaration while the runtime export remains. ## When writing code - Keep bundle size to a minimum: no unnecessary libraries, no unnecessary guards, no verbosity. Use tree-shaking and lazy loading to your advantage. ## When writing UI code - Display errors or warnings the closest to the element they represent. An error message for a line item in the cart should go next to the line item itself - NEVER calculate currency amounts on the client: users may feel frustrated if they see monetary quantities that do not match what they expect. If an amount is not the most up to date, visually indicate it by displaying pending UI, not pre-emptively calculating amounts. - NEVER Block optimistic interactions. If I can increase a line item’s quantity in my cart in an optimistic way by clicking on the 'increase quantity' button, this button should never be disabled. - ALWAYS visually indicate what data is out of date in a view. Rules of contrast can be disregarded. Pending UI (even if textual) is the equivalent of an image: it does not aim to be read, but to signal the user and hold place for the true value.
More agent context in Shopify/hydrogen
31 other files this repository gives its agents.
AGENTS.md
Skill
- hydrogen-analyticspackages/hydrogen/skills/hydrogen-analytics/SKILL.md
- hydrogen-cart-drawerpackages/hydrogen/skills/hydrogen-cart-drawer/SKILL.md
- hydrogen-cart-metafieldspackages/hydrogen/skills/hydrogen-cart-metafields/SKILL.md
- hydrogen-cart-uipackages/hydrogen/skills/hydrogen-cart-ui/SKILL.md
- hydrogen-collection-browserpackages/hydrogen/skills/hydrogen-collection-browser/SKILL.md
- hydrogen-customer-accountpackages/hydrogen/skills/hydrogen-customer-account/SKILL.md
- hydrogen-imagepackages/hydrogen/skills/hydrogen-image/SKILL.md
- hydrogen-local-httpspackages/hydrogen/skills/hydrogen-local-https/SKILL.md
- hydrogen-marketspackages/hydrogen/skills/hydrogen-markets/SKILL.md
- hydrogen-moneypackages/hydrogen/skills/hydrogen-money/SKILL.md
- hydrogen-oxygenpackages/hydrogen/skills/hydrogen-oxygen/SKILL.md
- hydrogen-predictive-searchpackages/hydrogen/skills/hydrogen-predictive-search/SKILL.md
- hydrogen-request-handlerspackages/hydrogen/skills/hydrogen-request-handlers/SKILL.md
- hydrogen-routingpackages/hydrogen/skills/hydrogen-routing/SKILL.md
- hydrogen-setuppackages/hydrogen/skills/hydrogen-setup/SKILL.md
- hydrogen-shop-paypackages/hydrogen/skills/hydrogen-shop-pay/SKILL.md
- hydrogen-smoke-testpackages/hydrogen/skills/hydrogen-smoke-test/SKILL.md
- hydrogen-storefront-clientpackages/hydrogen/skills/hydrogen-storefront-client/SKILL.md
- hydrogen-variant-formpackages/hydrogen/skills/hydrogen-variant-form/SKILL.md
- benchmark-canaryscripts/storefront-benchmark-harness/workspace-template/.opencode/skills/benchmark-canary/SKILL.md
- create-oxygen-templateskills/create-oxygen-template/SKILL.md
- error-reportingskills/error-reporting/SKILL.md
- playwright-testsskills/playwright-tests/SKILL.md
- pull-request-standardsskills/pull-request-standards/SKILL.md
Discussion
Talked about elsewhere, linking to Shopify/hydrogen
- Shopify Hydrogen - project no longer launches after updating to 2024.4
Stack Overflow · 1 votes · 1 answers · Apr 15, 2024
- If I need to build a storefront, I'd probably check out Medusa [1] or Shopify Hydrogen [2]. Otherwise, probably Elixir/Phoenix and LiveView…
Bluesky · @nezteb.net · 3 likes and reposts · Sep 13, 2025
- Remix to react-router and other dep upgrades
GitHub · Shopify/hydrogen-demo-store · 8 reactions · 1 comments · Nov 24, 2025
- Shopify Admin API Access
Stack Overflow · Jan 3, 2025
- CartProvider V2
GitHub · Shopify/hydrogen-v1 · 6 reactions · 15 comments · Aug 5, 2022
- Cannot use the builder/react sdk in the new version of shopify-hydrogen using Remix
GitHub · BuilderIO/builder-shopify-hydrogen · 5 reactions · 11 comments · Feb 14, 2023
- Use ESM for SSR builds
GitHub · vitejs/vite · 4 reactions · 3 comments · May 12, 2022
- Move cart queries to an API endpoint
GitHub · Shopify/hydrogen-v1 · 4 reactions · 9 comments · Apr 5, 2022
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
Reports can't be read right now.
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

