Token导航 LogoToken导航

Agent Skill · 前端设计

commerce-js-integration(商务 js 集成)

commerce-js-integration 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

commerce-js-integration 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在前端设计类的 10,216 个 Skill 里排第 6,920。

总安装 442周安装 19GitHub Stars 19下载 155核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill commerce-js-integration

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

commerce-js-integration 用于 Commerce.js(Chec)平台的 JavaScript SDK 集成。适用于快速添加电商功能到静态网站或 React/Vue/Svelte 项目等场景。

通过安装命令 npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill commerce-js-integration 从 GitHub 仓库安装使用。

安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/commerce-js-integration

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

commerce-js-integration 怎么安装?

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

commerce-js-integration 支持哪些 AI 工具?

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

commerce-js-integration 需要什么权限?

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

commerce-js-integration 是免费的吗?

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

commerce-js-integration 用的人多吗?

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

commerce-js-integration 安全吗?

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

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

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

适不适合你

更适合

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

不太适合

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

前端设计类 Skill 对比

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

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
commerce-js-integration

商务 js 集成 · 本页

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

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

SKILL.md 原文

Commerce.js Integration

Overview

Commerce.js (Chec) is a headless commerce platform offering a JavaScript SDK that wraps its REST API for managing products, carts, checkouts, and orders. It is designed for developers who want to add commerce functionality to any website or JavaScript framework without the complexity of a full e-commerce platform. The SDK handles product fetching, cart lifecycle, checkout token creation, and order capture in a straightforward, promise-based API.

When to Use This Skill

  • When you want to add e-commerce to a static site or simple React/Vue/Svelte project quickly
  • When you don't need a complex backend and want a managed commerce API without server-side code
  • When building a portfolio project, MVP, or proof-of-concept headless store
  • When your catalog is small (under 1,000 products) and you don't need custom fulfillment logic
  • When you want a simple SDK without managing a full Shopify or commercetools environment

Prerequisites & Platform Notes

This skill is written for custom/headless storefronts (Node.js, Python, or similar backend). The code examples use TypeScript/Node.js and can be adapted to any stack.

Shopify: Shopify Hydrogen is Shopify's headless framework. MACH/composable patterns apply when using Shopify as the commerce backend with a custom frontend, or when mixing Shopify with other best-of-breed services. WooCommerce: WooCommerce can serve as a headless backend via its REST API and WPGraphQL. These patterns apply when decoupling the frontend from WordPress. Magento: Magento's GraphQL API and PWA Studio support headless architectures. These composable patterns apply to Magento as a backend service in a MACH stack.

You'll need:

  • Node.js 18+ (or adapt to your backend language)
  • Stripe account and API keys
  • An email sending service (SendGrid, AWS SES, or Postmark)

Core Instructions

  1. Install the SDK and initialize the client npm install @chec/commerce.js import Commerce from '@chec/commerce.js'; // Public key is safe to expose in the browser const commerce = new Commerce(process.env.NEXT_PUBLIC_CHEC_PUBLIC_KEY, true); // true = debug mode Get your public API key from the Chec Dashboard under Developer → API keys.
  2. Fetch and display products // Fetch all products const {data: products} = await commerce.products.list({limit: 20, page: 1, sort_by: 'created', sort_direction: 'desc',}); // Fetch a single product by permalink (slug) const product = await commerce.products.retrieve('my-product-slug', {type: 'permalink'}); // Products include structured data console.log({id: product.id, name: product.name, price: product.price.formatted_with_symbol, // "$29.99" description: product.description, // HTML string from Chec CMS image: product.image?.url, variants: product.variants, // Size, color options}); React component example: import {useEffect, useState} from 'react'; import Commerce from '@chec/commerce.js'; const commerce = new Commerce(process.env.NEXT_PUBLIC_CHEC_PUBLIC_KEY!); export function ProductGrid() {const [products, setProducts] = useState<any[]>([]); const [loading, setLoading] = useState(true); useEffect(() => {commerce.products.list().then(({data}) => setProducts(data)).finally(() => setLoading(false));}, []); if (loading) return <div>Loading...</div>; return (<div className="grid grid-cols-3 gap-6"> {products.map(product => (<div key={product.id} className="border rounded-lg p-4"> <img src={product.image?.url} alt={product.name} className="w-full h-48 object-cover" /> <h2 className="mt-2 font-semibold">{product.name}</h2> <p className="text-gray-600">{product.price.formatted_with_symbol}</p> <AddToCartButton productId={product.id} /> </div>))} </div>);}
  3. Manage the cart Commerce.js stores the cart ID in localStorage automatically: // Get or create the current cart const cart = await commerce.cart.retrieve(); // Add a product to the cart const updatedCart = await commerce.cart.add(productId, quantity, {// Optional: specify variant selections variantId: 'variant_id_here', optionId: 'option_id_here',}); // Update line item quantity await commerce.cart.update(lineItemId, {quantity: 3}); // Remove a line item await commerce.cart.remove(lineItemId); // Empty the cart await commerce.cart.empty(); // Refresh the cart const refreshedCart = await commerce.cart.refresh(); Cart state management with React Context: // context/cart-context.tsx import {createContext, useContext, useState, useEffect} from 'react'; import Commerce from '@chec/commerce.js'; const commerce = new Commerce(process.env.NEXT_PUBLIC_CHEC_PUBLIC_KEY!); const CartContext = createContext<any>(null); export function CartProvider({children}: {children: React.ReactNode}) {const [cart, setCart] = useState<any>(null); useEffect(() => {commerce.cart.retrieve().then(setCart);}, []); const addToCart = async (productId: string, quantity = 1) => {const {cart: updated} = await commerce.cart.add(productId, quantity); setCart(updated);}; const removeFromCart = async (lineItemId: string) => {const {cart: updated} = await commerce.cart.remove(lineItemId); setCart(updated);}; return (<CartContext.Provider value={{cart, addToCart, removeFromCart}}> {children} </CartContext.Provider>);} export const useCart = () => useContext(CartContext);
  4. Generate a checkout token and capture the order ` // Step 1: Generate a checkout token from the cart const checkoutToken = await commerce.checkout.generateToken(cart.id, {type: 'cart'}); // Step 2: Get live checkout information (shipping options, taxes) const checkoutData = await commerce.checkout.getLive(checkoutToken.id); // Step 3: Capture the order const order = await commerce.checkout.capture(checkoutToken.id, {customer: {firstname: 'Jane', lastname: 'Doe', email: 'jane@example.com',}, shipping: {name: 'Jane Doe', street: '123 Main Street', town_city: 'San Francisco', county_state: 'US-CA', postal_zip_code: '94103', country: 'US',}, fulfillment: {shipping_method: checkoutData.shipping.available_options[0].id,}, payment: {gateway: 'stripe', stripe: {payment_method_id: stripePaymentMethodId, // from Stripe.js},},}); console.log(Order #${order.customer_reference} placed!); // Clear the cart after successful order await commerce.cart.refresh(); `
  5. Handle product variants ` const product = await commerce.products.retrieve(productId); // Variants are organized as variant groups (e.g., "Size") with options (e.g., "S", "M", "L") product.variants.forEach(variantGroup => {console.log(Variant group: ${variantGroup.name}); variantGroup.options.forEach(option => {console.log( - ${option.name}: +${option.price.formatted_with_symbol});});}); // When adding to cart, provide the full variant selection const selections = {[sizeVariantGroupId]: selectedSizeOptionId, [colorVariantGroupId]: selectedColorOptionId,}; await commerce.cart.add(product.id, 1, selections); `
  6. List and display orders // Requires a customer JWT (obtained via commerce.customer.login) const customerToken = await commerce.customer.login(email, password); const {data: orders} = await commerce.orders.getAllForCustomer({customer_token: customerToken.token,}); orders.forEach(order => {console.log({reference: order.customer_reference, status: order.status, total: order.order_value.formatted_with_symbol, items: order.order.line_items.map(item => item.product_name),});});

Examples

Complete Next.js product page

// app/products/[permalink]/page.tsx
import Commerce from '@chec/commerce.js';
import DOMPurify from 'isomorphic-dompurify';

// Server-side: use secret key to fetch product at build time
const commerce = new Commerce(process.env.CHEC_SECRET_KEY!);

export async function generateStaticParams() {
  const {data: products} = await commerce.products.list({limit: 200});
  return products.map((p: any) => ({permalink: p.permalink}));
}

export default async function ProductPage({params}: {params: {permalink: string}}) {
  const product = await commerce.products.retrieve(params.permalink, {type: 'permalink'});
  // Sanitize HTML from Chec CMS before rendering
  const safeDescription = DOMPurify.sanitize(product.description ?? '');

  return (
    <main>
      <img src={product.image?.url} alt={product.name} />
      <h1>{product.name}</h1>
      {/* Sanitized HTML rendered safely */}
      <div dangerouslySetInnerHTML={{__html: safeDescription}} />
      <p className="text-xl font-bold">{product.price.formatted_with_symbol}</p>
    </main>
  );
}

Cart item count badge

export function CartBadge() {
  const {cart} = useCart();
  const totalItems = cart?.total_unique_items ?? 0;

  return (
    <button className="relative">
      <ShoppingCartIcon />
      {totalItems > 0 && (
        <span className="absolute -top-2 -right-2 bg-red-500 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center">
          {totalItems}
        </span>
      )}
    </button>
  );
}

Best Practices

  • Use the public key on the client, secret key on the server — the public key can only read products and manage carts; the secret key can also manage orders and is not safe to expose in browser code
  • Initialize the Commerce client once — create a single instance in a module-level constant and import it; avoid creating a new instance on every render
  • Handle webhook events for order automation — configure Chec webhooks in the dashboard to POST to your server when orders are placed, updated, or refunded
  • Use checkout tokens, not cart IDs, for checkout — generateToken creates a time-limited, checkout-specific token; always pass this token to capture, never the raw cart ID
  • Refresh the cart after order capture — calling commerce.cart.refresh() after a successful order creates a fresh empty cart; the old cart ID is invalidated
  • Sanitize product description HTML before rendering — product descriptions are HTML from the Chec CMS; always run them through DOMPurify (isomorphic-dompurify works in both Node.js and browser) before rendering
  • Implement error handling for checkout capture — wrap commerce.checkout.capture in try/catch and map commerce.error codes to user-friendly messages

Common Pitfalls

ProblemSolution
Commerce is not a constructorEnsure you import as import Commerce from '@chec/commerce.js' (default import, not named)
Cart not persisting between page loadsCommerce.js stores the cart in localStorage under chec_cart_id; ensure localStorage is available and not blocked
Checkout token expiresCheckout tokens expire after 7 days; generate a new token from the cart immediately before starting checkout
Variant selections not appliedPass selections as the third argument to commerce.cart.add(): commerce.cart.add(id, qty, {variantGroupId: optionId})
Payment gateway not configuredEnable and configure the payment gateway (Stripe, Square, etc.) in the Chec Dashboard under Setup → Payment gateways

Related Skills

  • @jamstack-storefront
  • @shopify-hydrogen
  • @secure-checkout
  • @webhook-architecture

平台分布

Codex

38.52%
按下载量换算60

Claude

30.78%
按下载量换算48

Cursor

18.17%
按下载量换算28

Gemini CLI

9.78%
按下载量换算15

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

接触敏感数据

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

安装前确认

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

继续浏览同类 Skills