
Nx Run Tasks
Run the right Nx targets (build, test, lint, serve) in a monorepo without guessing project names or package-manager prefixes.
Overview
Nx Run Tasks is an agent skill most often used in Build (also Ship testing) that runs Nx workspace targets via nx run, run-many, and affected with correct project and flag usage.
Install
npx skills add https://github.com/nrwl/nx-ai-agents-config --skill nx-run-tasksWhat is this skill?
- Discover runnable targets via nx show project <name> --json including plugin-inferred tasks
- Single task: nx run project:task; bulk: nx run-many with -p, --exclude, and --parallel (default 3)
- Affected workflows: nx affected -t with graph-aware scope for CI-style runs
- Package-manager aware: npx/pnpx/yarn prefix when nx is not global
- --help on nx run-many and nx affected for flag discovery
- nx run-many default --parallel of 3
Adoption & trust: 1.9k installs on skills.sh; 24 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You know something should build or test in your Nx repo but your agent picks wrong project IDs, misses inferred targets, or runs tasks on the entire workspace blindly.
Who is it for?
Solo builders on Nx monorepos who delegate build, test, lint, and serve commands to coding agents.
Skip if: Single-package repos with no Nx, or teams that only need one npm script and never use the Nx graph.
When should I use this skill?
USE WHEN the user wants to execute build, test, lint, serve, or run any other tasks defined in the Nx workspace.
What do I get? / Deliverables
Your agent discovers valid targets, runs scoped nx commands with the right package-manager prefix, and uses parallel and affected options when you need faster monorepo feedback.
- Correct nx run / run-many / affected command lines
- Target discovery summary from nx show project
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Nx task execution is the daily orchestration layer for monorepo builds; the canonical shelf is Build PM because it is how you drive projects and pipelines locally. Choosing run vs run-many vs affected and reading targets maps to monorepo project management, not writing feature code.
Where it fits
Run nx run myapp:serve after an agent adds a new library dependency.
Execute nx affected -t test --parallel before merging a feature branch.
Re-run nx run-many -t lint on a subset of projects after a toolchain upgrade.
How it compares
Operational Nx CLI guidance—not a substitute for defining targets in project.json or configuring Nx plugins.
Common Questions / FAQ
Who is nx-run-tasks for?
Developers and agents working in Nx workspaces who need reliable commands for build, test, lint, serve, and other configured targets.
When should I use nx-run-tasks?
In Build when running local dev serves and compiles; in Ship when executing test, lint, and typecheck gates; whenever the user wants to execute tasks defined in the workspace.
Is nx-run-tasks safe to install?
The skill instructs running nx CLI tasks on your machine; review Security Audits on this page and treat agent-driven shell commands like your own terminal use.
SKILL.md
READMESKILL.md - Nx Run Tasks
You can run tasks with Nx in the following way. Keep in mind that you might have to prefix things with npx/pnpx/yarn if the user doesn't have nx installed globally. Look at the package.json or lockfile to determine which package manager is in use. For more details on any command, run it with `--help` (e.g. `nx run-many --help`, `nx affected --help`). ## Understand which tasks can be run You can check those via `nx show project <projectname> --json`, for example `nx show project myapp --json`. It contains a `targets` section which has information about targets that can be run. You can also just look at the `package.json` scripts or `project.json` targets, but you might miss out on inferred tasks by Nx plugins. ## Run a single task ``` nx run <project>:<task> ``` where `project` is the project name defined in `package.json` or `project.json` (if present). ## Run multiple tasks ``` nx run-many -t build test lint typecheck ``` You can pass a `-p` flag to filter to specific projects, otherwise it runs on all projects. You can also use `--exclude` to exclude projects, and `--parallel` to control the number of parallel processes (default is 3). Examples: - `nx run-many -t test -p proj1 proj2` — test specific projects - `nx run-many -t test --projects=*-app --exclude=excluded-app` — test projects matching a pattern - `nx run-many -t test --projects=tag:api-*` — test projects by tag ## Run tasks for affected projects Use `nx affected` to only run tasks on projects that have been changed and projects that depend on changed projects. This is especially useful in CI and for large workspaces. ``` nx affected -t build test lint ``` By default it compares against the base branch. You can customize this: - `nx affected -t test --base=main --head=HEAD` — compare against a specific base and head - `nx affected -t test --files=libs/mylib/src/index.ts` — specify changed files directly ## Useful flags These flags work with `run`, `run-many`, and `affected`: - `--skipNxCache` — rerun tasks even when results are cached - `--verbose` — print additional information such as stack traces - `--nxBail` — stop execution after the first failed task - `--configuration=<name>` — use a specific configuration (e.g. `production`)