storefront-best-practices by medusajs/medusa-agent-skills
npx skills add https://github.com/medusajs/medusa-agent-skills --skill storefront-best-practices构建现代化、高转化率的电子商务店铺前端的全面指南,涵盖 UI/UX 模式、组件设计、布局结构、SEO 优化和移动端响应式设计。
处理任何店铺前端任务时,务必加载此技能:
应触发此技能的示例提示:
⚠️ 在创建任何 UI 组件之前,务必加载 reference/design.md
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
reference/design.md 以发现用户偏好reference/connecting-to-backend.mdreference/medusa.md 以获取 SDK 设置、定价、区域和 Medusa 模式reference/components/navbar.md、reference/components/hero.md、reference/components/footer.md 和 reference/layouts/home-page.mdreference/components/navbar.md,可选加载 reference/components/megamenu.mdreference/layouts/product-listing.mdreference/layouts/product-details.mdreference/layouts/checkout.mdreference/seo.mdreference/mobile-responsiveness.md最低要求: 在实施之前,至少加载 1-2 个与你的具体任务相关的参考文件。
重要提示:如果你为实施店铺前端功能创建计划,请在计划中包含以下内容:
在实施计划中的每个组件、页面、布局或功能时:
示例计划结构:
Task 1: Implement Navigation
- Load reference/components/navbar.md
- Follow patterns from navbar.md (dynamic category fetching, cart visibility, etc.)
- Refer to skill for common mistakes (e.g., hardcoding categories)
Task 2: Implement Product Listing Page
- Load reference/layouts/product-listing.md
- Follow pagination/filtering patterns from product-listing.md
- Use reference/components/product-card.md for product grid items
- Check skill for backend integration guidance
Task 3: Implement Checkout Flow
- Load reference/layouts/checkout.md
- Load reference/medusa.md for Medusa payment integration
- Follow component architecture recommendations (separate step components)
- Refer to skill for payment method fetching requirements
为什么这很重要:
aria-live="polite" - 没有它,屏幕阅读器将不会播报env(safe-area-inset-bottom) - 否则 iOS 主页指示器会切断购买按钮loading="lazy" - 不要依赖浏览器默认设置在编写连接到后端的代码之前,你必须遵循此确切工作流程:
步骤 1:暂停 - 先不要编写代码
步骤 2:查询文档或 MCP 服务器
步骤 3:验证你的发现
sdk.store.cart.methodName(params)"步骤 4:只有此时才能编写代码
步骤 5:检查 TypeScript 错误
这不是可选的 - 这是强制性的错误预防
以下是关键错误:
特别针对 Medusa:
reference/medusa.md 以获取 Medusa 特定模式(区域、定价等)/products/[handle] 或 /products/$handle 这样的动态路由,而不是 /products/shirt.tsx/categories/[handle] 或 /categories/$handle 这样的动态路由,而不是 /categories/women.tsxapp/products/[handle]/page.tsx 或 app/products/[id]/page.tsxpages/products/[handle].tsxroutes/products/[handle]/+page.svelteroutes/products/$handle.tsxroutes/products.$handle.tsx当你需要在实现模式之间进行选择时,加载相关的参考文件:
reference/layouts/checkout.mdreference/components/navbar.md 和 reference/components/megamenu.mdreference/layouts/product-listing.mdreference/components/search.mdreference/mobile-responsiveness.mdreference/layouts/product-details.mdreference/components/cart-popup.md 和 reference/layouts/cart.mdreference/layouts/product-details.md 和 reference/layouts/checkout.md每个参考文件都包含决策框架和特定标准,以帮助你根据上下文选择正确的模式。
reference/connecting-to-backend.md - 框架检测、API 设置、后端集成模式
reference/medusa.md - Medusa SDK 集成、定价、区域、TypeScript 类型
reference/design.md - 用户偏好、品牌标识、设计系统
reference/seo.md - 元标签、结构化数据、核心网页指标
reference/mobile-responsiveness.md - 移动优先设计、响应式断点、触摸交互
reference/components/navbar.md - 桌面/移动端导航、徽标、菜单、购物车图标,所有页面都需要加载
reference/components/megamenu.md - 类别组织、特色产品、移动端替代方案
reference/components/cart-popup.md - 加入购物车反馈、迷你购物车显示
reference/components/country-selector.md - 国家/地区选择、货币、定价、Medusa 区域
reference/components/breadcrumbs.md - 类别层次结构、结构化数据标记
reference/components/search.md - 搜索输入、自动补全、结果、筛选器
reference/components/product-reviews.md - 评价显示、评分聚合、提交
reference/components/hero.md - 英雄布局、行动号召放置、图片优化
reference/components/popups.md - 新闻通讯注册、折扣弹窗、退出意图
reference/components/footer.md - 内容组织、导航、社交媒体,所有页面都需要加载
reference/components/product-card.md - 产品图片、定价、加入购物车、徽章
reference/components/product-slider.md - 轮播实现、移动端滑动、可访问性
reference/layouts/home-page.md - 英雄区、特色类别、产品列表
reference/layouts/product-listing.md - 网格/列表视图、筛选器、排序、分页
reference/layouts/product-details.md - 图片库、变体选择、相关产品
reference/layouts/cart.md - 购物车商品、数量更新、促销代码
reference/layouts/checkout.md - 多步骤/单页、地址表单、支付
reference/layouts/order-confirmation.md - 订单号、摘要、配送信息
reference/layouts/account.md - 仪表板、订单历史、地址簿
reference/layouts/static-pages.md - 常见问题、关于、联系、配送/退货政策
reference/features/wishlist.md - 加入心愿单、心愿单页面、移至购物车
reference/features/promotions.md - 促销横幅、折扣代码、销售徽章
重要提示:对于下面的每个步骤,在实施该步骤之前加载引用的文件。
1. Discovery Phase → Read design.md for user preferences
2. Foundation Setup → Read connecting-to-backend.md (or medusa.md for Medusa), mobile-responsiveness.md, seo.md
3. Core Components → Implement navbar.md, footer.md
4. Home Page → Read home-page.md
5. Product Browsing → Read product-listing.md, product-card.md, search.md
6. Product Details → Read product-details.md, product-reviews.md
7. Cart & Checkout → Read cart-popup.md, cart.md, checkout.md, order-confirmation.md
8. User Account → Read account.md
9. Additional Features → Read wishlist.md, promotions.md
10. Optimization → SEO audit (seo.md), mobile testing (mobile-responsiveness.md)
即使你创建了实施计划,在实施每个步骤时也要参考此技能并加载相关的参考文件。
Browse → View → Cart → Checkout
Browse: home-page.md → product-listing.md
View: product-details.md + product-reviews.md
Cart: cart-popup.md → cart.md
Checkout: checkout.md → order-confirmation.md
对于产品网格和筛选 → product-listing.md 和 product-card.md
对于产品卡片 → product-card.md
对于导航 → navbar.md 和 megamenu.md
对于搜索功能 → search.md
对于结账流程 → checkout.md
对于促销和销售 → promotions.md
在实施之前,请考虑:
design.md 以发现设计风格偏好Medusa 是一个现代化、灵活的电子商务后端。在以下情况下考虑使用 Medusa:
有关详细的 Medusa 集成指南,请参阅 reference/medusa.md。有关通用后端模式,请参阅 reference/connecting-to-backend.md。
所有指南都是框架无关的。在代码演示有帮助的地方,示例使用 React/TypeScript,但模式适用于:
启动必需(核心购物流程):
锦上添花(如果有时间可以添加):
用户依赖(实施前询问):
在实施之前,请注意这些常见的电子商务特定陷阱:
1. 购物车和导航错误
aria-live="polite" - 没有它,屏幕阅读器将不会播报购物车更新position: relative(大型菜单无法正确定位)absolute left-0)right-0 或 w-full,而不仅仅是 w-auto)2. 产品浏览错误
/products/[handle] 这样的动态路由,而不是 /products/shirt.tsx)3. 产品详情错误
4. 设计和一致性错误
reference/design.md - 导致颜色、字体和样式不一致5. 结账和转化错误
6. 移动端体验错误
7. 性能和 SEO 错误
loading="lazy"8. 后端集成错误
@medusajs/types 包region_id 查询参数(导致缺少或错误的定价)ssr.noExternal: ['@medusajs/js-sdk'])每周安装次数
880
仓库
GitHub 星标数
115
首次出现
2026 年 1 月 30 日
安全审计
安装于
codex784
github-copilot778
opencode777
gemini-cli775
kimi-cli729
amp728
Comprehensive guidance for building modern, high-converting ecommerce storefronts covering UI/UX patterns, component design, layout structures, SEO optimization, and mobile responsiveness.
ALWAYS load this skill when working on ANY storefront task:
Example prompts that should trigger this skill:
⚠️ ALWAYS loadreference/design.md BEFORE creating ANY UI component
Load these references based on what you're implementing:
reference/design.md first to discover user preferencesreference/connecting-to-backend.md firstreference/medusa.md for SDK setup, pricing, regions, and Medusa patternsreference/components/navbar.md, reference/components/hero.md, reference/components/footer.md, and reference/layouts/home-page.mdreference/components/navbar.md and optionally Minimum requirement: Load at least 1-2 reference files relevant to your specific task before implementing.
IMPORTANT: If you create a plan for implementing storefront features, include the following in your plan:
When implementing each component, page, layout, or feature in the plan:
Example plan structure:
Task 1: Implement Navigation
- Load reference/components/navbar.md
- Follow patterns from navbar.md (dynamic category fetching, cart visibility, etc.)
- Refer to skill for common mistakes (e.g., hardcoding categories)
Task 2: Implement Product Listing Page
- Load reference/layouts/product-listing.md
- Follow pagination/filtering patterns from product-listing.md
- Use reference/components/product-card.md for product grid items
- Check skill for backend integration guidance
Task 3: Implement Checkout Flow
- Load reference/layouts/checkout.md
- Load reference/medusa.md for Medusa payment integration
- Follow component architecture recommendations (separate step components)
- Refer to skill for payment method fetching requirements
Why this matters:
aria-live="polite" - Screen readers won't announce without itenv(safe-area-inset-bottom) - iOS home indicator will cut off purchase buttons otherwiseloading="lazy" to product images below fold - Don't rely on browser defaultsYOU MUST FOLLOW THIS EXACT WORKFLOW BEFORE WRITING CODE THAT CONNECTS TO BACKEND:
Step 1: PAUSE - Do NOT write code yet
Step 2: QUERY the documentation or MCP server
Step 3: VERIFY what you found
sdk.store.cart.methodName(params)"Step 4: ONLY THEN write the code
Step 5: CHECK for TypeScript errors
THIS IS NOT OPTIONAL - THIS IS MANDATORY ERROR PREVENTION
It is a CRITICAL ERROR to:
For Medusa specifically:
reference/medusa.md for Medusa-specific patterns (regions, pricing, etc.)/products/[handle] or /products/$handle, NOT /products/shirt.tsx/categories/[handle] or /categories/$handle, NOT /categories/women.tsxapp/products/[handle]/page.tsx or app/products/[id]/page.tsxWhen you need to choose between implementation patterns, load the relevant reference file:
reference/layouts/checkout.mdreference/components/navbar.md and reference/components/megamenu.mdreference/layouts/product-listing.mdreference/components/search.mdreference/mobile-responsiveness.mdreference/layouts/product-details.mdEach reference file contains decision frameworks with specific criteria to help you choose the right pattern for your context.
reference/connecting-to-backend.md - Framework detection, API setup, backend integration patterns
reference/medusa.md - Medusa SDK integration, pricing, regions, TypeScript types
reference/design.md - User preferences, brand identity, design systems
reference/seo.md - Meta tags, structured data, Core Web Vitals
reference/mobile-responsiveness.md - Mobile-first design, responsive breakpoints, touch interactions
reference/components/navbar.md - Desktop/mobile navigation, logo, menu, cart icon, load for ALL pages
reference/components/megamenu.md - Category organization, featured products, mobile alternatives
reference/components/cart-popup.md - Add-to-cart feedback, mini cart display
reference/components/country-selector.md - Country/region selection, currency, pricing, Medusa regions
reference/components/breadcrumbs.md - Category hierarchy, structured data markup
reference/components/search.md - Search input, autocomplete, results, filters
reference/components/product-reviews.md - Review display, rating aggregation, submission
reference/components/hero.md - Hero layouts, CTA placement, image optimization
reference/components/popups.md - Newsletter signup, discount popups, exit-intent
reference/components/footer.md - Content organization, navigation, social media, load for ALL pages
reference/components/product-card.md - Product images, pricing, add to cart, badges
reference/components/product-slider.md - Carousel implementation, mobile swipe, accessibility
reference/layouts/home-page.md - Hero, featured categories, product listings
reference/layouts/product-listing.md - Grid/list views, filters, sorting, pagination
reference/layouts/product-details.md - Image gallery, variant selection, related products
reference/layouts/cart.md - Cart items, quantity updates, promo codes
reference/layouts/checkout.md - Multi-step/single-page, address forms, payment
reference/layouts/order-confirmation.md - Order number, summary, delivery info
reference/layouts/account.md - Dashboard, order history, address book
reference/layouts/static-pages.md - FAQ, about, contact, shipping/returns policies
reference/features/wishlist.md - Add to wishlist, wishlist page, move to cart
reference/features/promotions.md - Promotional banners, discount codes, sale badges
IMPORTANT: For each step below, load the referenced files BEFORE implementing that step.
1. Discovery Phase → Read design.md for user preferences
2. Foundation Setup → Read connecting-to-backend.md (or medusa.md for Medusa), mobile-responsiveness.md, seo.md
3. Core Components → Implement navbar.md, footer.md
4. Home Page → Read home-page.md
5. Product Browsing → Read product-listing.md, product-card.md, search.md
6. Product Details → Read product-details.md, product-reviews.md
7. Cart & Checkout → Read cart-popup.md, cart.md, checkout.md, order-confirmation.md
8. User Account → Read account.md
9. Additional Features → Read wishlist.md, promotions.md
10. Optimization → SEO audit (seo.md), mobile testing (mobile-responsiveness.md)
Even if you create an implementation plan, refer back to the skill and load relevant reference files when implementing each step.
Browse → View → Cart → Checkout
Browse: home-page.md → product-listing.md
View: product-details.md + product-reviews.md
Cart: cart-popup.md → cart.md
Checkout: checkout.md → order-confirmation.md
For product grids and filtering → product-listing.md and product-card.md For product cards → product-card.md For navigation → navbar.md and megamenu.md For search functionality → search.md For checkout flow → checkout.md For promotions and sales → promotions.md
Before implementing, consider:
design.md to discover design style preferencesMedusa is a modern, flexible ecommerce backend. Consider Medusa when:
For detailed Medusa integration guidance, see reference/medusa.md. For general backend patterns, see reference/connecting-to-backend.md.
All guidance is framework-agnostic. Examples use React/TypeScript where code demonstrations are helpful, but patterns apply to:
Mandatory for launch (core shopping flow):
Nice-to-have (add if time permits):
User-dependent (ask before implementing):
Before implementing, watch out for these common ecommerce-specific pitfalls:
1. Cart and Navigation Mistakes
aria-live="polite" on cart count - Screen readers won't announce cart updates without itposition: relative (megamenu won't position correctly)absolute left-0 on megamenu)right-0 or w-full, not just w-auto)2. Product Browsing Mistakes
/products/[handle] instead of /products/shirt.tsx)3. Product Details Mistakes
4. Design and Consistency Mistakes
reference/design.md before creating ANY UI component - Leads to inconsistent colors, fonts, and styles5. Checkout and Conversion Mistakes
6. Mobile Experience Mistakes
7. Performance and SEO Mistakes
loading="lazy" to images below the fold8. Backend Integration Mistakes
@medusajs/types packageregion_id query parameter (causes missing or incorrect pricing)ssr.noExternal: ['@medusajs/js-sdk'] to vite.config.ts)Weekly Installs
880
Repository
GitHub Stars
115
First Seen
Jan 30, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex784
github-copilot778
opencode777
gemini-cli775
kimi-cli729
amp728
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
Gemini Interactions API 指南:统一接口、智能体交互与服务器端状态管理
833 周安装
Apollo MCP 服务器:让AI代理通过GraphQL API交互的完整指南
834 周安装
智能体记忆系统构建指南:分块策略、向量存储与检索优化
835 周安装
Scrapling官方网络爬虫框架 - 自适应解析、绕过Cloudflare、Python爬虫库
836 周安装
抽奖赢家选取器 - 随机选择工具,支持CSV、Excel、Google Sheets,公平透明
838 周安装
Medusa 前端开发指南:使用 SDK、React Query 构建电商商店
839 周安装
reference/components/megamenu.mdreference/layouts/product-listing.md firstreference/layouts/product-details.md firstreference/layouts/checkout.md firstreference/seo.md firstreference/mobile-responsiveness.md firstpages/products/[handle].tsxroutes/products/[handle]/+page.svelteroutes/products/$handle.tsxroutes/products.$handle.tsxreference/components/cart-popup.md and reference/layouts/cart.mdreference/layouts/product-details.md and reference/layouts/checkout.md