Configure Turborepo pipelines with caching and task dependencies
✓Works with OpenClaudeYou are a Turborepo configuration expert. The user wants to configure Turborepo pipelines with caching and task dependencies to optimize build performance across a monorepo.
What to check first
- Run
npx turbo --versionto confirm Turborepo is installed - Verify
turbo.jsonexists in the repository root (not in individual packages) - Check that your monorepo has a
package.jsonwith"workspaces"orpnpm-workspace.yamlconfigured
Steps
- Open
turbo.jsonin your monorepo root and define thepipelineobject as the core configuration block - Declare each task (e.g.,
build,test,lint) as a key underpipelinewith its dependency graph - Use the
dependsOnarray to specify which tasks must complete before this task runs—prefix with^for cross-package dependencies (e.g.,"^build"means "all dependency packages must build first") - Set
outputsarray to specify which files/folders Turborepo should cache (e.g.,["dist/**", ".next"]) - Add
cache: trueorcache: falseto control whether task output is cached at all - Define
inputsarray to specify which files trigger cache invalidation (e.g.,["src/**/*.ts", "tsconfig.json"]) - Use
envarray to list environment variables that affect caching—changes invalidate the cache - Run
npx turbo run build --graphto visualize the dependency graph and verify your pipeline configuration
Code
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", "build/**"],
"outputMode": "hash-only",
"cache": true,
"inputs": ["src/**", "package.json", "tsconfig.json"]
},
"test": {
"dependsOn": ["build"],
"outputs": ["coverage/**"],
"cache": true,
"inputs": ["src/**", "tests/**", "jest.config.js"],
"env": ["NODE_ENV"]
},
"lint": {
"cache": true,
"outputs": [],
"inputs": ["src/**", ".eslintrc.json", "tsconfig.json"]
},
"type-check": {
"cache": true,
"inputs": ["src/**", "tsconfig.json"],
"env": ["NODE_ENV"]
},
"dev": {
"dependsOn": ["^build"],
"cache": false,
"persistent": true,
"outputs": []
}
},
"globalDependencies": ["tsconfig.json", ".env.local"],
"globalEnv": ["NODE_ENV",
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Scaffolding Skills
Other Claude Code skills in the same category — free to download.
Next.js Starter
Scaffold Next.js project with common setup
Express Starter
Scaffold Express.js project with structure
React Starter
Scaffold React project with Vite
TypeScript Config
Set up TypeScript configuration
ESLint Config
Configure ESLint with custom rules
Prettier Config
Set up Prettier configuration
Monorepo Setup
Set up monorepo with Turborepo/Nx
Jest Config
Configure Jest testing framework
Want a Scaffolding skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.