nx-run-tasks
Helps with running tasks in an Nx workspace.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- nx-run-tasks
- description
- Helps with running tasks in an Nx workspace.
- when_to_use
- Use when the user wants to execute build, test, lint, serve, or run any other tasks defined in the workspace.
03 SKILL.md 正文
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).
Repository HIPPO
When the workspace rule links repo-governance/development/resource-aware-development.md, wrap compute-bearing Nx commands for every project under apps/ and libs/ through exactly one outer HIPPO boundary with explicit --disk-path. This includes current and newly added applications, E2E adapters, libraries, and repository tools with compute-bearing targets. A self-guarded target remains the sole boundary, so callers invoke it natively. Preserve the package-manager-prefixed inner Nx command, dependency and correctness ordering, and any repository-required shell prefix. Independent work may overlap through the fixed admitted allocation; never duplicate or concurrently retry one exit-75 invocation. Wait for its stated FIFO deferral or shedding condition, then retry only that command. Run recovery and read-only status controls directly so pressure protection cannot block service restoration.
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 projectsnx run-many -t test --projects=*-app --exclude=excluded-app— test projects matching a patternnx 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 headnx 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)
04 同仓库更多 Skills
writing-browser-e2e-tests
Guides writing browser end-to-end tests that find elements as users do, wait on what the action produced, keep page knowledge in page objects, organize one feature per file, and run scenario-backed suites from generated specs.
usability-heuristic-evaluation
Guides judging a running interface as a first-time user would, without its specifications: citing a named principle for every finding, walking each task step, reading labels and addresses for scent, and rating severity.
tooling-nx
Guides Nx workspace work under the Nx standard: selecting projects by the graph, adding a target only where a capability exists, tracing a stale cached pass to its missing input, and answering a module-boundary finding.
programming-typescript
Guides the procedure for writing or changing TypeScript: loading the TypeScript standard first, driving each increment test-first, finding which rule a decision falls under, and confirming the gates before handing off.
programming-shell
Guides shell work under the shell standards: checking the declared dialect first, deciding whether logic belongs in shell at all, tracing where exit-on-error does not reach, and testing the script as its callers run it.
programming-javascript
Guides JavaScript work under the JavaScript standard: confirming the file is type-checked, typing through JSDoc, validating input the checker cannot see, and noticing floating promises and swallowed errors before handing off.