New to Claude Skills? Learn how to install them →

Ntech-leads-club on GitHub

Nx Workspace Management

Free

Efficiently configure and explore Nx monorepo workspaces.

Get this skill

Free · Opens the source repo

What Nx Workspace Management does

Nx Workspace Management is a skill designed for developers and teams using Nx to manage monorepo workspaces. This skill provides a set of commands to help you configure, explore, and optimize your workspace, making it easier to handle multiple projects within a single repository. It is particularly useful when setting up Nx, analyzing affected projects, and implementing CI/CD workflows using affected commands. By leveraging this skill, you can streamline your development process and improve collaboration among team members.

The skill offers a variety of core commands that allow you to list and explore projects, retrieve project information, and analyze dependencies. For instance, you can easily list all projects or filter them by type, pattern, or target using commands like nx show projects. Additionally, you can get detailed project configurations in JSON format, which is critical for understanding the full setup of each project. This capability is essential for teams that need to manage complex project structures and ensure that all configurations are correctly implemented.

Moreover, Nx Workspace Management includes resources for CI/CD integration, providing examples for popular platforms like GitHub Actions, GitLab CI, and Jenkins. This makes it easier to set up automated workflows that leverage Nx's affected commands, ensuring that only the necessary tests and builds are run, thus saving time and resources. The included best practices guide further enhances the skill by offering troubleshooting tips and performance optimization strategies, which are invaluable for maintaining an efficient development environment.

Overall, this skill is ideal for developers and teams who are working with Nx monorepos and need a reliable way to manage their workspace effectively. It simplifies the complexities of multi-project setups and enhances productivity by providing clear commands and resources for common tasks.

When to use it

Use this skill when setting up or managing an Nx monorepo, especially for tasks like analyzing project dependencies or optimizing CI/CD workflows.

When not to use it

This skill is not suitable for running tasks or code generation; for those purposes, use the nx-run-tasks or nx-generate skills respectively.

What you can build with it

Exploring Workspace Structure

Use `nx show projects` to list all projects in your Nx workspace, helping you understand the overall structure.

Analyzing Affected Projects

Run `nx show projects --affected --base=main` to identify which projects are affected by recent changes, streamlining your testing process.

Setting Up CI/CD

Utilize the CI/CD resources in this skill to configure automated workflows that leverage Nx's affected commands for efficient builds.

How to install Nx Workspace Management

View source

1. Install with the skills CLI

npx skills add tech-leads-club/agent-skills/nx-workspace --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by tech-leads-club

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

# 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.

# 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

# 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

TypePurposeExample
featureBusiness logic, smart componentsfeature-auth
uiPresentational componentsui-buttons
data-accessAPI calls, state managementdata-access-users
utilPure functions, helpersutil-formatting

Detailed Resources

Configuration: See reference/configuration.md for:

  • nx.json templates and options
  • project.json structure
  • Module boundary rules
  • Remote caching setup

Commands: See reference/commands.md for:

  • Complete command reference
  • Advanced filtering options
  • Common workflows

CI/CD: See 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 for:

  • Do's and don'ts
  • Complete troubleshooting guide
  • Performance optimization
  • Migration guides

Common Workflows

"What's in this workspace?"

nx show projects --type app  # List applications
nx show projects --type lib  # List libraries

"How do I run project X?"

nx show project X --json | jq '.targets | keys'

"What changed?"

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.

Frequently asked questions about Nx Workspace Management

Similar skills