Token导航 LogoToken导航

Agent Skill · 研究检索

magento-graphql(magento GraphQL 搜索)

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

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

总安装 524周安装 21GitHub Stars 19下载 170核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill magento-graphql

这个 Skill 是做什么的

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

用于辅助 API 设计、接口文档和错误码整理。适合梳理 endpoint、生成 OpenAPI 草稿或检查字段命名。使用时需确认业务语义、鉴权和分页规则。涉及接口文档时应从现有代码或样例中提取事实。安装前建议确认权限范围和维护状态。

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

来源仓库内路径:skills/magento-graphql

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

magento-graphql 怎么安装?

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

magento-graphql 支持哪些 AI 工具?

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

magento-graphql 需要什么权限?

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

magento-graphql 是免费的吗?

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

magento-graphql 用的人多吗?

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

magento-graphql 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

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

值得选的地方

  • 同时适配 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调用外部服务未明确有提醒
magento-graphql

magento GraphQL 搜索 · 本页

52419接触敏感数据未明确有提醒

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

SKILL.md 原文

Magento GraphQL API

Overview

Magento 2 (and Adobe Commerce) ships a comprehensive GraphQL API for storefront operations — product catalog, search, cart, checkout, customer authentication, and order history. The endpoint is /graphql and does not require an admin token for public catalog data. Cart and customer operations require a guest cart ID (UUID) or a Bearer token from customer login. PWA Studio (Venia) is built entirely on this API, making it the reference implementation for headless Magento.

When to Use This Skill

  • When building a React, Vue, or Next.js headless storefront on Magento 2
  • When creating a native mobile app that needs Magento product and checkout data
  • When implementing PWA Studio extensions that fetch custom data via GraphQL resolvers
  • When replacing REST API calls with more efficient GraphQL queries in existing headless projects
  • When building a custom GraphQL resolver to expose third-party or custom module data
  • When integrating a headless CMS with Magento's product catalog

Core Instructions

  1. Set up the GraphQL client Magento GraphQL uses standard HTTP POST to /graphql. Use Apollo Client or a lightweight fetch wrapper: ` // lib/magento.ts const MAGENTO_URL = process.env.NEXT_PUBLIC_MAGENTO_URL; // e.g. https://magento.example.com export async function magentoQuery<T>(query: string, variables: Record<string, unknown> = {}, token?: string): Promise<T> {const headers: Record<string, string> = {"Content-Type": "application/json", Store: process.env.NEXT_PUBLIC_MAGENTO_STORE_CODE?? "default",}; if (token) {headers["Authorization"] = Bearer ${token};} const response = await fetch(${MAGENTO_URL}/graphql, {method: "POST", headers, body: JSON.stringify({query, variables}), next: {revalidate: 300}, // Next.js ISR caching}); if (!response.ok) {throw new Error(Magento GraphQL HTTP error: ${response.status});} const {data, errors} = await response.json(); if (errors?.length) {throw new Error(errors[0].message);} return data as T;} `
  2. Query the product catalog ` // Fetch products by category UID or search export async function getProducts(params: {categoryUid?: string; search?: string; pageSize?: number; currentPage?: number;}) {return magentoQuery<{products: MagentoProductList}>( query GetProducts($search: String $filter: ProductAttributeFilterInput $pageSize: Int $currentPage: Int) {products(search: $search filter: $filter pageSize: $pageSize currentPage: $currentPage sort: {position: ASC}) {total_count page_info {current_page page_size total_pages} aggregations {attribute_code label count options {label value count}} items {uid sku name url_key... on SimpleProduct {price_range {minimum_price {regular_price {value currency} final_price {value currency} discount {percent_off amount_off}}}}... on ConfigurableProduct {configurable_options {attribute_code label values {uid label swatch_data {value}}} variants {attributes {uid label code value_index} product {sku stock_status price_range {minimum_price {final_price {value}}}}}} small_image {url label} thumbnail {url label} rating_summary review_count stock_status}}} , {search: params.search, filter: params.categoryUid? {category_uid: {eq: params.categoryUid}}: undefined, pageSize: params.pageSize?? 20, currentPage: params.currentPage?? 1,});} `
  3. Create guest cart and add items ` // Create a guest cart and get the cart ID export async function createGuestCart(): Promise<string> {const data = await magentoQuery<{createEmptyCart: string}>( mutation {createEmptyCart} ); return data.createEmptyCart; // Returns a UUID cart ID} // Add a simple product to cart export async function addSimpleProductToCart(cartId: string, sku: string, qty: number) {return magentoQuery( mutation AddSimpleProduct($cartId: String!, $sku: String!, $qty: Float!) {addSimpleProductsToCart(input: {cart_id: $cartId cart_items: [{data: {sku: $sku, quantity: $qty}}]}) {cart {items {uid quantity product {name sku} prices {price {value currency}}} prices {subtotal_excluding_tax {value currency} grand_total {value currency}}}}} , {cartId, sku, qty});} // Add a configurable product with selected variant export async function addConfigurableProductToCart(cartId: string, parentSku: string, variantSku: string, qty: number) {return magentoQuery( mutation AddConfigurable($cartId: String!, $parentSku: String!, $variantSku: String!, $qty: Float!) {addConfigurableProductsToCart(input: {cart_id: $cartId cart_items: [{parent_sku: $parentSku data: {sku: $variantSku, quantity: $qty}}]}) {cart {items {uid quantity product {name}}}}} , {cartId, parentSku, variantSku, qty});} `
  4. Authenticate customers and manage accounts ` // Customer login — returns a bearer token export async function loginCustomer(email: string, password: string): Promise<string> {const data = await magentoQuery<{generateCustomerToken: {token: string}}>( mutation Login($email: String!, $password: String!) {generateCustomerToken(email: $email, password: $password) {token}} , {email, password}); return data.generateCustomerToken.token;} // Get authenticated customer's cart export async function getCustomerCart(token: string) {return magentoQuery( query {customerCart {id items {uid quantity product {name sku small_image {url}} prices {price {value currency}}} prices {grand_total {value currency}}}} , {}, token);} // Get order history export async function getCustomerOrders(token: string, pageSize = 10) {return magentoQuery( query GetOrders($pageSize: Int) {customer {orders(pageSize: $pageSize, sort: {sort_field: CREATED_AT, sort_direction: DESC}) {total_count items {id number status order_date total {grand_total {value currency}} items {product_name product_sku quantity_ordered} shipping_address {firstname lastname city region {code} country_code}}}}} , {pageSize}, token);} `
  5. Create a custom GraphQL resolver in a Magento 2 module <?php // app/code/MyVendor/CustomGraphQL/etc/schema.graphqls type Query {myCustomProducts(brand: String @doc(description: "Filter by brand")): MyCustomProductOutput @resolver(class: "MyVendor\\CustomGraphQL\\Model\\Resolver\\CustomProducts") @doc(description: "Get custom product list")} type MyCustomProductOutput {items: [CustomProductItem] total_count: Int} type CustomProductItem {sku: String name: String brand: String custom_attribute: String} <?php // app/code/MyVendor/CustomGraphQL/Model/Resolver/CustomProducts.php namespace MyVendor\CustomGraphQL\Model\Resolver; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory; class CustomProducts implements ResolverInterface {public function __construct(private readonly CollectionFactory $collectionFactory) {} public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) {$collection = $this->collectionFactory->create(); $collection->addAttributeToSelect(['sku', 'name', 'brand', 'custom_attribute']); $collection->addAttributeToFilter('status', 1); $collection->addAttributeToFilter('visibility', ['neq' => 1]); if (!empty($args['brand'])) {$collection->addAttributeToFilter('brand', ['like' => '%'. $args['brand']. '%']);} $items = []; foreach ($collection as $product) {$items[] = ['sku' => $product->getSku(), 'name' => $product->getName(), 'brand' => $product->getData('brand'), 'custom_attribute' => $product->getData('custom_attribute'),];} return ['items' => $items, 'total_count' => $collection->getSize()];}}

Examples

Product detail page — configurable product with swatches

export async function getProductByUrlKey(urlKey: string) {
  return magentoQuery<{ products: { items: MagentoProduct[] } }>(`
    query GetProduct($urlKey: String!) {
      products(filter: { url_key: { eq: $urlKey } }) {
        items {
          uid sku name url_key
          meta_title meta_description
          description { html }
          short_description { html }
          ... on ConfigurableProduct {
            configurable_options {
              id uid label attribute_code position
              values {
                uid label
                swatch_data {
                  ... on ColorSwatchData { value }
                  ... on ImageSwatchData { thumbnail value }
                  ... on TextSwatchData { value }
                }
              }
            }
            variants {
              attributes { uid label code value_index }
              product {
                uid sku stock_status
                media_gallery { url label disabled }
                price_range {
                  minimum_price {
                    regular_price { value currency }
                    final_price { value currency }
                  }
                }
              }
            }
          }
          media_gallery { url label disabled position }
          reviews(pageSize: 5) {
            items {
              summary text created_at
              ratings_breakdown { name value }
              nickname
            }
          }
        }
      }
    }
  `, { urlKey });
}

Checkout flow — set shipping address and place order

export async function setShippingAddress(cartId: string, address: AddressInput) {
  return magentoQuery(`
    mutation SetShipping($cartId: String!, $address: CartAddressInput!) {
      setShippingAddressesOnCart(input: {
        cart_id: $cartId
        shipping_addresses: [{ address: $address }]
      }) {
        cart {
          shipping_addresses {
            available_shipping_methods {
              carrier_code method_code carrier_title method_title
              amount { value currency }
            }
          }
        }
      }
    }
  `, { cartId, address });
}

export async function placeOrder(cartId: string) {
  return magentoQuery<{ placeOrder: { order: { order_number: string } } }>(`
    mutation PlaceOrder($cartId: String!) {
      placeOrder(input: { cart_id: $cartId }) {
        order { order_number }
        errors { message code }
      }
    }
  `, { cartId });
}

Best Practices

  • Use the Store HTTP header to target specific store views — without it, Magento defaults to the default store and returns incorrect pricing/currency for multi-store setups
  • Enable GraphQL query caching in Magento via Varnish or built-in cache for public catalog queries — product list queries can be cached for minutes to reduce PHP execution
  • Use inline fragments for polymorphic product types — always include ... on SimpleProduct, ... on ConfigurableProduct, ... on BundleProduct where applicable
  • Persist the cart ID in a cookie — guest cart IDs (UUID) expire after 24 hours of inactivity; merge with customer cart after login using mergeCarts mutation
  • Batch related queries — Apollo Client batching or manual query merging reduces RTTs for pages that need product + category + CMS block data simultaneously
  • Implement proper error handling for errors array — GraphQL responses return 200 even for errors; always check errors property in the response body
  • Cache customer tokens securely — store bearer tokens in httpOnly cookies, not localStorage, to prevent XSS token theft

Common Pitfalls

ProblemSolution
Products missing from GraphQL but visible in AdminCheck the product's visibility attribute — products set to "Not Visible Individually" won't appear in catalog queries
Configurable product variants return empty stock_statusQuery the product field inside variants.product — stock is tracked at the simple product (variant) level, not the parent
Custom resolver not recognizedRun bin/magento setup:upgrade after adding new GraphQL schema files; also check schema.graphqls syntax carefully
Cart merge fails after customer loginCall mergeCarts(source_cart_id: $guestCartId, destination_cart_id: $customerCartId) — then discard the guest cart ID cookie
Slow GraphQL responsesEnable Magento's built-in GraphQL caching: bin/magento config:set system/full_page_cache/caching_application 1; use Varnish for public queries
Bearer token expired mid-sessionImplement token refresh: catch The current customer isn't authorized error and redirect to login or use refresh token if available

Related Skills

  • @magento-module-development
  • @magento-indexing-caching
  • @magento-multi-store
  • @headless-commerce-architecture
  • @graphql-api-design

平台分布

Codex

33.5%
按下载量换算57

Claude

28.36%
按下载量换算48

Cursor

20.54%
按下载量换算35

Gemini CLI

9.8%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

接触敏感数据

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

安装前确认

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

继续浏览同类 Skills