Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

edge-commerce

БесплатноБез исполняемых скриптовНе проверен

Reduce latency globally by running geo-routing, A/B tests, and personalization logic at the network edge using Cloudflare Workers or Vercel

finsilabsот finsilabs★ 69 звёзд на GitHub

Об этом скилле

Edge Commerce

Overview

Edge computing executes code in the CDN PoP closest to each user, reducing latency from hundreds of milliseconds (round-trip to a central origin) to under 50ms. For e-commerce, this enables geo-routing (redirect UK users to a UK storefront), edge-side personalization (inject user tier into cached pages), instant A/B testing without origin round-trips, and distributed inventory caching via edge KV stores.

When to Use This Skill

  • When pages routed through a central origin have high TTFB (>300ms) for international users
  • When you need to redirect users to region-specific storefronts or localized product catalogs
  • When you want to run A/B tests without adding JavaScript that delays page rendering
  • When building a multi-region deployment where each region needs its own origin but shares a single domain

Core Instructions

Step 1: Determine your platform and what edge computing can do for you

Platform Edge Capabilities How to Use Them
Shopify Shopify's CDN (Fastly) already serves stores from global edge locations Use Shopify Markets for geo-routing and multi-currency without custom edge code; Markets handles currency, language, and domain routing natively
WooCommerce Add Cloudflare as your CDN/proxy to get edge capabilities Cloudflare Workers (free tier: 100k requests/day) adds edge logic; configure in Cloudflare dashboard after adding your domain
BigCommerce BigCommerce uses Fastly CDN globally Use BigCommerce's built-in multi-storefront feature for geo-routing; for custom edge logic add Cloudflare in front
Custom / Headless Full control — choose Cloudflare Workers, Vercel Edge Middleware, or Fastly Compute Build custom geo-routing, A/B testing, and personalization at the edge; see implementation below

Step 2: Configure geo-routing on your platform


Shopify: Use Shopify Markets

  1. Go to Settings → Markets in your Shopify admin
  2. Click Add market and select the countries/regions for your new market
  3. Configure per-market settings:
    • Currency: set the local currency (Shopify handles conversion automatically)
    • Language: assign a translated theme version
    • Domain/subdomain: e.g., uk.yourstore.com routes UK visitors automatically
  4. Shopify automatically redirects users to their market based on IP geolocation — no custom code needed
  5. For manual market URL overrides: Shopify's cookie-based market selector handles users who want to change their market

WooCommerce: Cloudflare Workers geo-routing

  1. Add your domain to Cloudflare (free plan is sufficient for geo-routing)
  2. Go to Workers & Pages → Create Worker in the Cloudflare dashboard
  3. Add a simple geo-redirect rule:
// Cloudflare Worker — deploy via Cloudflare dashboard
export default {
  async fetch(request) {
    const country = request.headers.get('CF-IPCountry') ?? 'US';
    const url = new URL(request.url);

    // Redirect UK users to UK store variant
    if (country === 'GB' && !url.pathname.startsWith('/uk')) {
      return Response.redirect(`https://${url.hostname}/uk${url.pathname}`, 302);
    }

    return fetch(request);
  }
};
  1. In Worker settings, add a Route that matches your domain: *yourstore.com/*
  2. For currency/language: use a WooCommerce multi-currency plugin (WPML + WooCommerce Multilingual, or Aelia Currency Switcher) that reads the URL path or a cookie set by the Worker

Custom / Headless

Vercel Edge Middleware (Next.js) for geo-routing:

// middleware.ts — runs at the edge globally, <5ms
import { NextRequest, NextResponse } from 'next/server';
import { geolocation } from '@vercel/functions';

const REGION_MAP: Record<string, string> = {
  GB: 'uk', DE: 'de', FR: 'fr', CA: 'ca', AU: 'au',
};

export function middleware(request: NextRequest) {
  const { country } = geolocation(request);
  const region = country ? REGION_MAP[country] : null;

  // Redirect root to regional store
  if (region && request.nextUrl.pathname === '/') {
    const url = request.nextUrl.clone();
    url.pathname = `/${region}`;
    return NextResponse.redirect(url, { status: 302 });
  }

  // Pass country to origin for catalog/pricing logic
  const response = NextResponse.next();
  if (country) response.headers.set('x-user-country', country);
  return response;
}

export const config = { matcher: ['/', '/products/:path*', '/collections/:path*'] };

Edge A/B testing (assign variant once, persist in cookie):

// In middleware.ts — no origin round-trip needed
const EXPERIMENTS = [
  { id: 'checkout-cta', buckets: [{ name: 'control', weight: 0.5 }, { name: 'variant-a', weight: 0.5 }] },
];

function assignVariant(buckets: Array<{name: string; weight: number}>) {
  let r = Math.random(), cumulative = 0;
  for (const b of buckets) {
    cumulative += b.weight;
    if (r < cumulative)
Полный SKILL.md на GitHub

Установить edge-commerce в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

claude-code
cursor
gemini-cli
copilot
codex-cli
kiro
opencode

Вложенные файлы

evals/cloudflare-workers-kv-caching-regional-p/criteria.jsonevals/cloudflare-workers-kv-caching-regional-p/task.mdevals/edge-personalization-with-shell-caching-/criteria.jsonevals/edge-personalization-with-shell-caching-/task.mdevals/vercel-edge-middleware-geo-routing-and-a/criteria.jsonevals/vercel-edge-middleware-geo-routing-and-a/task.mdtile.json

FAQ

Что делает скилл edge-commerce?

Reduce latency globally by running geo-routing, A/B tests, and personalization logic at the network edge using Cloudflare Workers or Vercel

Как установить скилл edge-commerce?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл edge-commerce запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить edge-commerce с