Skip to content
nx-monorepo logo

Nx Monorepo

nx-monorepo

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 bu...

aiskillstore/marketplace0installs430stars

SKILL.md

Full skill instructions

Nx Monorepo

Overview

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.

MCP Tools Available

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.

Core CLI Commands

Project Graph Analysis

# 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

Affected Detection

# 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

Running Tasks

# 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

Code Generation

# 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

Configuration Files

nx.json (Workspace Config)

{
  "targetDefaults": {
    "build": {
      "dependsOn": ["^build"],
      "cache": true
    },
    "test": {
      "cache": true
    },
    "lint": {
      "cache": true
    }
  },
  "namedInputs": {
    "default": ["{projectRoot}/​**/​*"],
    "production": ["default", "!{projectRoot}/​**/​*.spec.ts"]
  },
  "defaultBase": "main"
}

project.json (Project Config)

{
  "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"
      }
    }
  }
}

Caching

Local Cache

# 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

Nx Cloud (Remote Cache)

# 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"

Cache Inputs

// In project.json or nx.json
{
  "targets": {
    "build": {
      "inputs": [
        "default",
        "^production",
        { "externalDependencies": ["next"] }
      ]
    }
  }
}

Common Patterns

Adding a New JS/​TS App

# 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

Adding a Python App (uv Workspace)

Python projects use uv workspaces (similar to pnpm workspaces for JS) with manual project.json for Nx:

# 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:

[tool.uv.workspace]
members = [
    "apps/​panaversity-fs-py",
    "apps/​my-python-app",  # Add new project here
]
# 3. Sync all Python deps from root
uv sync --extra dev

apps/​my-python-app/​project.json (for Nx):

{
  "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" }
    }
  }
}
# 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

Shared Python Libraries

Create libraries that multiple Python apps can import:

mkdir -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:

# 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.

Creating Shared Libraries

# 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

CI Pipeline (GitHub Actions)

name: 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

Troubleshooting

"Cannot find project"

# Regenerate project graph
nx reset
nx graph

Cache Not Working

# Verify target is cacheable
cat nx.json | grep -A5 "targetDefaults"

# Check inputs are stable
nx build my-app --verbose

Dependency Issues

# Show project dependencies
nx graph --focus=my-app

# Check for circular deps
nx graph --file=graph.json
# Review edges in JSON

Quick Reference

TaskCommand
Interactive graphpnpm nx graph
Affected buildpnpm nx affected -t build
Run all testspnpm nx run-many -t test
Generate JS/​TS apppnpm nx g @nx/​next:app name
Generate JS/​TS libpnpm nx g @nx/​js:lib name
Add pluginpnpm nx add @nx/​next
Clear cachepnpm nx reset
Show projectspnpm nx show projects
List generatorspnpm nx list @nx/​next

Python-Specific (uv)

TaskCommand
Init Python projectcd apps/​name && uv init
Add runtime depuv add <package>
Add dev depuv add --group dev <package>
Sync depsuv sync --extra dev
Run via Nxpnpm nx test my-python-app

Related Skills

  • monorepo-workflow: PR stacking, trunk-based development, code review
  • monorepo-team-lead: CODEOWNERS, human-AI task routing, RFC process

More skills from aiskillstore

docx logo
aiskillstore/marketplace

docx

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

430 216
View
agent-development logo
aiskillstore/marketplace

agent-development

This handles everything around building autonomous agents for Claude Code plugins.

430 197
View
doc-coauthoring logo
aiskillstore/marketplace

doc-coauthoring

Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.

430 196
View
skill-development logo
aiskillstore/marketplace

skill-development

This is the meta-skill for building skills themselves.

430 196
View
canvas-design logo
aiskillstore/marketplace

canvas-design

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.

430 193
View
webapp-testing logo
aiskillstore/marketplace

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

430 191
View
hook-development logo
aiskillstore/marketplace

hook-development

Helps you build event-driven automation for Claude Code using hooks that trigger on tool use, session events, and stop conditions.

430 187
View
algorithmic-art logo
aiskillstore/marketplace

algorithmic-art

Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.

430 185
View
command-development logo
aiskillstore/marketplace

command-development

Shows Claude Code how to build slash commands from markdown files, covering the YAML frontmatter options, dynamic arguments with $1/$2...

430 185
View
plugin-structure logo
aiskillstore/marketplace

plugin-structure

This is your reference when scaffolding Claude Code plugins or figuring out why components aren't loading.

430 183
View
skill-installer logo
aiskillstore/marketplace

skill-installer

Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos).

430 180
View
web-artifacts-builder logo
aiskillstore/marketplace

web-artifacts-builder

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

430 177
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View