Community生产力与协作github.com

wshobson/turborepo-caching

配置 Turborepo 以实现高效的本地及远程缓存单仓库构建。适用于设置 Turborepo、优化构建管道或实施分布式缓存时。

turborepo-caching 是什么?

wshobson/turborepo-caching 技能专注于优化基于 Turborepo 的单仓库构建流程,通过配置本地和远程缓存来显著加速构建速度。该技能详细介绍了如何利用 Turborepo 的缓存机制,包括配置 `turbo.json` 文件以定义任务依赖和缓存输出,以及设置远程缓存(如 Vercel Remote Caching 或自定义缓存服务器)以实现团队协作中的缓存共享。使用该技能可以避免重复构建未更改的代码,从而节省开发时间并提升 CI/CD 效率。它支持在各种使用 Turborepo 的项目中无缝集成,无论项目大小或复杂度,都能帮助开发者快速建立高效的构建管道。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/wshobson/agents/tree/main/skills/turborepo-caching

Installed? Explore more 生产力与协作 skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

turborepo-caching 是做什么的?

配置 Turborepo 以实现高效的本地及远程缓存单仓库构建。适用于设置 Turborepo、优化构建管道或实施分布式缓存时。

概述

此技能帮助你充分利用 Turborepo 的缓存能力,通过避免重复计算来加速构建过程。它涵盖了本地缓存配置、远程缓存设置以及最佳实践,确保在多开发者环境中构建高效且一致。

功能

  • 配置 turbo.json 文件以管理任务依赖和缓存输出。
  • 设置本地缓存以加速单个开发者的构建。
  • 集成远程缓存服务(如 Vercel Remote Caching 或自定义解决方案)以实现团队级别的缓存共享。
  • 优化构建管道,减少不必要的重新构建。

使用方法

在现有 Turborepo 项目中使用此技能,按照以下步骤操作:

  1. 确保已安装 turbo CLI(npm install -g turbo 或 yarn global add turbo)。
  2. 创建或更新项目根目录下的 turbo.json 文件:
{
  "pipeline": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["dist/**", ".next/**"]
    },
    "test": {
      "dependsOn": ["build"],
      "outputs": []
    }
  }
}
  1. 选择启用远程缓存。对于 Vercel Remote Caching:
    • 在 Vercel 仪表板中生成令牌。
    • 设置环境变量:
      TURBO_REMOTE_CACHE_SIGNATURE_KEY=your-vercel-token
      
  2. 运行构建:
turbo run build

远程缓存配置

远程缓存允许团队成员共享缓存工件。步骤包括:

  • 选择一个远程缓存提供者(如 Vercel、AWS S3、自定义服务器)。
  • 在 turbo.json 中设置远程缓存 URL(如适用):
    {
      "remoteCache": {
        "url": "https://your-cache-server.com/api/cache"
      }
    }
    
  • 确保所有团队成员拥有正确的环境变量(如 TURBO_REMOTE_CACHE_SIGNATURE_KEY)。

提示与最佳实践

  • 仅缓存纯函数任务(输出完全由输入决定)。
  • 在 outputs 列表中明确指定输出路径,避免包含大型不必要的文件。
  • 在 CI/CD 环境中使用远程缓存以减少构建时间。
  • 定期监控缓存命中率以确保配置有效。

支持的平台

此技能适用于任何使用 Turborepo 的项目,包括 JavaScript/TypeScript、Next.js、React 等框架。

贡献

欢迎通过提交问题或拉取请求来改进此技能。

许可

MIT

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

wshobson/accessibility-compliance

Implement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.

wshobson/airflow-dag-patterns

Build production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.

wshobson/angular-migration

Migrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.

wshobson/anti-reversing-techniques

Understand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use this skill when analyzing malware evasion techniques, when implementing anti-debugging protections for CTF challenges, when reverse engineering packed binaries, or when building security research tools that need to detect virtualized environments.

wshobson/api-design-principles

Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.

wshobson/architecture-decision-records

Write and maintain Architecture Decision Records (ADRs) following best practices for technical decision documentation. Use when documenting significant technical decisions, reviewing past architectural choices, or establishing decision processes.

wshobson/architecture-patterns

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.

wshobson/async-python-patterns

Master Python asyncio, concurrent programming, and async/await patterns for high-performance applications. Use when building async APIs, concurrent systems, or I/O-bound applications requiring non-blocking operations.

wshobson/attack-tree-construction

Build comprehensive attack trees to visualize threat paths. Use when mapping attack scenarios, identifying defense gaps, or communicating security risks to stakeholders.

wshobson/auth-implementation-patterns

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.

wshobson/avoid-ai-writing

Audit and rewrite prose so it stops reading as machine-generated. Use this skill when asked to remove AI-isms, clean up AI writing, edit a draft for AI tells, audit a README, changelog, release note, PR description, or blog post for machine-sounding prose, or make text sound less like AI. Supports a detect-only mode, a rewrite mode, and an edit-in-place mode, with optional voice and context profiles.

wshobson/backtesting-frameworks

Build robust backtesting systems for trading strategies with proper handling of look-ahead bias, survivorship bias, and transaction costs. Use when developing trading algorithms, validating strategies, or building backtesting infrastructure.

wshobson/bash-defensive-patterns

Master defensive Bash programming techniques for production-grade scripts. Use when writing robust shell scripts, CI/CD pipelines, or system utilities requiring fault tolerance and safety.

wshobson/bats-testing-patterns

Master Bash Automated Testing System (Bats) for comprehensive shell script testing. Use when writing tests for shell scripts, CI/CD pipelines, or requiring test-driven development of shell utilities.

wshobson/bazel-build-optimization

Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.

wshobson/before-you-build

Pre-build product and feature risk review for founders, product managers, and AI-assisted builders. Use this skill when the user is about to build a landing page, MVP, SaaS product, internal tool, agent workflow, or major feature and needs to check demand, positioning, monetization, retention, trust, distribution, and adoption risk before implementation starts.

wshobson/billing-automation

Build automated billing systems for recurring payments, invoicing, subscription lifecycle, and dunning management. Use when implementing subscription billing, automating invoicing, or managing recurring payment systems.

wshobson/binary-analysis-patterns

Master binary analysis patterns including disassembly, decompilation, control flow analysis, and code pattern recognition. Use when analyzing executables, understanding compiled code, or performing static analysis on binaries.

wshobson/block-no-verify-hook

Configure a PreToolUse hook to prevent AI agents from skipping git pre-commit hooks with --no-verify and other bypass flags. Use when setting up Claude Code projects that enforce commit quality gates.

wshobson/brand-landingpage

Brand-first landing page designer — runs a brand-identity interview (colors, typography, shape language), then generates and iterates on a polished landing page via Stitch with deployment-ready HTML. Use when the user asks to create, design, or build a landing page, homepage, or marketing page and has no established visual direction. Skip when they have a design mockup, need a dashboard or app UI, are working at component level, building a multi-page app, or restyling with known design tokens — use frontend-design instead.

相关技能