nx-workspace
This skill configures and explores Nx monorepo workspaces, enabling developers to list projects, view workspace structure, analyze affected projects across branches, inspect project configurations, and optimize CI/CD pipelines with targeted task execution. Use it when setting up Nx workspaces, understanding project dependencies and boundaries, planning builds based on changed files, or implementing efficient distributed task execution strategies.
git clone --depth 1 https://github.com/tech-leads-club/agent-skills /tmp/nx-workspace && cp -r /tmp/nx-workspace/packages/skills-catalog/skills/(tooling)/nx-workspace ~/.claude/skills/nx-workspaceSKILL.md
# Nx Workspace Management ## Quick Start **Exploring workspace**: `nx show projects` and `nx show project <name> --json` **Running tasks**: `nx <target> <project>` (e.g., `nx build my-app`) **Affected analysis**: `nx show projects --affected` or `nx affected -t <target>` > **Note**: Prefix commands with `npx`/`pnpx`/`yarn` if nx isn't installed globally. ## Core Commands ### List and Explore Projects ```bash # List all projects nx show projects # Filter by type, pattern, or target nx show projects --type app nx show projects --projects "apps/*" nx show projects --withTarget build # Find affected projects nx show projects --affected --base=main ``` ### Get Project Information **Critical**: Always use `nx show project <name> --json` for full resolved configuration. Do NOT read `project.json` directly - it contains only partial configuration. ```bash # Get full configuration nx show project my-app --json # Extract targets nx show project my-app --json | jq '.targets | keys' ``` Configuration schemas: - Workspace: `node_modules/nx/schemas/nx-schema.json` - Project: `node_modules/nx/schemas/project-schema.json` ### Run Tasks ```bash # Run specific project nx build web --configuration=production # Run affected nx affected -t test --base=main # View dependency graph nx graph ``` ## Workspace Architecture ``` workspace/ ├── apps/ # Deployable applications ├── libs/ # Shared libraries │ ├── shared/ # Shared across scopes │ └── feature/ # Feature-specific ├── nx.json # Workspace configuration └── tools/ # Custom executors/generators ``` ### Library Types | Type | Purpose | Example | | --------------- | -------------------------------- | ------------------- | | **feature** | Business logic, smart components | `feature-auth` | | **ui** | Presentational components | `ui-buttons` | | **data-access** | API calls, state management | `data-access-users` | | **util** | Pure functions, helpers | `util-formatting` | ## Detailed Resources **Configuration**: See [reference/configuration.md](reference/configuration.md) for: - nx.json templates and options - project.json structure - Module boundary rules - Remote caching setup **Commands**: See [reference/commands.md](reference/commands.md) for: - Complete command reference - Advanced filtering options - Common workflows **CI/CD**: See [reference/ci-cd.md](reference/ci-cd.md) for: - GitHub Actions configuration - GitLab CI setup - Jenkins, Azure Pipelines, CircleCI examples - Affected commands in pipelines **Best Practices**: See [reference/best-practices.md](reference/best-practices.md) for: - Do's and don'ts - Complete troubleshooting guide - Performance optimization - Migration guides ## Common Workflows **"What's in this workspace?"** ```bash nx show projects --type app # List applications nx show projects --type lib # List libraries ``` **"How do I run project X?"** ```bash nx show project X --json | jq '.targets | keys' ``` **"What changed?"** ```bash nx show projects --affected --base=main ``` ## Quick Troubleshooting - **Targets not showing**: Use `nx show project <name> --json`, not project.json - **Affected not working**: Ensure git history available (`fetch-depth: 0` in CI) - **Cache issues**: Run `nx reset` For detailed troubleshooting, see [reference/best-practices.md](reference/best-practices.md).
Finds duplicate business logic spread across multiple components and suggests consolidation. Use when asking "where is this logic duplicated?", "find common code between services", "what can be consolidated?", "detect shared domain logic", or analyzing component overlap before refactoring. Do NOT use for code-level duplication detection (use linters) or dependency analysis (use coupling-analysis).
Detects misplaced classes and fixes component hierarchy problems — finds code that should belong inside a component but sits at the root level. Use when asking "clean up component structure", "find orphaned classes", "fix module hierarchy", "flatten nested components", or analyzing why namespaces have misplaced code. Do NOT use for dependency analysis (use coupling-analysis) or domain grouping (use domain-identification-grouping).
Maps architectural components in a codebase and measures their size to identify what should be extracted first. Use when asking "how big is each module?", "what components do I have?", "which service is too large?", "analyze codebase structure", "size my monolith", or planning where to start decomposing. Do NOT use for runtime performance sizing or infrastructure capacity planning.
Analyzes coupling between modules using the three-dimensional model (strength, distance, volatility) from "Balancing Coupling in Software Design". Use when asking "are these modules too coupled?", "show me dependencies", "analyze integration quality", "which modules should I decouple?", "coupling report", or evaluating architectural health. Do NOT use for domain boundary analysis (use domain-analysis) or component sizing (use component-identification-sizing).
Creates step-by-step decomposition plans and migration roadmaps for breaking apart monolithic applications. Use when asking "what order should I extract services?", "plan my migration", "create a decomposition roadmap", "prioritize what to split", "monolith to microservices strategy", or tracking decomposition progress. Do NOT use for domain analysis (use domain-analysis) or component sizing (use component-identification-sizing).
Maps business domains and suggests service boundaries in any codebase using DDD Strategic Design. Use when asking "what are the domains in this codebase?", "where should I draw service boundaries?", "identify bounded contexts", "classify subdomains", "DDD analysis", or analyzing domain cohesion. Do NOT use for grouping existing components into domains (use domain-identification-grouping) or dependency analysis (use coupling-analysis).
Groups existing components into logical business domains to plan service-based architecture. Use when asking "which components belong together?", "group these into services", "organize by domain", "component-to-domain mapping", or planning service extraction from an existing codebase. Do NOT use for identifying new domains from scratch (use domain-analysis) or analyzing coupling (use coupling-analysis).
AI frontend specialist and design consultant that guides users through a structured discovery process before generating any code. Collects visual references, design tokens, typography, icons, layout preferences, and brand guidelines to ensure the final output matches the user's vision with high fidelity. Use when the user asks to build, design, create, or improve any frontend interface — websites, landing pages, dashboards, components, apps, emails, forms, modals, or any UI element. Also triggers on "build me a UI", "design a page", "create a component", "improve this layout", "make this look better", "frontend", "interface", "redesign", or when the user provides mockups, screenshots, or design references. Do NOT use for backend logic, API design, database schemas, or non-visual code tasks.