nx-monorepo

Configures Nx workspace structure, module boundaries, caching, and CI task orchestration.

1|Updated Oct 11, 2025
One-click install
npx skills add https://github.com/codewizwit/human-in-the-loop --skill nx-monorepo-codewizwit
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nx-monorepo
Source: https://github.com/codewizwit/human-in-the-loop/tree/main/lib/skills/nx-monorepo
Command: npx skills add https://github.com/codewizwit/human-in-the-loop --skill nx-monorepo-codewizwit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing an Nx monorepo involves complex decisions about workspace structure, dependency boundaries, build caching, and CI efficiency, and misconfiguration leads to slow pipelines, circular dependencies, and unmaintainable code. ## Core Features & Use Cases - Workspace Organization: Establishes apps/libs directory structure with scope and type tagging conventions for Angular, React, and NestJS projects. - Module Boundary Enforcement: Configures the @nx/enforce-module-boundaries ESLint rule with depConstraints to prevent unauthorized cross-project imports. - Caching and CI Optimization: Sets up computation caching, affected commands, Nx Cloud remote caching, and GitHub Actions pipelines that only build and test changed projects. - Use Case: Your CI pipeline runs all tests on every PR even when only one library changed. This Skill generates a GitHub Actions workflow using nx affected with nrwl/nx-set-shas, parallel execution, and remote caching to cut build times dramatically. ## Quick Start Ask the assistant to set up an Nx workspace for an Angular frontend with a NestJS API, including module boundaries and an optimized CI pipeline.

Frequently Asked Questions about nx-monorepo

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce module boundaries in an Nx workspace?▼

Use the @nx/enforce-module-boundaries ESLint rule with depConstraints based on project tags. Assign each project scope tags (scope:shared, scope:web-app) and type tags (type:feature, type:ui, type:data-access, type:util), then define which tag combinations may depend on each other.

How to speed up Nx CI pipelines with affected commands?▼

Run nx affected --target=test with --base and --head SHAs so only changed projects are built and tested. In GitHub Actions, use nrwl/nx-set-shas to determine the correct base SHA, add --parallel for concurrency, and enable Nx Cloud remote caching.

When should I create a library vs keep code in an app?▼

Create a library when code is shared across apps, represents a distinct domain, or needs boundary enforcement and independent testing. Avoid libraries for code used in only one place or experimental code, since over-segmentation adds maintenance overhead.

Does Nx support module federation for micro-frontends?▼

Yes, Nx supports module federation through host and remote configuration files that expose and load modules at runtime. Use loadRemoteModule from @nx/angular/mf for lazy loading, and mark framework dependencies like @angular/core as singletons in shared config.

Why is my Nx build cache not working?▼

Caching fails when targets are not listed in cacheableOperations, inputs are misconfigured, or outputs paths are wrong in nx.json targetDefaults. Verify build, test, lint, and e2e are cacheable and that inputs like production and ^production match your file layout.

What are the limitations of Nx buildable libraries?▼

Buildable libraries add build orchestration overhead, so simple utility libraries do not benefit from separate builds. They are best reserved for large projects with many dependencies where incremental builds and finer cache granularity pay off.