nrwl/nx
Overview
This skill helps you explore and understand Nx workspaces so you can answer questions about projects, configuration, targets, and dependencies. It guides you to list projects, inspect resolved project configs and targets, check workspace-wide settings, and determine affected projects after changes. Use it whenever you need an authoritative, read-only view of an Nx monorepo.
How this skill works
The skill relies on Nx CLI queries (nx show projects, nx show project <name> --json) and reading workspace files like nx.json and the Nx schemas in node_modules for full context. It explains how to extract targets, options, inputs/outputs, and metadata from resolved project configurations and how to filter or output results as JSON. It also shows patterns for finding affected projects and locating code that imports a given library when direct dependents lists aren’t available.
When to use it
- To list all projects or filter apps/libs/e2e in the workspace.
- When you need the full resolved configuration and target definitions for a specific project.
- To discover what targets (build/test/lint/serve) are available and their options.
- To find which projects are affected by current changes or between commits.
- To inspect workspace-level defaults, named inputs, or plugin settings in nx.json.
Best practices
- Use nx show project <name> --json for the resolved configuration rather than reading project.json directly.
- Prefix nx with the project package manager (npx/pnpx/yarn) if nx isn’t installed globally and check the lockfile for the manager in use.
- Use --json output and tools like jq to extract specific keys (targets, options, inputs/outputs).
- Combine nx show projects filters (--type, --withTarget, --affected) to narrow results instead of manual searching.
- Read node_modules/nx/schemas/*.json for authoritative schema details on workspace and project options.
Example use cases
- Show all projects and then list targets for project my-app to know how to build and test it.
- Determine which apps and libs are affected by the current branch vs main before running CI.
- Inspect a project's build target to see its executor, inputs, and outputs for caching/debugging.
- Find projects that have a specific target like e2e or serve using nx show projects --withTarget.
- Check nx.json targetDefaults and namedInputs to understand common caching and runtime defaults.
FAQ
No. project.json can be partial; use nx show project <name> --json to get the full resolved configuration including inferred plugin targets.
How do I find which projects import a given library?
Nx CLI doesn’t provide a direct dependents list; search source files for the library import path (grep or ripgrep) across apps/ and libs/, or use Nx dependency graph utilities if available.
2 skills
This skill helps you explore Nx workspaces and understand projects, targets, and dependencies to plan changes effectively.
This skill helps you run and manage Nx workspace tasks like build, test, lint, and serve across projects efficiently.