Monorepo navigator

From borghei/Claude-Skills · View interactive version

Monorepo navigator is an AI agent skill from the GitHub repository borghei/Claude-Skills. Manage and optimize monorepos with Turborepo, Nx, pnpm workspaces, and Changesets. Use when working in monorepos, running impact analysis, optimizing build times with remote caching, migrating from multi-repo, or coordinating publishing.

How to use this skill

Skill file

Monorepo Navigator

Navigate, manage, and optimize monorepos at any scale. Covers Turborepo, Nx, pnpm workspaces, and Lerna/Changesets for cross-package impact analysis, selective builds on affected packages only, dependency graph visualization, remote caching configuration, migration from multi-repo to monorepo with preserved git history, and coordinated package publishing with automated changelogs.

Keywords: monorepo, Turborepo, Nx, pnpm workspaces, Changesets, dependency graph, remote cache, affected packages, selective builds, cross-package impact, npm publishing, workspace protocol

Core Capabilities

When to Use

Clarify First

Before analyzing or configuring, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.

Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.

Tools Overview

| Tool | Purpose | Command |

|------|---------|---------|

| dependency_graph.py | Mermaid dependency graph of internal packages, optionally focused on one package | python3 scripts/dependency_graph.py <root> --focus @repo/ui --direction dependents |

| impact_detector.py | Packages affected (directly and transitively) by changed files | python3 scripts/impact_detector.py <root> --ref origin/main --affected-only |

| package_analyzer.py | Package inventory, internal and shared external dependencies, version drift, orphans | python3 scripts/package_analyzer.py <root> --only-shared |

Workspace detection order: pnpm-workspace.yaml, then the root package.json workspaces field (npm, Yarn), then lerna.json. Exit codes: 0 report; 2 no packages found or bad input (a directory that is not a workspace root must not look like an empty monorepo).

Quick Start

# from engineering/monorepo-navigator/ (a four-package pnpm workspace)
python3 scripts/package_analyzer.py assets/sample_monorepo                    # 4 packages, 3 internal deps, date-fns drift
python3 scripts/impact_detector.py assets/sample_monorepo --files packages/utils/src/index.ts --affected-only
python3 scripts/dependency_graph.py assets/sample_monorepo --focus @acme/utils --direction dependents --mermaid-only

A change in packages/utils affects @acme/ui, @acme/utils and @acme/web (through ui), but not @acme/docs.

Reference Documentation

Load the reference that matches the task — keep this file lean and pull detail on demand:

Anti-Patterns

Mistake: Running every test and build on every change.

Why it matters: CI time grows with the repo, not with the change, and teams start skipping checks.

Instead: Use the affected set from impact_detector.py (or the build tool's filter) and run the full suite on a schedule.

Mistake: Letting shared dependencies drift between packages.

Why it matters: Two versions of the same library ship twice, and bugs reproduce in one app but not another.

Instead: Check package_analyzer.py --only-shared and pin shared versions in one place (catalog or root constraints).

Mistake: Deep imports across package boundaries (../../packages/ui/src/...).

Why it matters: The dependency never appears in package.json, so impact analysis and the build cache miss it.

Instead: Import through the package name and declare it with workspace:*.

Files

| File | Purpose |

|------|---------|

| scripts/package_analyzer.py, scripts/impact_detector.py, scripts/dependency_graph.py | Stdlib CLIs |

| assets/sample_monorepo/ | pnpm workspace: apps/web, apps/docs, packages/ui, packages/utils |

Scope & Limitations

This skill covers:

This skill does NOT cover:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.