agentleFS
ShopifyKnown publisherShopify/hydrogen/cookbook/CLAUDE.md

hydrogen / cookbook

CLAUDE.md2.1k starsChanged 8 months agoMITView on GitHub

The Hydrogen Cookbook transforms the skeleton template into specific scenarios through reproducible recipes. IMPORTANT: This file provides quick reference and common patterns. For comprehensive command documentation, implementation details, and additional context, read cookbook/README.md. YOU MUST validate before committing: Recipe requirements: - Step values are quoted strings: step: "1" not step: 1 (YAML coerces unquoted integers to numbers, but the Zod schema expects strings) - Every step has a description (non-null, non-empty) - Step names are unique within the same step…

  • Installs packages

Trending

Quiet since June.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 1 mentionJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the Shopify/hydrogen repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about Shopify/hydrogen

The biggest 5 of 29 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 29

Talked about on GitHub and Bluesky (29 times).

On GitHub · 28

23 more on GitHub

The file

We split this CLAUDE.md into the rules it gives an agent

8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every step has a description (non-null, non-empty)

    line 26
  2. Distinctive:

    All referenced patch/ingredient files exist

    line 28
  3. Very specific:

    Fix: Remove file or add reference to recipe.yaml

    line 62
  4. Very specific:

    Fix: Add description to step in recipe.yaml

    line 68
  5. Distinctive:

    Update recipe to remain compatible with latest main branch.

    line 254
  6. Distinctive:

    Create temporary update branch

    line 272
  7. Distinctive:

    Update LLM prompts when recipe logic changes

    line 338
  8. Distinctive:

    Update recipes when skeleton template changes significantly

    line 350

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

Cookbook System

The Hydrogen Cookbook transforms the skeleton template into specific scenarios through reproducible recipes.

IMPORTANT: This file provides quick reference and common patterns. For comprehensive command documentation, implementation details, and additional context, read cookbook/README.md.

Quick Reference

pnpm run cookbook -- validate                    # Validate all recipes
pnpm run cookbook -- validate --recipe {name}    # Validate one recipe
pnpm run cookbook -- apply --recipe {name}       # Apply recipe to skeleton
pnpm run cookbook -- generate --recipe {name}    # Generate recipe from changes
pnpm run cookbook -- render                      # Render all documentation

IMPORTANT: Critical Rules

YOU MUST validate before committing:

pnpm run cookbook -- validate --recipe {name}

Recipe requirements:

  • Step values are quoted strings: step: "1" not step: 1 (YAML coerces unquoted integers to numbers, but the Zod schema expects strings)
  • Every step has a description (non-null, non-empty)
  • Step names are unique within the same step number
  • All referenced patch/ingredient files exist
  • README.md exists and is up-to-date
  • LLM prompt file exists at llms/{recipe-name}.prompt.md

After modifying recipe.yaml, regenerate docs:

pnpm run cookbook -- render --recipe {name}

Common Errors

Unquoted Step Numbers

❌ recipe.yaml:52  steps.0.step  RecipeSchema: Invalid input: expected string, received number (actual value: 1)

Fix: Quote step numbers so YAML preserves them as strings:

- step: 1
+ step: "1"

Outdated README

❌ README.md  validateReadmeExists: README.md not found

Fix: Regenerate documentation:

pnpm run cookbook -- render --recipe {name}

Orphaned Files

❌ patches/old-file.patch  validatePatchFiles: Orphaned patch file not referenced in recipe

Fix: Remove file or add reference to recipe.yaml

Null Descriptions

❌ recipe.yaml:65  steps.2.description  validateStepDescriptions: Step 2 has null description

Fix: Add description to step in recipe.yaml

Code Style

  • Step values: Quoted strings (step: "1") — unquoted integers fail Zod validation
  • Step names: Unique within same step number, kebab-case for file paths
  • Descriptions: Non-null, non-empty strings explaining what the step does
  • Comments: Use @description in code to explain why, not what
  • Naming: Follow existing recipe patterns (kebab-case)

Testing

# Run all cookbook tests
pnpm test

# Run validation tests only
pnpm test -- validate.test.ts

# Full validation pipeline (what CI runs)
pnpm run cookbook -- validate --recipe {name}

Architecture

Four key concepts:

  • Recipe: Reproducible sequence of steps applied to skeleton template
  • Ingredients: New files introduced by the recipe
  • Patches: Modifications to existing skeleton files
  • LLM Prompts: AI-assisted coding prompts paired with recipes

File structure:

cookbook/
├── src/
│   ├── commands/          # Command implementations
│   ├── lib/               # Core functionality (validate.ts, generate.ts, etc.)
│   └── index.ts           # CLI entry point
├── recipes/{recipe-name}/
│   ├── recipe.yaml        # Machine-readable definition
│   ├── ingredients/       # New files to add
│   ├── patches/           # File modifications
│   └── README.md          # Generated documentation
├── llms/{recipe-name}.prompt.md  # LLM prompts
└── recipe.schema.json     # JSON schema for validation

Commands

apply

Apply recipe to skeleton template.

pnpm run cookbook -- apply --recipe infinite-scroll

Options:

  • --recipe (required): Recipe name

Result: Skeleton template modified with all recipe changes


generate

Generate recipe from skeleton template changes.

# Generate from all changes
pnpm run cookbook -- generate --recipe my-feature

# Generate from specific file only
pnpm run cookbook -- generate --recipe my-feature --filePath app/routes/products.tsx

# Generate against different branch
pnpm run cookbook -- generate --recipe hotfix --referenceBranch origin/2025-01

Options:

  • --recipe (required): Recipe name
  • --filePath: Generate patch for single file only
  • --onlyFiles: Skip recipe.yaml generation
  • --referenceBranch: Branch to compare against (default: "origin/main")
  • --recipeManifestFormat: yaml or json (default: "yaml")

Result: Recipe folder with recipe.yaml, ingredients/, patches/, README.md

Process:

  1. Detects changes vs reference branch
  2. New files → ingredients/
  3. Modified files → patches/
  4. Deleted files → marked for deletion
  5. Extracts dependencies from package.json
  6. Validates generated recipe

validate

Validate recipe integrity and functionality.

# Validate all recipes
pnpm run cookbook -- validate

# Validate single recipe
pnpm run cookbook -- validate --recipe infinite-scroll

# Validate against specific Hydrogen version
pnpm run cookbook -- validate --recipe my-recipe --hydrogenPackagesVersion 2025.1.0

Options:

  • --recipe: Recipe name (validates all if omitted)
  • --hydrogenPackagesVersion: Specific version to test against

Pipeline:

  1. Schema validation → Verifies recipe.yaml
  2. Recipe application → Applies to skeleton
  3. Dependency installation → pnpm install
  4. TypeScript check → Verifies types
  5. Build → Ensures project builds
  6. Cleanup → Resets skeleton

Error format:

❌ Recipe 'gtm' - 5 error(s):

recipe.yaml:52      steps.0.step                  RecipeSchema: Invalid input: expected string, received number (actual value: 1)
                    README.md                     validateReadmeExists: README.md not found. Run: pnpm run cookbook render gtm

render

Generate README documentation from recipe.yaml.

# Render all recipes (GitHub format)
pnpm run cookbook -- render

# Render single recipe for shopify.dev
pnpm run cookbook -- render --recipe infinite-scroll --format shopify.dev

Options:

  • --recipe: Recipe name (renders all if omitted)
  • --format: "github" or "shopify.dev" (default: "github")

Result: README.md or README.shopify.md in recipe folders

Formats:

  • github: Collapsible sections, emoji, GitHub-flavored Markdown
  • shopify.dev: Platform-specific syntax and formatting

regenerate

Complete refresh: apply → generate → render.

# Regenerate single recipe
pnpm run cookbook -- regenerate --recipe infinite-scroll --format github

# Regenerate all recipes
pnpm run cookbook -- regenerate --format github

# Regenerate files only (preserve manual recipe.yaml edits)
pnpm run cookbook -- regenerate --recipe my-recipe --onlyFiles --format github

Options:

  • --recipe: Recipe name (regenerates all if omitted)
  • --format (required): Documentation format
  • --onlyFiles: Regenerate ingredients/patches only
  • --referenceBranch: Reference for generation (default: "origin/main")

Use when: Cookbook tooling updates or skeleton template changes


update

Update recipe to remain compatible with latest main branch.

# Update recipe to latest main
pnpm run cookbook -- update --recipe infinite-scroll

# Update against specific branch
pnpm run cookbook -- update --recipe legacy-feature --referenceBranch origin/2024-12

Options:

  • --recipe (required): Recipe name
  • --referenceBranch: Target branch (default: "origin/main")
  • --recipeManifestFormat: yaml or json (default: "yaml")

Process:

  1. Checkout recipe's original commit
  2. Apply recipe to historical state
  3. Create temporary update branch
  4. Merge target branch (interactive if conflicts)
  5. Regenerate recipe from merged state
  6. Cleanup temporary branches

Conflict resolution: Process pauses if merge fails. Resolve conflicts in your editor, confirm when prompted, then process continues.


schema

Generate JSON schema from Zod definitions for recipe.yaml validation and IDE support.

pnpm run cookbook -- schema

Result: Updated recipe.schema.json


Common Workflows

# New recipe development
pnpm run cookbook -- generate --recipe my-feature
pnpm run cookbook -- validate --recipe my-feature
pnpm run cookbook -- render --recipe my-feature

# Recipe maintenance
pnpm run cookbook -- update --recipe existing-feature
pnpm run cookbook -- validate --recipe existing-feature

# Bulk operations
pnpm run cookbook -- validate
pnpm run cookbook -- render
pnpm run cookbook -- regenerate --format github

Recipe YAML Structure

gid: 'uuid-v4-identifier'
title: 'Recipe Display Name'
summary: 'Brief description'
description: 'Detailed explanation'
commit: 'git-sha-hash'
ingredients:
  - path: 'templates/skeleton/app/components/NewFile.tsx'
    description: 'Component description'
steps:
  - step: "1"  # IMPORTANT: Quoted string, not bare integer
    type: PATCH
    name: 'app/root.tsx'
    description: 'What this step does'  # IMPORTANT: Required, non-null
    diffs:
      - file: 'app/root.tsx'
        patchFile: 'root.tsx.abc123.patch'

Repository Etiquette

Before committing recipes:

  1. Run validation: pnpm run cookbook -- validate --recipe {name}
  2. Fix all errors before pushing
  3. Include recipe changes in PR descriptions
  4. Update LLM prompts when recipe logic changes

Commit messages:

  • Format: feat(cookbook): add {recipe-name} recipe
  • Include what the recipe does and why it's useful

Integration Notes

  • Recipes guide development in any Hydrogen project
  • Template scaffolding: Apply recipes to skeleton for new projects
  • Feature implementation: Use recipes as implementation guides
  • Pattern reference: Demonstrate best practices for specific scenarios
  • Update recipes when skeleton template changes significantly
  • New Hydrogen features need new recipes
  • Recipe validation ensures compatibility with current Hydrogen versions

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.