PluginBench
Skill
Review
Audit score 70

nx-run-tasks

nrwl/nx-ai-agents-config

Execute build, test, lint, serve, and other tasks in Nx workspaces with filtering and parallelization.

What is nx-run-tasks?

Runs tasks defined in an Nx workspace, supporting single projects, multiple projects, and affected-only execution. Use this when you need to build, test, lint, serve, or execute any other workspace task with options for filtering, parallelization, and caching control.

  • Run single tasks on specific projects with `nx run <project>:<task>`
  • Execute multiple tasks across projects with `nx run-many`, with project filtering and pattern matching
  • Run tasks only on affected projects and their dependents using `nx affected` for efficient CI pipelines
  • Filter projects by name, glob patterns, or tags when running tasks
  • Control parallelization, caching, and error handling with flags like `--parallel`, `--skipNxCache`, and `--nxBail`
  • Discover available tasks for a project via `nx show project <projectname> --json`

How to install nx-run-tasks

npx skills add https://github.com/nrwl/nx-ai-agents-config --skill nx-run-tasks
Prerequisites
  • Nx workspace set up with projects defined in package.json or project.json
  • Package manager (npm, yarn, or pnpm) configured in the workspace
Claude Code
Cursor
Windsurf
Cline

How to use nx-run-tasks

  1. 1.Identify the project name and task you want to run (check `nx show project <projectname> --json` to see available tasks)
  2. 2.For a single task: run `nx run <project>:<task>`
  3. 3.For multiple tasks across projects: run `nx run-many -t <task1> <task2>` with optional `-p` or `--projects` flags to filter
  4. 4.For affected projects only: run `nx affected -t <task1> <task2>` to run on changed projects and dependents
  5. 5.Add flags as needed: `--parallel=<number>`, `--skipNxCache`, `--verbose`, `--nxBail`, or `--configuration=<name>`

Use cases

Good for
  • Run build and test tasks on specific projects during development or CI
  • Execute linting and type-checking across the entire workspace
  • Run only affected tests and builds when changes are made to a subset of projects
  • Run tasks with production configuration for deployment pipelines
  • Parallelize task execution across multiple projects to speed up CI workflows
Who it's for
  • Nx workspace developers and maintainers
  • CI/CD pipeline engineers
  • Teams managing monorepos with multiple interdependent projects

nx-run-tasks FAQ

How do I know which tasks are available for a project?

Run `nx show project <projectname> --json` to see the targets section, which lists all available tasks including those inferred by Nx plugins. You can also check the project.json or package.json scripts.

What's the difference between `nx run-many` and `nx affected`?

`nx run-many` runs tasks on all projects (or filtered ones), while `nx affected` only runs tasks on projects that have changed and projects that depend on them. Use `nx affected` in CI for faster feedback.

How do I run tasks on projects matching a pattern?

Use glob patterns with `nx run-many -t <task> --projects=*-app` or filter by tags with `--projects=tag:api-*`. You can also exclude projects with `--exclude=<projectname>`.

Can I run tasks with a specific configuration like production?

Yes, use the `--configuration=<name>` flag, for example `nx run myapp:build --configuration=production`.

How do I rerun tasks even if they're cached?

Use the `--skipNxCache` flag to bypass the cache and rerun tasks from scratch.

Full instructions (SKILL.md)

Source of truth, from nrwl/nx-ai-agents-config.


name: nx-run-tasks description: Helps with running tasks in an Nx workspace. USE WHEN the user wants to execute build, test, lint, serve, or run any other tasks defined in the workspace.

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)