infra-ci-cd-turborepo-ci
Turborepo CI Patterns
Quick Guide: Use
--affectedfor PR builds (auto-detects CI environment, falls back to full suite on shallow clones). Enable Remote Cache withTURBO_TOKEN+TURBO_TEAMenv vars. Declareoutputsfor every cacheable task or cached results will be incomplete. UseenvandglobalEnvin turbo.json to include environment variables in cache hashes -- missing entries cause cross-environment cache collisions. Pinturboversion in CI. Useturbo query affectedto conditionally skip entire CI steps.
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST declare outputs for every cacheable task in turbo.json -- missing outputs means cached results restore without build artifacts)
(You MUST list environment variables that affect task output in env (task-level) or globalEnv (all tasks) -- omitting them causes cross-environment cache hits with wrong values)
(You MUST use --affected for PR builds -- running the full task graph on PRs wastes CI time on unchanged packages)
(You MUST pin the turbo CLI version in CI -- latest can introduce breaking changes mid-pipeline)