Token导航 LogoToken导航

Agent Skill · 前端设计

ecommerce-caching(电子商务缓存)

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

ecommerce-caching 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 6,853。

总安装 447周安装 19GitHub Stars 19下载 157核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

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

这个 Skill 是做什么的

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

电商多层缓存实施方案,涵盖 CDN、Redis 与应用层缓存,解决个性化与实时性问题。适用于商品详情页加速与购物车状态保持,需处理登录态与库存变化。支持按事件触发缓存失效,保障价格、库存与促销信息的即时一致性。涉及用户隐私数据时应启用加密缓存与访问控制,防止信息泄露。

ecommerce-caching 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/ecommerce-caching

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

ecommerce-caching 怎么安装?

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

ecommerce-caching 支持哪些 AI 工具?

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

ecommerce-caching 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

ecommerce-caching 是免费的吗?

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

ecommerce-caching 用的人多吗?

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

ecommerce-caching 安全吗?

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

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

值得选的地方

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

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

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

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 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只读未明确通过
ecommerce-caching

电子商务缓存 · 本页

44719操作浏览器未明确通过

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

SKILL.md 原文

E-commerce Caching

Overview

Implement multi-layer caching for e-commerce applications covering CDN edge caching, application-level caching (Redis), and full-page caching with cart-aware invalidation. This skill addresses the unique challenges of caching commerce pages — personalized content (cart count, logged-in state), frequently changing inventory and prices, and the need for instant cache purging when products or prices change.

When to Use This Skill

  • When product and collection pages are slow due to database queries and API calls
  • When implementing a CDN or edge caching strategy for a storefront
  • When adding Redis caching for product data, inventory, and session management
  • When building cache invalidation logic that reacts to product, price, or inventory changes
  • When optimizing time-to-first-byte (TTFB) for high-traffic sale events

Core Instructions

Step 1: Determine your platform and what you can control

PlatformWhat's Managed For YouWhat You Control
ShopifyCDN, full-page caching, server infrastructureLiquid template efficiency, image optimization, app performance, HTTP cache headers on custom routes
WooCommerceNothing (you own the server)Everything: page cache, object cache, CDN, database queries
BigCommerceCDN, full-page caching, server infrastructureTheme performance, image optimization, app overhead
Custom / HeadlessNothing (you own the server)Everything: CDN configuration, Redis, Varnish, application cache, invalidation

Step 2: Platform-specific caching configuration


Shopify

Shopify handles CDN and full-page caching automatically. Your optimization levers are:

Theme performance (Liquid):

  1. Reduce the number of Liquid {% render %} calls in your product and collection templates — each render tag adds rendering time
  2. In Online Store → Themes → Edit code, avoid loops that query the catalog repeatedly; use {% liquid %} blocks for conditional logic
  3. Enable Shopify's Lazy loading for product images in Theme settings — this prevents below-fold images from blocking page load

App performance:

  1. Audit your installed apps in Apps → App usage or with Shopify's Storefront Performance dashboard (Online Store → Themes → View report)
  2. Apps that inject scripts into every page (especially checkout) can add 200–500ms per page load
  3. Remove unused apps — even inactive apps with installed scripts slow down your store
  4. For apps that add storefront JavaScript, check if they support Delayed loading (loads after page interactive) in their settings

CDN image optimization: Shopify automatically serves images via its CDN with WebP conversion and responsive sizing. To ensure you're using this:

  1. Always use Shopify's Liquid img_url filter to generate image URLs — this routes through the Shopify CDN
  2. Add width and height attributes to all <img> tags in your Liquid to prevent Cumulative Layout Shift
  3. In Online Store → Themes → Customize → Theme settings → Images, verify lazy loading is enabled

WooCommerce

WooCommerce runs on your hosting infrastructure. Implement a three-layer caching stack:

Layer 1: PHP Object Cache (Redis)

  1. Your hosting must support Redis (WP Engine, Kinsta, Cloudways, and most managed WordPress hosts do — check your control panel)
  2. Install Redis Object Cache (free, wordpress.org)
  3. Go to Settings → Redis and click Enable Object Cache
  4. This caches all WordPress and WooCommerce database queries in Redis; most stores see 60–80% reduction in database load

Layer 2: Page Cache

  1. Install WP Rocket ($59/yr — the most effective WordPress page cache plugin) or LiteSpeed Cache (free, if your host uses LiteSpeed)
  2. In WP Rocket: go to Cache → Enable caching for logged-in WordPress users — keep this off; cached pages should only serve anonymous visitors
  3. Enable Preload cache: WP Rocket will crawl and pre-cache your product and shop pages
  4. Enable Separate cache file for mobile if your mobile and desktop layouts differ significantly

Layer 3: CDN

  1. Configure Cloudflare (free tier available) as your CDN:

- Add your domain to Cloudflare and point DNS to Cloudflare's nameservers - Install the Cloudflare WordPress plugin to enable cache purging from wp-admin - Set Caching level to Standard in Cloudflare dashboard - In WP Rocket, enable Cloudflare integration in the CDN settings — this allows WP Rocket to purge Cloudflare cache when you update products

  1. Or use BunnyCDN ($1/mo for bandwidth) which integrates with WP Rocket natively

Cache invalidation for WooCommerce: WP Rocket and LiteSpeed Cache automatically purge cached pages when products are updated via the wp-admin. For programmatic updates, add this to your child theme's functions.php:

// Purge product page cache when inventory or price changes
add_action('woocommerce_product_set_stock', function($product) {
    if (function_exists('rocket_clean_post')) {
        rocket_clean_post($product->get_id()); // WP Rocket
    }
    if (class_exists('LiteSpeed_Cache_API')) {
        LiteSpeed_Cache_API::purge_post($product->get_id()); // LiteSpeed
    }
});

Custom / Headless

Cache layers for a headless Node.js storefront:

Browser → CDN (Cloudflare/Fastly) → Application server → Redis → Database
          [Static assets: 1yr]     [Product data: 5min]  [Catalog queries]
          [Product pages: 5min]
          [Cart: never]

HTTP cache headers by content type:

// middleware/cacheHeaders.js
export function setCacheHeaders(req, res, next) {
  const path = req.path;

  // Cart, checkout, account — never cache (personalized)
  if (path.startsWith('/cart') || path.startsWith('/checkout') || path.startsWith('/account')) {
    res.setHeader('Cache-Control', 'private, no-store');
    return next();
  }

  // Product pages — 5 min at CDN, serve stale while revalidating
  if (path.match(/^\/products\/[\w-]+$/)) {
    res.setHeader('Cache-Control', 'public, max-age=60, s-maxage=300, stale-while-revalidate=600');
    res.setHeader('Surrogate-Key', `product product-${path.split('/').pop()}`);
    return next();
  }

  // Collection pages
  if (path.match(/^\/collections\/[\w-]+$/)) {
    res.setHeader('Cache-Control', 'public, max-age=120, s-maxage=600, stale-while-revalidate=1200');
    res.setHeader('Surrogate-Key', `collection collection-${path.split('/').pop()}`);
    return next();
  }

  // Static assets with content hash in filename — immutable for 1 year
  if (path.match(/\.(js|css|png|jpg|webp|woff2|svg)(\?|$)/)) {
    res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
    return next();
  }

  next();
}

Redis product cache (cache-aside pattern):

// lib/productCache.js
import Redis from 'ioredis';
const redis = new Redis(process.env.REDIS_URL);

export async function getCachedProduct(productId, fetchFn) {
  const key = `product:${productId}`;
  const cached = await redis.get(key);
  if (cached) return JSON.parse(cached);

  const product = await fetchFn();
  // Non-blocking write — serve response immediately
  redis.setex(key, 300, JSON.stringify(product)).catch(() => {});
  return product;
}

export async function invalidateProduct(productId, productSlug, collectionIds = []) {
  const keys = [
    `product:${productId}`,
    `product:slug:${productSlug}`,
    ...collectionIds.map(id => `collection:${id}`),
  ];
  await redis.del(...keys);
}

Personalized content (cart count, inventory) loaded client-side after cached page:

<!-- Serve the cached page with placeholder for personalized data -->
<span id="cart-count" data-hydrate="true">0</span>

<script>
  // Load personalized data after the cached page renders
  fetch('/api/session-data', { credentials: 'include' })
    .then(r => r.json())
    .then(data => {
      document.getElementById('cart-count').textContent = data.cartCount;
    });
</script>
// GET /api/session-data — NOT cached, reads from Redis
export async function sessionData(req, res) {
  res.setHeader('Cache-Control', 'private, no-store');
  const sessionId = req.cookies.session_id;
  const cartCount = sessionId ? await redis.get(`cart:count:${sessionId}`) : '0';
  res.json({ cartCount: parseInt(cartCount ?? '0') });
}

Event-driven cache invalidation:

// React to product/price changes from your webhook or admin
export async function onProductUpdated({ productId, productSlug, collectionIds }) {
  // 1. Invalidate Redis cache
  await invalidateProduct(productId, productSlug, collectionIds);

  // 2. Purge CDN (Cloudflare example)
  await fetch(`https://api.cloudflare.com/client/v4/zones/${CF_ZONE_ID}/purge_cache`, {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${CF_TOKEN}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({ tags: [`product-${productSlug}`] }), // tag-based purge (Cloudflare Enterprise)
    // For free/Pro Cloudflare, use files: [`https://store.com/products/${productSlug}`]
  });
}

Best Practices

  • Use stale-while-revalidate — serve cached content instantly while fetching a fresh version in the background; this eliminates cache miss latency for users
  • Cache the page, hydrate personalization client-side — cache full HTML for anonymous visitors and load cart count / inventory via a fast no-store API call
  • Invalidate on stock-status change, not every inventory update — a quantity change from 50 to 49 doesn't need a purge; 1 to 0 (out-of-stock) does
  • Strip tracking parameters for better CDN hit rates — ?utm_source=email&utm_campaign=spring creates unique cache entries; strip these at the CDN or in your URL normalization
  • Monitor cache hit rate — target 90%+ at CDN; use X-Cache response headers to identify frequent cache misses

Common Pitfalls

ProblemSolution
Cart count shows 0 on cached pagesNever embed cart count in cached HTML; load it client-side via a fast no-store API endpoint after page load
Product price updated but CDN shows old priceImplement event-driven invalidation that purges CDN on price change; don't rely on TTL expiration alone
Thundering herd when cache expiresUse stale-while-revalidate so only one request revalidates while all others get slightly stale content
Low CDN hit rateNormalize URLs by stripping tracking params; minimize Vary headers (e.g., Vary: Cookie effectively disables caching)
Redis memory grows unboundedSet maxmemory and maxmemory-policy allkeys-lru in Redis config; monitor eviction rate

Related Skills

  • @flash-sale-scaling
  • @edge-commerce
  • @database-optimization-commerce
  • @monitoring-alerting-commerce

平台分布

Codex

33.96%
按下载量换算53

Claude

30.43%
按下载量换算48

Cursor

18%
按下载量换算28

Gemini CLI

8.49%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

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

继续浏览同类 Skills