Command Palette

Search for a command to run...

Назад к скиллам
скилл № 80756

monorepo

Use when the user asks about monorepos, Nx, Turborepo, nx affected, pnpm/yarn/npm workspaces, remote caching, task pipelines, project graphs, or module…

БесплатноБез исполняемых скриптов
j4flmaoот j4flmao★ 47 звёзд на GitHub

Установить monorepo в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Monorepo

Purpose

Configure and manage monorepo workspaces with Nx or Turborepo for efficient build orchestration and caching.

Agent Protocol

Trigger

Exact user phrases: "monorepo", "Nx", "Turborepo", "nx build", "nx affected", "workspace", "dependency graph", "build orchestration", "remote caching", "pnpm workspace", "yarn workspace", "project graph", "module boundary".

Input Context

Before activating, verify:

  • Package manager (pnpm, yarn, npm).
  • Monorepo tool (Nx, Turborepo, or both).
  • CI provider (GitHub Actions, GitLab CI, CircleCI).
  • Remote caching preference (Nx Cloud, Turborepo remote, self-hosted).

Output Artifact

Writes to nx.json, turbo.json, project.json, workspace config, and CI workflow files.

Response Format

nx.json, turbo.json, project.json, or CI config with no extraneous explanation.

No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.

Completion Criteria

This skill is complete when:

  • Workspace is configured (pnpm-workspace.yaml or nx.json).
  • Task pipeline/dependency graph is defined.
  • Caching is configured (local + remote).
  • CI workflow uses affected commands for incremental builds.
  • Module boundary rules are enforced (Nx).

Max Response Length

Direct file write. No response text.

Quick Start

Nx workspace: npx create-nx-workspace@latest → configure nx.json with cacheable operations → nx build app → nx affected:test --base=main. Turborepo: turbo.json with pipeline → turbo run build --filter=app.

Decision Tree: Monorepo Tool Selection

Nx vs Turborepo vs Lerna

Tool Best For Key Feature
Nx Large monorepos, need module boundaries, code generation Dependency graph, affected commands, generators, enforce-module-boundaries
Turborepo Simpler monorepos, focused on caching Zero-config caching, remote cache, pipeline
Lerna Legacy monorepos, npm publishing Package publishing, canary releases, independent versioning

Package Manager Decision

Workspace size < 10 packages?
├── Yes → npm workspaces (simplest, no extra tooling)
└── No → > 50 packages or need strict isolation?
    ├── Yes → pnpm workspaces (fast, disk-efficient, strict)
    └── No → yarn workspaces (good balance of speed and features)

Nx vs Turborepo Decision

Need module boundary enforcement?
├── Yes → Nx (enforce-module-boundaries rule)
└── No → Only need caching?
    ├── Yes → Turborepo (simpler setup)
    └── No → Need code generators and dependency graph?
        ├── Yes → Nx (nx g, nx graph)
        └── No → Either (both support basic task orchestration)

Core Workflow

Step 1: Workspace Configuration

# pnpm-workspace.yaml
packages:
  - "apps/*"
  - "packages/*"
  - "libs/*"
  - "tools/*"
// nx.json
{
  "$schema": "./node_modules/nx/schemas/nx-schema.json",
  "defaultBase": "main",
  "nxCloudAccessToken": "…",
  "plugins": [
    {
      "plugin": "@nx/js/typescript",
      "options": {
        "buildTargetName": "build"
      }
    }
  ],
  "targetDefaults": {
    "build": {
      "dependsOn": ["^build"],
      "cache": true,
      "inputs": ["{projectRoot}/**/*", "sharedGlobals"]
    },
    "test": {
      "dependsOn": ["build"],
      "cache": true,
      "inputs": ["default", "^production"]
    },
    "lint": {
      "cache": true
    }
  }
}

Step 2: Turborepo Pipeline

{
  "$schema": "https://turbo.build/schema.json",
  "globalDependencies": ["**/.env.*local"],
  "globalEnv": ["NODE_ENV", "API_URL", "CI"],
  "pipeline": {
    "build": {
      "dependsOn": ["^build"],
      "cache": true,
      "inputs": ["$TURBO_DEFAULT$", ".env.production"],
      "outputs": ["dist/**", ".next/**", "build/**"],
      "env": ["NODE_ENV", "DATABASE_URL"]
    },
    "test": {
      "dependsOn": ["build"],
      "cache": true,
      "inputs": ["$TURBO_DEFAULT$", "vitest.config.ts"],
      "outputs": []
    },
    "lint": { "cache": false },
    "typecheck": { "dependsOn": ["^build"], "cache": false },
    "dev": { "cache": false, "persistent": true }
  }
}

Step 3: Project Configuration (Nx)

{
  "name": "web",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "apps/web/src",
  "projectType": "application",
  "tags": ["scope:web", "type:app"],
  "implicitDependencies": ["shared-ui"],
  "targets": {
    "build": {
      "executor": "@nx/next:build",
      "options": { "outputPath": "dist/apps/web" }
    }
  }
}

Step 4: CI Pipeline with Affected Commands

name: CI
on:
  pull_request:
    branches: [main]
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
      with:
        fetch-depth: 0
    - uses: actions/setup-node@v4
      with:
        node-version: 22
        cache: pnpm
    - run: pnpm install --frozen-lockfile
    - name:
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/dependency-management.md
  • references/monorepo-advanced.md
  • references/monorepo-ci-cd.md
  • references/monorepo-fundamentals.md
  • references/monorepo-tools.md
  • references/nx-guide.md
  • references/turborepo-guide.md

FAQ

Что делает скилл monorepo?

Use when the user asks about monorepos, Nx, Turborepo, nx affected, pnpm/yarn/npm workspaces, remote caching, task pipelines, project graphs, or module boundary rules. Produces workspace layout and build orchestration configs. Not for dependency update bots (use dependency-management) or Git submodules (use advanced-workflows).

Как установить скилл monorepo?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл monorepo запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить monorepo с