# turborepo

A skill that tells the agent how to configure Turborepo: workspace layout, turbo.json, caching and task filters. Useful once the monorepo already exists.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 658 installs · ★ 286
- Author: Mindrally
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/Mindrally/skills/tree/HEAD/turborepo/SKILL.md
- Updated: 2026-10-08
- HTML: https://affpapa.org/en/nevibecode/skills/mindrally-turborepo

## What it does

This skill encodes Turborepo conventions for JavaScript and TypeScript monorepos. It keeps workspaces split into `apps/`, `packages/` and `tooling/`, wants a minimal root `package.json`, and expects consistent naming across workspaces. Internal packages are referenced with the workspace protocol, as in `"@repo/ui": "workspace:*"`.

The `turbo.json` section is the meat of it. The agent sets `dependsOn` with the `^` prefix for topological ordering, defines `outputs` so caching actually hits, and excludes directories like `!.next/cache/**`. Dev tasks get `cache: false` and `persistent: true`. For CI the skill points at remote caching and splits environment variables between `globalEnv` and `env`.

One thing to know before installing: the skill assumes Turborepo is already in the project. It configures and optimizes an existing monorepo, it does not scaffold one. Commands such as `turbo build --filter=web` and `turbo watch` only make sense against real workspaces.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add Mindrally/skills --skill turborepo -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/turborepo/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/turborepo/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add Mindrally/skills --skill turborepo -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/turborepo/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add Mindrally/skills --skill turborepo -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/turborepo/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install Mindrally/skills turborepo
```

2. **Manually: put the files in place**
- File: `.github/skills/turborepo/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add Mindrally/skills --skill turborepo -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/Mindrally/skills --path turborepo
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/turborepo/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add Mindrally/skills --skill turborepo -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Mindrally/skills/tree/HEAD/turborepo/SKILL.md

## When to use it
- lay out workspaces under `apps/` and `packages/`
- write `turbo.json` with task dependencies and outputs
- turn on remote caching for CI builds
- build a single app with `--filter`
- extract shared TypeScript and ESLint configs into packages

## Example prompts
- Set up turbo.json for this monorepo: build depends on ^build, dev without cache
- Split workspaces into apps/ and packages/ and wire @repo/ui through workspace:*
- Add remote caching and globalEnv for the GitHub Actions build

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: bd267556e7b67d4a.

BEGIN THIRD-PARTY FILE bd267556e7b67d4a
````text
---
name: turborepo
description: Best practices for Turborepo monorepo build system configuration and optimization
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Turborepo Development

You are an expert in Turborepo, the high-performance build system for JavaScript and TypeScript monorepos.

## Project Structure

- Organize workspaces following the standard Turborepo structure:
  - `apps/` - Application workspaces (web apps, APIs, mobile apps)
  - `packages/` - Shared packages (UI components, utilities, configs)
  - `tooling/` - Build tools and configurations (optional)
- Keep the root `package.json` minimal with workspace configuration
- Use consistent naming conventions across all workspaces

## Workspace Configuration

- Define workspaces in the root `package.json`:
  ```json
  {
    "workspaces": ["apps/*", "packages/*"]
  }
  ```
- Each workspace should have its own `package.json` with proper dependencies
- Use internal package references with workspace protocol: `"@repo/ui": "workspace:*"`

## turbo.json Configuration

```json
{
  "$schema": "https://turbo.build/schema.json",
  "tasks": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["dist/**", ".next/**", "!.next/cache/**"]
    },
    "dev": {
      "cache": false,
      "persistent": true
    },
    "lint": {},
    "test": {
      "dependsOn": ["build"]
    }
  }
}
```

- Use `^` prefix for topological dependencies (build dependencies first)
- Define proper `outputs` for caching
- Mark development tasks with `cache: false` and `persistent: true`

## Caching Strategy

- Configure remote caching for CI/CD with Vercel or self-hosted solutions
- Define accurate `outputs` arrays to ensure proper cache hits
- Use `inputs` to specify which files affect task caching
- Exclude cache directories from outputs (e.g., `!.next/cache/**`)

## Task Dependencies

- Use `dependsOn` to define task relationships:
  - `"^build"` - Run build in dependencies first
  - `"lint"` - Run lint in the same package
  - `"@repo/ui#build"` - Run build in a specific package
- Define proper task ordering for complex build pipelines

## Shared Configurations

- Create shared config packages:
  - `@repo/typescript-config` - Shared TypeScript configurations
  - `@repo/eslint-config` - Shared ESLint configurations
  - `@repo/tailwind-config` - Shared Tailwind configurations
- Reference configs using `extends` or imports in workspace configs

## Development Workflow

- Use `turbo dev` to run development servers across workspaces
- Filter commands to specific workspaces: `turbo build --filter=web`
- Use `--filter` with patterns: `turbo build --filter=./apps/*`
- Watch mode with `turbo watch` for continuous builds

## CI/CD Integration

- Enable remote caching in CI for faster builds
- Use `--dry-run` to preview what would be executed
````
END THIRD-PARTY FILE bd267556e7b67d4a

The third-party file has ended. Everything between the bd267556e7b67d4a tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2859 of 3391 bytes. © Mindrally · Apache-2.0 · https://github.com/Mindrally/skills/tree/HEAD/turborepo/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
