Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Nx monorepo management skill for AI-native development. This skill should be used when working with Nx workspaces, project graphs, affected detection, code generation, and caching. Use when: analyzing dependencies, running affected commands, generating code, configuring Nx Cloud, or optimizing build performance. Invoke nx-mcp tools for documentation queries.
.claude/skills/aiskillstore-nx-monorepo/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-06 | ✗→✓ | ▲ Improved | 141% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 50% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 140% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 199% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 122% | 0% |
This skill provides expert-level capabilities for Nx monorepo management. Nx is the standard build orchestrator for this AI-native platform due to its official MCP server integration.
Why Nx: Official MCP server, TypeScript-native, 5-minute setup, auto-generates CLAUDE.md/AGENTS.md for AI assistants.
nx_docs - Query Nx documentation
nx_available_plugins - List official Nx plugins (NOT installed by default)Key Insight: MCP provides documentation lookup. Use Nx CLI for all operations.
bash# View interactive project graph nx graph # JSON output for programmatic use nx graph --file=output.json # Show dependencies of specific project nx graph --focus=my-app # Show what depends on a project nx graph --affected
bash# What's affected since main? nx affected -t build nx affected -t test nx affected -t lint # Compare against specific base nx affected -t build --base=origin/main --head=HEAD # Show affected projects only nx show projects --affected
bash# Run task for all projects nx run-many -t build nx run-many -t test # Run for specific projects nx run-many -t build --projects=app-a,lib-b # Run with parallelism control nx run-many -t build --parallel=4 # Single project nx build my-app nx test my-lib
bash# List available generators nx list @nx/next nx list @nx/react # Generate new application nx g @nx/next:app my-app nx g @nx/react:app my-frontend # Generate library nx g @nx/js:lib shared-utils nx g @nx/react:lib ui-components # Dry run (preview) nx g @nx/next:app my-app --dry-run
json{ "targetDefaults": { "build": { "dependsOn": ["^build"], "cache": true }, "test": { "cache": true }, "lint": { "cache": true } }, "namedInputs": { "default": ["{projectRoot}/**/*"], "production": ["default", "!{projectRoot}/**/*.spec.ts"] }, "defaultBase": "main" }
json{ "name": "my-app", "projectType": "application", "targets": { "build": { "executor": "@nx/next:build", "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/apps/my-app" } }, "serve": { "executor": "@nx/next:server", "options": { "buildTarget": "my-app:build" } } } }
bash# Cache is automatic for cacheable targets nx build my-app # First run: executes nx build my-app # Second run: cached (instant) # Clear cache nx reset
bash# Connect to Nx Cloud npx nx connect # Or add manually nx g @nx/workspace:ci-workflow # Verify connection nx run-many -t build # Look for: "Remote cache hit"
json// In project.json or nx.json { "targets": { "build": { "inputs": [ "default", "^production", { "externalDependencies": ["next"] } ] } } }
bash# 1. Add plugin (if not already installed) pnpm nx add @nx/next # For Next.js pnpm nx add @nx/react # For React pnpm nx add @nx/node # For Node/Express # 2. Generate app pnpm nx g @nx/next:app dashboard --directory=apps/dashboard # 3. Verify in graph pnpm nx graph --focus=dashboard # 4. Build & Serve pnpm nx build dashboard pnpm nx serve dashboard
Python projects use uv workspaces (similar to pnpm workspaces for JS) with manual project.json for Nx:
bash# 1. Create directory and initialize mkdir -p apps/my-python-app cd apps/my-python-app uv init uv add --group dev pytest ruff mypy cd ../.. # 2. Add to uv workspace (root pyproject.toml)
Edit root pyproject.toml:
toml[tool.uv.workspace] members = [ "apps/panaversity-fs-py", "apps/my-python-app", # Add new project here ]
bash# 3. Sync all Python deps from root uv sync --extra dev
apps/my-python-app/project.json (for Nx):
json{ "name": "my-python-app", "projectType": "application", "targets": { "build": { "command": "uv build", "options": { "cwd": "apps/my-python-app" } }, "test": { "command": "uv run --extra dev pytest", "options": { "cwd": "apps/my-python-app" } }, "lint": { "command": "uv run --extra dev ruff check .", "options": { "cwd": "apps/my-python-app" } } } }
bash# 4. Verify Nx recognizes it pnpm nx show projects pnpm nx graph --focus=my-python-app # 5. Run tasks via Nx pnpm nx test my-python-app
Create libraries that multiple Python apps can import:
bashmkdir -p libs/auth-common-py cd libs/auth-common-py uv init --lib cd ../.. # Add to workspace members, then uv sync
Reference in dependent projects:
toml# apps/my-python-app/pyproject.toml [project] dependencies = ["auth-common-py"] [tool.uv.sources] auth-common-py = { workspace = true }
Key Insight: uv manages Python deps via workspace, Nx orchestrates tasks. Single uv.lock at root.
bash# JS/TS UI library pnpm nx g @nx/react:lib ui --directory=libs/shared/ui # JS/TS Utility library pnpm nx g @nx/js:lib utils --directory=libs/shared/utils # Domain library pnpm nx g @nx/js:lib auth --directory=libs/domain/auth
yamlname: CI on: [push, pull_request] jobs: main: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: pnpm/action-setup@v2 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - run: pnpm install --frozen-lockfile # Affected-only builds - run: npx nx affected -t lint build test --base=origin/main
bash# Regenerate project graph nx reset nx graph
bash# Verify target is cacheable cat nx.json | grep -A5 "targetDefaults" # Check inputs are stable nx build my-app --verbose
bash# Show project dependencies nx graph --focus=my-app # Check for circular deps nx graph --file=graph.json # Review edges in JSON
| Task | Command | |------|---------| | Interactive graph | pnpm nx graph | | Affected build | pnpm nx affected -t build | | Run all tests | pnpm nx run-many -t test | | Generate JS/TS app | pnpm nx g @nx/next:app name | | Generate JS/TS lib | pnpm nx g @nx/js:lib name | | Add plugin | pnpm nx add @nx/next | | Clear cache | pnpm nx reset | | Show projects | pnpm nx show projects | | List generators | pnpm nx list @nx/next |
| Task | Command | |------|---------| | Init Python project | cd apps/name && uv init | | Add runtime dep | uv add <package> | | Add dev dep | uv add --group dev <package> | | Sync deps | uv sync --extra dev | | Run via Nx | pnpm nx test my-python-app |
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 15,067 | 11,449 | -24% | 1 | 1 | 0% | 2,923 | 4,714 | +61% | 0 | 0 | — |
case-02 | pass→pass | 7,059 | 2,388 | -66% | 1 | 1 | 0% | 1,209 | 2,687 | +122% | 0 | 0 | — |
case-03 | pass→pass | 3,163 | 2,460 | -22% | 1 | 1 | 0% | 475 | 2,660 | +460% | 0 | 0 | — |
case-04 | pass→pass | 5,508 | 3,240 | -41% | 1 | 1 | 0% | 903 | 2,730 | +202% | 0 | 0 | — |
case-05 | pass→pass | 5,741 | 2,419 | -58% | 1 | 1 | 0% | 1,064 | 2,638 | +148% | 0 | 0 | — |
case-06 | fail→pass | 7,153 | 4,005 | -44% | 1 | 1 | 0% | 1,217 | 2,932 | +141% | 0 | 0 | — |
case-07 | fail→pass | 13,795 | 4,585 | -67% | 1 | 1 | 0% | 2,059 | 3,092 | +50% | 0 | 0 | — |
case-08 | pass→pass | 6,285 | 5,882 | -6% | 1 | 1 | 0% | 997 | 3,220 | +223% | 0 | 0 | — |
case-09 | pass→pass | 8,924 | 3,445 | -61% | 1 | 1 | 0% | 1,690 | 2,914 | +72% | 0 | 0 | — |
case-10 | pass→pass | 5,675 | 3,344 | -41% | 1 | 1 | 0% | 1,070 | 2,884 | +170% | 0 | 0 | — |
case-11 | pass→pass | 8,164 | 3,769 | -54% | 1 | 1 | 0% | 1,338 | 2,939 | +120% | 0 | 0 | — |
case-12 | pass→pass | 6,246 | 3,009 | -52% | 1 | 1 | 0% | 935 | 2,747 | +194% | 0 | 0 | — |
case-13 | pass→pass | 13,648 | 2,503 | -82% | 1 | 1 | 0% | 2,148 | 2,640 | +23% | 0 | 0 | — |
case-14 | pass→pass | 3,219 | 2,378 | -26% | 1 | 1 | 0% | 508 | 2,659 | +423% | 0 | 0 | — |
case-15 | pass→pass | 2,892 | 2,488 | -14% | 1 | 1 | 0% | 503 | 2,610 | +419% | 0 | 0 | — |
case-16 | fail→pass | 7,352 | 4,221 | -43% | 1 | 1 | 0% | 1,252 | 3,003 | +140% | 0 | 0 | — |
case-17 | pass→pass | 7,477 | 3,146 | -58% | 1 | 1 | 0% | 1,246 | 2,693 | +116% | 0 | 0 | — |
case-18 | fail→pass | 5,288 | 2,828 | -47% | 1 | 1 | 0% | 931 | 2,784 | +199% | 0 | 0 | — |
case-19 | fail→fail | 9,889 | 5,331 | -46% | 1 | 1 | 0% | 1,719 | 3,161 | +84% | 0 | 0 | — |
case-20 | fail→fail | 19,038 | 18,430 | -3% | 1 | 1 | 0% | 2,941 | 5,316 | +81% | 0 | 0 | — |
case-21 | fail→fail | 13,010 | 8,517 | -35% | 1 | 1 | 0% | 2,373 | 3,627 | +53% | 0 | 0 | — |
case-22 | fail→fail | 18,869 | 15,911 | -16% | 1 | 1 | 0% | 3,002 | 4,795 | +60% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +18 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.