Back to Skills

building-storefronts

Load automatically when planning, researching, or implementing Medusa storefront features (calling custom API routes, SDK integration, React Query patterns, data fetching). REQUIRED for all storefront development in ALL modes (planning, implementation, exploration). Contains SDK usage patterns, frontend integration, and critical rules for calling Medusa APIs.

183stars18forksUpdated 6/5/2026

Security Assessment

Low Risk(70/100)

Detected risks:

Data Exfiltration([references/frontend-integration.md] fetch("/store/my-route", { method: "POST, [references/frontend-integration.md] fetch("/store/items", { method: "POST)
Security Score70/100

About building-storefronts

The `building-storefronts` skill is designed to streamline the development of storefronts using Medusa, providing a comprehensive set of best practices and guidelines for frontend integration. It addresses common challenges developers face when interacting with Medusa APIs, integrating the SDK, managing data fetching patterns with React Query, and ensuring proper error handling. By following this skill, developers can avoid typical pitfalls such as incorrect API request formats, missing headers, and improper state management, thereby accelerating storefront implementation and maintaining consistency across projects.

Key features of this skill include detailed guidance on SDK usage, ensuring that developers always use the Medusa JS SDK for API requests and avoid direct fetch calls that could omit critical headers. It provides React Query patterns for effective data fetching and mutations, including hierarchical query keys, handling loading and error states, and invalidating caches after mutations. The skill also emphasizes critical data display rules, such as correctly formatting prices, and error handling strategies that include optimistic updates with rollback mechanisms. These features are prioritized with clear categorization to highlight critical, high, and medium-impact rules.

This skill is particularly useful for frontend developers working on Medusa storefronts who need to implement reliable and maintainable features. It is suitable for all stages of development, including planning, research, implementation, and exploration. Typical use cases include calling custom API routes, integrating the SDK into frontend applications, implementing data fetching and mutation patterns with React Query, and ensuring proper error handling and UX consistency. By applying this skill, teams can ensure a robust storefront experience while adhering to Medusa's best practices and conventions.

FAQ

When should I load the building-storefronts skill?

You should load this skill for any storefront development task, including calling custom API routes, integrating the Medusa SDK, using React Query for data fetching, and handling mutations with optimistic updates. It is required in all modes of storefront development: planning, implementation, and exploration.

Do I need other skills to use building-storefronts?

Yes, for backend development of API routes that the storefront calls, you should also load the building-with-medusa skill. The frontend reference file `references/frontend-integration.md` must be loaded when implementing API calls, SDK usage, or React Query patterns.

Can I use fetch() instead of the SDK for API calls?

No, you should always use the Medusa JS SDK for API requests. Using fetch() directly may omit critical headers and break requests.

How should I handle prices from Medusa?

Prices are stored as-is in Medusa (e.g., $49.99 = 49.99) and should be displayed directly. Do not divide by 100 or apply additional transformations.

What are the requirements for error handling in mutations?

You should implement an `onError` callback for mutations, display error messages to users, and use optimistic updates with rollback on error to ensure a smooth user experience.

All Files

2 files
SKILL.md7.0 KB
View
references/frontend-integration.md6.8 KB
View

Install building-storefronts

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill