Turborepo Monorepo Authoring
Skill11 starsChanged 6 months agoMITView on GitHub
You have a **Turborepo monorepo** and you''re doing one of
- Reads credentials
In this repository37 other files it gives its agents.
- Browser ML in JavaScriptSkill
- CLI BuilderSkill
- ClickHouse Best PracticesSkill
- Code ReviewerSkill
- Code Review WorkflowSkill
- Commit Message WriterSkill
- deepeval Pytest Eval SuiteSkill
- deepeval OTel Trace ExportSkill
- deepeval SDK TracingSkill
- Doc Co-Authoring WorkflowSkill
- Embedding Model TrainingSkill
- Frontend Large-Feature ArchitectureSkill
- Frontend Visual Design TasteSkill
- Goal DefinitionSkill
- Internal Comms AuthoringSkill
- Invalid Name HandlerSkill
- LLM Model Pricing File UpdateSkill
- maf-prs-jobSkill
- MCP Server BuilderSkill
- Code Ownership & Bus FactorSkill
- PDF SummarizerSkill
- PDF Vision ExtractorSkill
- PNPM Upgrade PackageSkill
- promptflow-to-mafSkill
- promptfoo Eval Suite AuthorSkill
- promptfoo Redteam Plugin AuthorSkill
- Single-Flow PR YeetSkill
- React Router Search Param StateSkill
- Realtime Eval ScaffoldSkill
- Secure Code by LanguageSkill
- Security Review ChecklistSkill
- Skill Authoring LoopSkill
- SQL Query HelperSkill
- Storybook Component StoriesSkill
- Unit Test GeneratorSkill
- Repository Threat ModelSkill
- Webapp Testing HarnessSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 46
turbo run, notturbo: Always use the explicit turbo run form in package.json scripts, CI workflows, and any code path. - Very specific: line 51
If you violate either, every other Turborepo feature is moot — the parallelism is gone, the cache is wrong, remote cache is broken, and …
- Distinctive: line 196
The repo is not a Turborepo monorepo: Use the build system you're on (npm workspaces, Nx, Bazel, Rush, Lerna).
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
When to use
You have a Turborepo monorepo and you're doing one of ten things to it: configuring a task, debugging cache misses, running only changed packages, filtering packages, fixing environment variables, setting up CI, starting watch/dev mode, creating a new internal package, deciding the repo structure, or enforcing architectural boundaries.
The skill is built around two primary rules and eight anti-patterns. The two rules are non-negotiable:
- Package Tasks, Not Root Tasks. Tasks belong in each
package's
package.json. The rootpackage.jsononly delegates viaturbo run <task>. Putting task logic in the rootpackage.jsondefeats Turborepo's parallelization. turbo run, notturbo. Always use the explicitturbo runform inpackage.jsonscripts, CI workflows, and any code path. The shorthandturbo <task>is for human-typed terminal commands only.
If you violate either, every other Turborepo feature is
moot — the parallelism is gone, the cache is wrong,
remote cache is broken, and --affected cannot find the
right packages.
Don't use this skill for npm workspaces without Turborepo, Nx monorepos, or Bazel. The build graph paradigm is different.
Inputs
| Field | Required | Notes |
task | yes | One of the 10 tasks above. |
package_filter | no | --filter value. |
base_branch | no | For --affected. Default: repo default. |
Output
Plain-text answer. Typical return:
Command: turbo run build --filter=web...
Config: { "tasks": { "build": { "dependsOn": ["^build"], "outputs": ["dist/**"] } } }
Anti-pattern: don't put `cd apps/web && next build` in root package.json
Reference: references/configuration/tasks.mdPrompt
You are working in a Turborepo monorepo. Apply the two
primary rules first; do not skip the anti-patterns.
1. PRIMARY RULE — Package tasks, not root tasks.
Every task's logic lives in the relevant package's
`package.json`. The root `package.json` ONLY
delegates via `turbo run <task>`.
DO:
apps/web/package.json:
{ "scripts": { "build": "next build", "lint": "eslint .", "test": "vitest" } }
apps/api/package.json:
{ "scripts": { "build": "tsc", "lint": "eslint .", "test": "vitest" } }
packages/ui/package.json:
{ "scripts": { "build": "tsc", "lint": "eslint .", "test": "vitest" } }
turbo.json:
{ "tasks": { "build": { "dependsOn": ["^build"], "outputs": ["dist/**"] }, ... } }
root package.json:
{ "scripts": { "build": "turbo run build", "lint": "turbo run lint", "test": "turbo run test" } }
DO NOT:
root package.json:
{ "scripts": { "build": "cd apps/web && next build && cd ../api && tsc", ... } }
Root Tasks (`//#taskname`) are for the rare case a
task truly cannot live in a package. Default to
package tasks.
2. PRIMARY RULE — Use `turbo run`, not `turbo`.
In code (package.json, CI, scripts), always use
`turbo run`. The shorthand is for terminal use.
package.json: "build": "turbo run build"
GitHub Actions: - run: turbo run build --affected
Turbo shorthand: ONLY for one-off terminal commands
typed by humans or agents
3. Walk the decision tree for the user's task.
Configure a task?
- dependencies: references/configuration/tasks.md
- lint/check-types: use the Transit Nodes pattern
- outputs: references/configuration/tasks.md#outputs
- env vars: references/environment/RULE.md
- watch: references/configuration/tasks.md#persistent
- global: references/configuration/global-options.md
Cache not working?
- outputs not restored: missing `outputs` key
- unexpected misses: references/caching/gotchas.md
- debug hash: --summarize or --dry
- skip cache: --force or cache: false
- remote cache: references/caching/remote-cache.md
- env causes misses: references/environment/gotchas.md
Run only changed packages?
- DEFAULT: turbo run build --affected
- custom base: --affected --affected-base=origin/develop
- manual: --filter=...[origin/main]
- see all: references/filtering/RULE.md
Filter packages?
- by name: --filter=web
- by directory: --filter=./apps/*
- + deps: --filter=web...
- + dependents: --filter=...web
- complex: references/filtering/patterns.md
Env vars not working?
- vars not at runtime: strict mode (default)
- cache hits with wrong env: var not in `env` key
- .env changes not rebuilding: .env not in `inputs`
- CI vars missing: references/environment/gotchas.md
- framework vars: auto-included via inference
CI setup?
- GitHub Actions: references/ci/github-actions.md
- Vercel: references/ci/vercel.md
- remote cache: references/caching/remote-cache.md
- only changed: --affected
- skip when no changes: turbo-ignore
Watch / dev?
- re-run on change: turbo watch
- dev servers with deps: `with` key
- restart on dep change: interruptible: true
- persistent: persistent: true
Create / structure a package?
- internal package: references/best-practices/packages.md
- repo structure: references/best-practices/structure.md
- dep management: references/best-practices/dependencies.md
- JIT vs compiled: references/best-practices/packages.md#compilation-strategies
- sharing code: references/best-practices/RULE.md#package-types
Repo structure?
- apps/ vs packages/: references/best-practices/RULE.md
- package types: references/best-practices/RULE.md#package-types
- TS config: references/best-practices/structure.md#typescript-configuration
- ESLint: references/best-practices/structure.md#eslint-configuration
- deps: references/best-practices/dependencies.md
- boundaries: references/boundaries/RULE.md
Enforce boundaries?
- check: turbo boundaries
- tags: references/boundaries/RULE.md#tags
- restrict imports: references/boundaries/RULE.md#rule-types
- prevent file imports: references/boundaries/RULE.mdWhen NOT to use
- The repo is not a Turborepo monorepo. Use the build system you're on (npm workspaces, Nx, Bazel, Rush, Lerna).
- You put a task's logic in the root
package.json. This is the #1 Turborepo anti-pattern. Tasks belong in each package; the root only delegates viaturbo run. - You write
turbo build(shorthand) into a script or CI step. Alwaysturbo run build. The shorthand is for one-off terminal commands. - You use
&&to chain Turborepo tasks. Let Turborepo orchestrate viadependsOn. Chaining forces serial execution and breaks the cache graph. - You add a task without specifying
outputs. The cache cannot restore what it does not know exists. The default forbuildisdist/**; the default fortestis usually nothing. Be explicit. - You use
cache: falseto "fix" a cache miss. That is the wrong fix. Find the missingoutputs/inputs/envkey. Disabling the cache removes the feature. - You use
--filter=...(with the trailing dots) when you wanted--filter=...meaning dependents. The three dots AFTER the package = dependents (upstream consumers). The three dots BEFORE the package = dependencies. Wrong direction wastes a CI run. - You hand-edit
turbo.jsonand forget to setcacheDir/daemonglobally. Both are sane defaults; the daemon keeps the build warm. - You skip the boundary check. A monorepo without
boundary enforcement is a code dump with a
package.jsonon top. Runturbo boundariesin CI.
Example
Input:
task: run-changed
base_branch: origin/mainOutput:
Command: turbo run build lint test --affected --affected-base=origin/main
Config (turbo.json):
{
"tasks": {
"build": { "dependsOn": ["^build"], "outputs": ["dist/**"] },
"lint": { "outputs": [] },
"test": { "dependsOn": ["build"], "outputs": ["coverage/**"] }
}
}
Anti-pattern:
- do NOT use `turbo build` shorthand in CI
- do NOT chain with && — let turbo orchestrate
- do NOT use --force as a default; --affected is the
way to scope to changes
Reference: references/filtering/RULE.mdDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

