skills/turborepo-caching/SKILL.md
Use this skill when configuring or debugging Turborepo local and remote caching, including task outputs, cache keys, CI reproducibility, cache misses, and developer build performance.
npx skillsauth add chatandbuild/skills-repo Turborepo CachingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Improve monorepo build performance through reliable Turborepo caching.
Identify cacheable tasks. Ensure tasks are deterministic: same inputs must produce identical outputs. Exclude tasks that use timestamps, random IDs, or external APIs. Audit each task's inputs and outputs in turbo.json.
Configure inputs and outputs. Define explicit inputs (glob patterns for files that affect the task) and outputs (directories or files the task produces). Omit outputs only for tasks with no artifacts (e.g., lint). Include environment variables that affect output via globalEnv or per-task env.
Set up remote cache. Use TURBO_TOKEN and TURBO_TEAM (Vercel Remote Cache) or self-hosted options. In CI, set these as secrets. Run turbo run build --summarize to verify cache hits in the summary.
Handle environment variables. Add any env var that changes task output to globalEnv in turbo.json or to a task's env array. Common culprits: NODE_ENV, CI, VERCEL_ENV, custom feature flags. Missing env vars cause incorrect cache hits.
Add cache observability. Use turbo run <task> --dry-run=json to inspect the hash inputs. Run turbo run build --summarize and check "Cache hit, replaying output" vs "Cache miss, executing". Add a CI step that fails or warns if cache hit rate drops below a threshold.
Document invalidation rules. Document when cache is invalidated: input file changes, env changes, turbo.json changes. Ensure .turbo/cache is in .gitignore and that CI does not persist it across unrelated runs.
{
"$schema": "https://turbo.build/schema.json",
"globalEnv": ["NODE_ENV", "CI", "CUSTOM_ENV"],
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"],
"inputs": ["src/**", "package.json", "tsconfig.json"],
"env": ["PUBLIC_API_URL"]
},
"test": {
"dependsOn": ["build"],
"outputs": ["coverage/**"],
"inputs": ["src/**", "test/**"]
},
"lint": {
"outputs": []
}
}
}
^build for internal dependency builds; use build for same-package deps.outputs minimal; avoid ** if a subset suffices to reduce cache size.inputs when default (all files) is too broad and causes unnecessary misses.turbo run build --summarize - human-readable summary with cache hit/miss.turbo run build --dry-run=json - JSON with hash inputs and task graph.turbo run build --force - bypass cache to verify fresh output.turbo daemon stop - stop local daemon if cache behavior seems stuck.node_modules/.cache/turbo or .turbo/cache for local cache location.## Cache Strategy
- Tasks: build, test, lint
- Remote cache: enabled (TURBO_TEAM=team-name)
- Key inputs: src/**, package.json, tsconfig.json
- Key env vars: NODE_ENV, CI, PUBLIC_API_URL
## Config Changes
- turbo.json: added outputs for build, inputs for test
- CI: set TURBO_TOKEN, TURBO_TEAM; add --summarize to turbo run
## Validation Checklist
- [ ] Cache hits observed on repeat runs (no input changes)
- [ ] Cache miss on input change (e.g., edit src file)
- [ ] No stale artifacts in dependent tasks
- [ ] CI and local behavior consistent
- [ ] .turbo/cache in .gitignore
Caching non-deterministic outputs. Builds that embed timestamps, process.env.GIT_SHA, or random IDs produce different outputs for same inputs. Cache replays wrong artifacts. Make outputs deterministic or exclude the task from caching.
Missing env vars in hash inputs. If NODE_ENV=production changes build output but is not in globalEnv, production and development builds can incorrectly share cache. Add all env vars that affect output.
Oversized cache artifacts. Including node_modules, .next/cache, or large generated assets bloats cache. Restrict outputs to what downstream tasks need. Use .turboignore or narrow globs.
Ignoring .turbo/cache locality. Local cache lives in .turbo/cache or node_modules/.cache/turbo. CI runners typically start fresh; remote cache must be configured for CI hits. Ensure TURBO_TOKEN and TURBO_TEAM are set in CI.
Wrong dependency graph. dependsOn errors (e.g., missing ^build for internal deps) cause tasks to run before dependencies complete, producing invalid cache entries.
inputs and outputs over relying on defaults.tools
Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).
development
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.
development
Use this skill when turning messy workout information into clear logs, comparing user-provided sessions, surfacing trends or likely PRs, and suggesting realistic next-session steps.
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.