monorepo

Detect and navigate monorepos correctly. Use when working with repos containing multiple packages (pnpm/yarn/npm workspaces, Turborepo, Nx, Lerna). Ensures commands run in correct package scope, dependencies are routed properly, and cross-package changes are coordinated.

Best use case

monorepo is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Detect and navigate monorepos correctly. Use when working with repos containing multiple packages (pnpm/yarn/npm workspaces, Turborepo, Nx, Lerna). Ensures commands run in correct package scope, dependencies are routed properly, and cross-package changes are coordinated.

Teams using monorepo should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/monorepo/SKILL.md --create-dirs "https://raw.githubusercontent.com/nguyenthienthanh/aura-frog/main/aura-frog/skills/monorepo/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/monorepo/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How monorepo Compares

Feature / AgentmonorepoStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Detect and navigate monorepos correctly. Use when working with repos containing multiple packages (pnpm/yarn/npm workspaces, Turborepo, Nx, Lerna). Ensures commands run in correct package scope, dependencies are routed properly, and cross-package changes are coordinated.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

> **AI-consumed reference.** Optimized for Claude to read during execution.
> Human-readable explanation: see [docs/architecture/HIERARCHICAL_PLANNING.md](../../../docs/architecture/HIERARCHICAL_PLANNING.md)
> or [docs/getting-started/](../../../docs/getting-started/) depending on topic.


# Monorepo Handling

Monorepos break many assumptions: which `package.json` is "the" one, where `node_modules` live, which test command runs, what `install` actually does. This skill ensures operations target the correct scope.

---

## Detection

On session start or first file edit, check for these markers:

| File | Tool |
|------|------|
| `pnpm-workspace.yaml` | pnpm workspaces |
| `turbo.json` | Turborepo |
| `nx.json` | Nx |
| `lerna.json` | Lerna |
| `package.json` with `"workspaces": [...]` | npm / yarn workspaces |
| `Cargo.toml` with `[workspace]` | Rust workspaces |
| `go.work` | Go workspaces |
| `pyproject.toml` with Poetry/uv workspace config | Python workspaces |

If detected → monorepo mode ON. Record in workflow state. All subsequent commands must respect package scope.

---

## Key Rules

### 1. Always identify the target package first

Before any `install`, `test`, or `build`:
- Which package is the change in? Full path: `packages/<name>/`
- Run **scoped**, not from root: `pnpm --filter <name> test`

### 2. Cross-package changes = coordinate

If a change touches package A's API used by package B:
- List all consumers: `grep -r "@your-org/package-a" packages/`
- Update all consumers in the same PR
- Run tests across **all** affected packages, not just A

### 3. Dependency placement matters

| Dependency type | Where to install |
|-----------------|------------------|
| Used by 1 package | That package's `package.json` |
| Used by 2+ packages | Shared config package or root `devDependencies` |
| Dev tooling (eslint, prettier, jest) | Root |
| Workspace packages | Listed as `"workspace:*"` in consumer's dependencies |

### 4. Build order respects the dependency graph

Don't assume alphabetical build order. Check the graph:
- **Turborepo:** `turbo.json` pipeline field
- **Nx:** `nx graph` visualises it
- **pnpm:** `pnpm list --recursive --depth=0`

### 5. Tests run scoped — not from root

```bash
# ❌ Wrong — runs all tests, slow, often broken
npm test

# ✓ Right — tests only affected packages
turbo test --filter=[HEAD^1]
nx affected:test
pnpm --filter='...[HEAD^1]' test
```

`[HEAD^1]` computes packages affected since the last commit. CI should use the same.

---

## Common Gotchas

- **node_modules hoisting** — package A may accidentally use package B's transitive dep. When B changes, A breaks. Fix: explicit dependency declaration, don't rely on hoist.
- **TypeScript project references** — changes to package A won't appear in package B until `tsc --build` runs across references. Check `tsconfig.json` → `references`.
- **Jest/Vitest root config** — may not pick up per-package configs. Check that monorepo tooling hands off correctly (Turborepo and Nx usually do; raw pnpm doesn't).
- **CI matrix** — running the full suite on every PR wastes money. Use affected-only detection.
- **Lockfile per workspace vs root** — npm 7+ and pnpm keep a single root lockfile. Don't commit per-package lockfiles.

---

## Integration with Aura Frog Workflow

- **Phase 1 design** — identify all packages touched in the plan
- **Phase 2 tests** — scope to affected packages only
- **Phase 3 build** — run scoped builds, not root
- **Phase 4 review** — check cross-package contracts (API compatibility between versions)

---

## Tie-Ins

- `skills/framework-expert/SKILL.md` — your framework may have monorepo-specific integration
- `skills/test-writer/SKILL.md` — test placement in monorepo (per-package vs shared test dir)
- `rules/core/verification.md` — verify commands ran in the right scope (which tests actually executed?)
- `commands/run.md` — run-orchestrator loads this skill when monorepo markers detected

Related Skills

vue-expert

14
from nguyenthienthanh/aura-frog

Vue 3 gotchas and decision criteria. Covers reactivity traps, Composition API pitfalls, and Pinia patterns.

typescript-expert

14
from nguyenthienthanh/aura-frog

TypeScript gotchas and decision criteria covering nullish coalescing pitfalls (|| vs ??), strict tsconfig settings (noUncheckedIndexedAccess, exactOptionalPropertyTypes), type guard patterns, discriminated unions, and as const vs enum. Use when writing TypeScript, configuring tsconfig, implementing type guards, or debugging null/undefined errors.

tree-of-thoughts

14
from nguyenthienthanh/aura-frog

Branch, evaluate, prune, expand — structured search over solution space. Use for architecture with multi-step decisions, refactor planning, or complex debug hypothesis trees. Paper: Yao et al. 2023.

test-writer

14
from nguyenthienthanh/aura-frog

Write tests with TDD following structured patterns. Ensures consistent AAA structure, proper coverage targets, and framework-specific conventions. Without this skill, tests lack consistent naming, miss coverage targets, and skip anti-pattern checks.

stitch-design

14
from nguyenthienthanh/aura-frog

Generate UI designs using Google Stitch AI with optimized prompts

session-continuation

14
from nguyenthienthanh/aura-frog

Manage workflow state across sessions with handoff and resume. TOON-based state persistence.

sequential-thinking

14
from nguyenthienthanh/aura-frog

Structured thinking process for complex analysis. Supports revision, branching, and dynamic adjustment.

self-improve

14
from nguyenthienthanh/aura-frog

Apply learned improvements to the Aura Frog plugin. Updates rules, adjusts agent routing, modifies workflow configurations, and generates knowledge base entries.

self-healing-orchestrator

14
from nguyenthienthanh/aura-frog

Proposes patches for F2 (local-logic) and F3 (local-design) failures. NEVER applies without user approval. Confidence ≥0.7 to propose; below that, escalates raw findings. Counts toward replan_budget. Per-task: max 1; per-session: max 5.

self-consistency

14
from nguyenthienthanh/aura-frog

Generate N independent reasoning paths and vote on the answer. Use for architectural trade-offs, ambiguous design decisions, or when single-path reasoning risks locking onto the first plausible answer. Paper: Wang et al. 2022.

scalable-thinking

14
from nguyenthienthanh/aura-frog

Design for scale while keeping implementation simple (KISS).

run-orchestrator

14
from nguyenthienthanh/aura-frog

Execute 5-phase TDD workflow for complex features. Use when the user invokes /run, asks to build/create/implement a feature, requests a complex multi-file change, or types 'fasttrack:'. Enforces phase gates, sprint contracts, and builder!=reviewer discipline.