Token导航 LogoToken导航

Agent Skill · 研究检索

shopify-storefront-api(Shopify storefront API 搜索)

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

shopify-storefront-api 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 52,043。

总安装 564周安装 24GitHub Stars 19下载 198核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:shopify-storefront-api(Shopify storefront API 搜索)
来源仓库:https://github.com/finsilabs/awesome-ecommerce-skills
仓库路径:skills/shopify-storefront-api
安装命令:
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill shopify-storefront-api
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill shopify-storefront-api

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助 Shopify Storefront API 的设计与文档整理工作。适合梳理 GraphQL endpoint、字段命名规范及错误码定义。使用时需结合实际业务语义与鉴权方式,避免凭空补充未经验证的字段。建议优先参考现有代码、schema 或接口样例提取事实性信息。

shopify-storefront-api 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/shopify-storefront-api

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill sho…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

shopify-storefront-api 怎么安装?

在终端执行 npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill shopify-store…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

shopify-storefront-api 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

shopify-storefront-api 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

shopify-storefront-api 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

shopify-storefront-api 用的人多吗?

公开数据是累计安装 564 次,近一周安装 24 次,下载 198 次,GitHub 19 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

shopify-storefront-api 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
shopify-storefront-api

Shopify storefront API 搜索 · 本页

56419接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Shopify Storefront API

Overview

The Shopify Storefront API is a public-facing GraphQL API that provides read and write access to a store's products, collections, cart, and checkout from any frontend. It uses a Storefront Access Token (distinct from Admin API tokens) and is safe to expose in client-side JavaScript. Use it to build headless storefronts with Next.js, Remix/Hydrogen, or any JS framework.

When to Use This Skill

  • When building a headless Shopify storefront with a custom frontend framework
  • When creating a React Native or Flutter mobile app that needs product and cart data
  • When embedding a Shopify buy button or product widget in a non-Shopify site
  • When using Shopify Hydrogen (Remix-based) for a fully custom storefront experience
  • When needing real-time product availability or pricing without the Admin API overhead
  • When implementing cart persistence across sessions with Shopify's hosted cart

Core Instructions

  1. Create a Storefront Access Token In Shopify Admin → Apps → Develop apps → Your App → API credentials → Storefront API access token. Or via the Admin API: ` // Via Admin API (one-time setup) const token = await admin.graphql( mutation {storefrontAccessTokenCreate(input: {title: "Headless Frontend"}) {storefrontAccessToken {accessToken title} userErrors {field message}}} ); Storefront Access Tokens do not use the shpat_` prefix (that prefix is for Admin API tokens). Storefront tokens are opaque strings safe to use in browser code — they only allow storefront-scoped operations.
  2. Set up the Storefront API client Using the official @shopify/storefront-api-client: npm install @shopify/storefront-api-client // lib/shopify.ts import {createStorefrontApiClient} from "@shopify/storefront-api-client"; export const storefront = createStorefrontApiClient({storeDomain: process.env.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN!, // e.g. "mystore.myshopify.com" apiVersion: "2025-01", publicAccessToken: process.env.NEXT_PUBLIC_SHOPIFY_STOREFRONT_TOKEN!,}); For server-side calls with a private access token (higher rate limits): export const storefrontServer = createStorefrontApiClient({storeDomain: process.env.SHOPIFY_STORE_DOMAIN!, apiVersion: "2025-01", privateAccessToken: process.env.SHOPIFY_STOREFRONT_PRIVATE_TOKEN!,});
  3. Query products and collections ` // lib/products.ts export async function getProducts(first = 20, after?: string) {const {data, errors} = await storefront.request( query GetProducts($first: Int!, $after: String) {products(first: $first, after: $after, sortKey: BEST_SELLING) {pageInfo {hasNextPage endCursor} edges {node {id title handle availableForSale priceRange {minVariantPrice {amount currencyCode} maxVariantPrice {amount currencyCode}} images(first: 1) {edges {node {url altText width height}}} variants(first: 10) {edges {node {id title availableForSale selectedOptions {name value} price {amount currencyCode}}}}}}}} , {variables: {first, after}}); if (errors) throw new Error(errors.message); return data.products;} `
  4. Create and manage a cart ` // lib/cart.ts // Create a new cart export async function cartCreate(lines: {merchandiseId: string; quantity: number}[]) {const {data} = await storefront.request( mutation CartCreate($lines: [CartLineInput!]) {cartCreate(input: {lines: $lines}) {cart {id checkoutUrl lines(first: 50) {edges {node {id quantity merchandise {... on ProductVariant {id title price {amount currencyCode} product {title handle}}}}}} cost {subtotalAmount {amount currencyCode} totalAmount {amount currencyCode}}} userErrors {field message}}} , {variables: {lines}}); return data.cartCreate;} // Add lines to existing cart export async function cartLinesAdd(cartId: string, lines: {merchandiseId: string; quantity: number}[]) {const {data} = await storefront.request( mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {cartLinesAdd(cartId: $cartId, lines: $lines) {cart {id checkoutUrl} userErrors {field message}}} , {variables: {cartId, lines}}); return data.cartLinesAdd;} `
  5. Persist cart ID and redirect to checkout // hooks/useCart.ts import {useState, useEffect} from "react"; import {cartCreate, cartLinesAdd} from "../lib/cart"; const CART_ID_KEY = "shopify_cart_id"; export function useCart() {const [cartId, setCartId] = useState<string | null>(null); const [checkoutUrl, setCheckoutUrl] = useState<string | null>(null); useEffect(() => {setCartId(localStorage.getItem(CART_ID_KEY));}, []); const addToCart = async (variantId: string, quantity = 1) => {const lines = [{merchandiseId: variantId, quantity}]; if (cartId) {const result = await cartLinesAdd(cartId, lines); setCheckoutUrl(result.cart.checkoutUrl);} else {const result = await cartCreate(lines); const newCartId = result.cart.id; localStorage.setItem(CART_ID_KEY, newCartId); setCartId(newCartId); setCheckoutUrl(result.cart.checkoutUrl);}}; const goToCheckout = () => {if (checkoutUrl) window.location.href = checkoutUrl;}; return {addToCart, goToCheckout, cartId};}

Examples

Product Detail Page with variant selection (Next.js)

// app/products/[handle]/page.tsx
import { storefront } from "@/lib/shopify";

async function getProduct(handle: string) {
  const { data } = await storefront.request(`
    query GetProduct($handle: String!) {
      product(handle: $handle) {
        id
        title
        descriptionHtml
        seo { title description }
        images(first: 10) {
          edges { node { url altText } }
        }
        options {
          id name values
        }
        variants(first: 100) {
          edges {
            node {
              id
              availableForSale
              selectedOptions { name value }
              price { amount currencyCode }
              compareAtPrice { amount currencyCode }
            }
          }
        }
      }
    }
  `, { variables: { handle } });
  return data.product;
}

export default async function ProductPage({ params }: { params: { handle: string } }) {
  const product = await getProduct(params.handle);
  // Render product with client-side variant picker
  return <ProductDetail product={product} />;
}

// Generate static params for all products
export async function generateStaticParams() {
  const { data } = await storefront.request(`
    query { products(first: 200) { edges { node { handle } } } }
  `);
  return data.products.edges.map(({ node }: { node: { handle: string } }) => ({
    handle: node.handle,
  }));
}

Predictive search

export async function predictiveSearch(query: string) {
  const { data } = await storefront.request(`
    query PredictiveSearch($query: String!) {
      predictiveSearch(query: $query, limit: 5, types: [PRODUCT, COLLECTION, ARTICLE]) {
        products {
          id title handle
          featuredImage { url altText }
          priceRange { minVariantPrice { amount currencyCode } }
        }
        collections {
          id title handle
          image { url altText }
        }
      }
    }
  `, { variables: { query } });
  return data.predictiveSearch;
}

Best Practices

  • Use private tokens server-side — private Storefront Access Tokens have higher rate limits (1000 req/s vs 100 req/s) and should never be exposed to browsers
  • Fetch product data at build time when possible (ISR or SSG) — the Storefront API rate limits apply per store, not per customer
  • Always check availableForSale on both product and variant before showing Add-to-Cart — a product can be available while individual variants are sold out
  • Paginate with after cursors, not offsets — the Storefront API uses cursor-based pagination; store endCursor for next-page queries
  • Cache collection and product queries with Next.js fetch cache tags or React cache — product data rarely changes in real time
  • Use @inContext directive for international pricing — @inContext(country: CA, language: EN) returns prices in the buyer's currency
  • Fragment reuse — define GraphQL fragments (e.g., ProductFragment) to avoid duplicating field selections across queries
  • Handle userErrors on all mutations — cart mutations return userErrors array; check it before updating local state

Common Pitfalls

ProblemSolution
Rate limit errors (429)Use private access token server-side and implement request batching; avoid N+1 product queries
Cart ID lost after page reloadPersist cartId in localStorage or a cookie; create a new cart only if none exists
Product prices show in wrong currencyAdd @inContext(country: $country) directive and pass buyer's country via geolocation
product(handle:) returns nullHandle slugified handles correctly — Shopify handles are lowercase with hyphens; check exact slug
Checkout redirect fails on mobile SafariUse window.location.href = checkoutUrl inside a user gesture handler, not async callback
Variant not found when selecting optionsUse client-side filtering of variants.edges by matching all selectedOptions, not just one

Related Skills

  • @shopify-admin-api
  • @shopify-app-development
  • @shopify-checkout-extensions
  • @headless-commerce-architecture
  • @graphql-api-design

平台分布

Codex

36.06%
按下载量换算71

Claude

32.59%
按下载量换算65

Cursor

17.72%
按下载量换算35

Gemini CLI

8.81%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills