nx-workspace-patterns

Configure Nx monorepo workspaces with project boundaries, caching, and affected commands.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill nx-workspace-patterns-sanketadlak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nx-workspace-patterns
Source: https://github.com/SanketAdlak/PDMProjectDesign/tree/main/.agents/skills/nx-workspace-patterns
Command: npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill nx-workspace-patterns-sanketadlak

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up and maintaining an Nx monorepo involves complex configuration decisions around project structure, module boundaries, build caching, and CI optimization. This Skill provides production-ready templates and patterns that eliminate guesswork when configuring Nx workspaces. ## Core Features & Use Cases - Workspace Configuration: Ready-to-use nx.json and project.json templates covering caching, target defaults, named inputs, and generator defaults. - Module Boundary Enforcement: ESLint rules using @nx/enforce-module-boundaries with tag-based dependency constraints across library types (feature, ui, data-access, util) and scopes. - CI Optimization: GitHub Actions workflow templates using nx affected commands and Nx Cloud or self-hosted S3 remote caching to run tasks only on changed projects. - Use Case: When migrating an existing repository to Nx, apply the nx.json template for cacheable operations, tag projects by type and scope, enforce boundaries via ESLint, and wire up affected commands in CI to cut build times. ## Quick Start Ask the AI to set up an Nx workspace configuration with module boundary rules and affected-based CI for your monorepo.

Frequently Asked Questions about nx-workspace-patterns

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

FAQPage Schema
How do I configure Nx module boundaries with ESLint?

Use the @nx/enforce-module-boundaries ESLint rule with depConstraints that map source tags to allowed dependency tags. Tag projects by type (app, feature, ui, data-access, util) and scope, then define which tag combinations may depend on each other.

How to set up Nx affected commands in GitHub Actions CI?

Use nrwl/nx-set-shas to derive base and head SHAs, then run npx nx affected -t lint, test, build, and e2e with parallel flags. Checkout with fetch-depth 0 so Nx can compute the affected project graph from git history.

Does Nx support remote caching without Nx Cloud?

Yes, Nx supports self-hosted remote caching through custom task runners such as @nx-aws-cache/nx-aws-cache, which stores build artifacts in an S3 bucket. Configure it in nx.json tasksRunnerOptions with your AWS region, bucket, and profile.

What library types should an Nx monorepo use?

Nx monorepos commonly use five library types: feature for smart components and business logic, ui for presentational components, data-access for API calls and state, util for pure functions, and shell for app bootstrapping. Enforce the hierarchy with module boundary rules.

Why is my Nx cache not working for builds?

Caching fails when the operation is not listed in cacheableOperations or when inputs are misconfigured. Verify build, lint, test, and e2e appear in cacheableOperations, define namedInputs like production to exclude test files, and run nx reset to clear stale cache state.