Token导航 LogoToken导航TokenDH.com
运维和基础设施只读github未标认证来源可访问clear审计通过

caching-strategy-optimizer缓存策略优化器

Agent Skill

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

总安装

2,175

周安装

88

GitHub Stars

33

下载量

683
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/patricio0312rev/skills --skill caching-strategy-optimizer

简介

caching-strategy-optimizer 通过智能缓存键与包管理器缓存优化,显著加速 CI/CD 流水线执行。

  • 适合频繁运行构建任务的开发团队,缩短等待时间并提升交付效率。
  • 支持 NPM、pnpm 和 Python 等主流工具链,自动识别依赖哈希进行增量缓存。
  • 使用前请确认 CI 环境支持 actions/cache 等 GitHub Actions 插件。
  • 注意缓存可能占用存储空间,建议定期清理过期条目以维持系统整洁。

SKILL.md

Caching Strategy Optimizer

Dramatically speed up CI pipelines with intelligent caching.

Cache Key Strategy

Package Manager Caches

# NPM - Hash package-lock.json
- uses: actions/cache@v3
  with:
    path: ~/.npm
    key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
    restore-keys: |
      ${{ runner.os }}-npm-

# pnpm - More aggressive caching
- uses: pnpm/action-setup@v2
  with:
    version: 8

- uses: actions/cache@v3
  with:
    path: |
      ~/.pnpm-store
      node_modules
    key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
    restore-keys: |
      ${{ runner.os }}-pnpm-

# Python pip
- uses: actions/cache@v3
  with:
    path: ~/.cache/pip
    key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}

# Cargo/Rust
- uses: actions/cache@v3
  with:
    path: |
      ~/.cargo/bin/
      ~/.cargo/registry/index/
      ~/.cargo/registry/cache/
      ~/.cargo/git/db/
      target/
    key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

Docker Layer Caching

Using Buildx

- name: Set up Docker Buildx
  uses: docker/setup-buildx-action@v3

- name: Build with cache
  uses: docker/build-push-action@v5
  with:
    context: .
    cache-from: type=gha
    cache-to: type=gha,mode=max

Registry-based Cache

- name: Build with registry cache
  uses: docker/build-push-action@v5
  with:
    context: .
    cache-from: type=registry,ref=myapp:buildcache
    cache-to: type=registry,ref=myapp:buildcache,mode=max

Build Output Caching

# Next.js cache
- uses: actions/cache@v3
  with:
    path: |
      ${{ github.workspace }}/.next/cache
    key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
    restore-keys: |
      ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
      ${{ runner.os }}-nextjs-

# Webpack cache
- uses: actions/cache@v3
  with:
    path: node_modules/.cache/webpack
    key: ${{ runner.os }}-webpack-${{ hashFiles('webpack.config.js') }}-${{ hashFiles('src/**') }}

# TypeScript build cache
- uses: actions/cache@v3
  with:
    path: |
      dist
      tsconfig.tsbuildinfo
    key: ${{ runner.os }}-tsc-${{ hashFiles('**/*.ts') }}

Test Results Caching

# Jest cache
- uses: actions/cache@v3
  with:
    path: /tmp/jest_rt
    key: ${{ runner.os }}-jest-${{ hashFiles('**/*.test.ts') }}

# Pytest cache
- uses: actions/cache@v3
  with:
    path: .pytest_cache
    key: ${{ runner.os }}-pytest-${{ hashFiles('**/*test*.py') }}

Before/After Metrics

## Before Optimization

- Total time: 12 minutes
- npm ci: 4 minutes
- Build: 5 minutes
- Tests: 3 minutes

## After Caching

- Total time: 3 minutes
- npm ci: 30 seconds (cache hit)
- Build: 1 minute (incremental)
- Tests: 1.5 minutes (cache hit)

**Improvement: 75% faster (12m → 3m)**

Cache Hit Rate Monitoring

- name: Check cache hit
  id: cache
  uses: actions/cache@v3
  with:
    path: node_modules
    key: ${{ runner.os }}-deps-${{ hashFiles('package-lock.json') }}

- name: Log cache status
  run: |
    if [ "${{ steps.cache.outputs.cache-hit }}" == "true" ]; then
      echo "✅ Cache hit - saved $(date -u -d @$SECONDS +%M:%S)"
    else
      echo "❌ Cache miss - installing from scratch"
    fi

Best Practices

  1. Precise keys: Include all dependencies in hash
  2. Restore keys: Fallback to partial matches
  3. Multiple paths: Cache related files together
  4. Size limits: GitHub Actions limit is 10GB
  5. Expiration: Caches expire after 7 days
  6. Mode=max: Docker cache mode for better hits
  7. Monitor hits: Track cache effectiveness

Common Pitfalls

Too generic keys: key: deps (always hits) ✅ Specific keys: key: deps-${{hashFiles('package-lock.json')}}

Missing restore-keys: Cache miss on minor changes ✅ Restore keys: Partial match fallback

Caching node_modules with wrong lock fileMatch lock file: Hash the right lockfile

Output Checklist

  • Package manager cache configured
  • Build output cache
  • Docker layer cache (if applicable)
  • Test cache configured
  • Cache keys use file hashes
  • Restore keys for fallback
  • Before/after metrics documented
  • Cache hit monitoring

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Antigravity

29.54%
按下载量换算202

Claude Code

19.33%
按下载量换算132

Gemini CLI

17.76%
按下载量换算121

windsurf

12.13%
按下载量换算83

github-copilot

7.03%
按下载量换算48

Codex

3.62%
按下载量换算25

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills