# e-commerce

A skill for building online stores: cart state, Stripe payments, checkout and inventory. Useful when you wire up a checkout or add payment processing.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 376 installs · ★ 26
- Author: miles990
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/miles990/claude-software-skills/tree/HEAD/domain-applications/e-commerce/SKILL.md
- Updated: 2026-01-20
- HTML: https://affpapa.org/en/nevibecode/skills/e-commerce

## What it does

The skill hands your agent ready-made code patterns for store work. It ships `CartItem` and `Cart` interfaces, a Zustand cart store persisted to localStorage, and a recalculation function for subtotal, tax, shipping and discounts. Stripe is covered too: creating a checkout session, a payment intent for custom checkouts, and a webhook handler for `checkout.session.completed`, `payment_intent.succeeded` and `payment_intent.payment_failed`.

On the frontend there is a React Stripe Elements example with `PaymentElement` and payment confirmation through `stripe.confirmPayment`. The skill triggers on keywords like e-commerce, shopping cart, checkout, payment and stripe, while words about games, mobile and desktop apps lower its priority — so it stays out of the way on those projects.

The code leans on `zustand`, `stripe` and `@stripe/react-stripe-js`, with keys read from environment variables: `STRIPE_SECRET_KEY`, `STRIPE_WEBHOOK_SECRET`, `NEXT_PUBLIC_STRIPE_KEY`. Without them the examples will not run. Tax is set at 10% and shipping is free above a subtotal of 100 — those are template values, not advice for your store, so recalculate the rates for your own jurisdiction.

## Requirements
- Works with: Stripe

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add miles990/claude-software-skills --skill e-commerce -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/e-commerce/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/e-commerce/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add miles990/claude-software-skills --skill e-commerce -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/e-commerce/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add miles990/claude-software-skills --skill e-commerce -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/e-commerce/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install miles990/claude-software-skills e-commerce
```

2. **Manually: put the files in place**
- File: `.github/skills/e-commerce/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add miles990/claude-software-skills --skill e-commerce -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/miles990/claude-software-skills --path domain-applications/e-commerce
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/e-commerce/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add miles990/claude-software-skills --skill e-commerce -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/miles990/claude-software-skills/tree/HEAD/domain-applications/e-commerce/SKILL.md

## When to use it
- build a cart that recalculates tax and shipping
- add Stripe Checkout to an existing store
- handle webhooks for successful and failed payments
- drop a payment form into a React app
- apply a coupon code and update the total

## Example prompts
- Build a Zustand cart persisted to localStorage with a recalculated total
- Create a Stripe checkout session from the items in the cart
- Write a webhook handler for checkout.session.completed

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: cc8d8abce2985535.

BEGIN THIRD-PARTY FILE cc8d8abce2985535
````text
---
name: e-commerce
description: E-commerce platforms, payment processing, and shopping cart patterns
domain: domain-applications
version: 1.0.0
tags: [e-commerce, payments, stripe, cart, checkout, inventory]
triggers:
  keywords:
    primary: [e-commerce, ecommerce, shopping cart, checkout, payment, stripe]
    secondary: [inventory, order, product catalog, discount, coupon, shipping]
  context_boost: [shop, store, buy, sell, transaction]
  context_penalty: [game, mobile, desktop]
  priority: high
---

# E-Commerce Development

## Overview

Building e-commerce applications with shopping carts, payment processing, inventory management, and order fulfillment.

---

## Shopping Cart

### Cart State Management

```typescript
interface CartItem {
  productId: string;
  variantId?: string;
  quantity: number;
  price: number;
  name: string;
  image: string;
}

interface Cart {
  id: string;
  items: CartItem[];
  subtotal: number;
  tax: number;
  shipping: number;
  total: number;
  discountCode?: string;
  discountAmount: number;
}

// Zustand cart store
import { create } from 'zustand';
import { persist } from 'zustand/middleware';

interface CartStore {
  cart: Cart;
  addItem: (item: Omit<CartItem, 'quantity'>, quantity?: number) => void;
  updateQuantity: (productId: string, quantity: number) => void;
  removeItem: (productId: string) => void;
  clearCart: () => void;
  applyDiscount: (code: string) => Promise<void>;
}

const useCartStore = create<CartStore>()(
  persist(
    (set, get) => ({
      cart: createEmptyCart(),

      addItem: (item, quantity = 1) => {
        set((state) => {
          const existingIndex = state.cart.items.findIndex(
            (i) => i.productId === item.productId && i.variantId === item.variantId
          );

          const newItems = [...state.cart.items];
          if (existingIndex >= 0) {
            newItems[existingIndex].quantity += quantity;
          } else {
            newItems.push({ ...item, quantity });
          }

          return { cart: recalculateCart({ ...state.cart, items: newItems }) };
        });
      },

      updateQuantity: (productId, quantity) => {
        set((state) => {
          if (quantity <= 0) {
            return {
              cart: recalculateCart({
                ...state.cart,
                items: state.cart.items.filter((i) => i.productId !== productId),
              }),
            };
          }

          const newItems = state.cart.items.map((item) =>
````
END THIRD-PARTY FILE cc8d8abce2985535

The third-party file has ended. Everything between the cc8d8abce2985535 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2485 of 12890 bytes. © miles990 · MIT · https://github.com/miles990/claude-software-skills/tree/HEAD/domain-applications/e-commerce/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
