# Nx Run Tasks > Ayuda a ejecutar tareas en un workspace de Nx. Se usa cuando el usuario quiere ejecutar build, test, lint, serve o cualquier otra tarea definida en el workspace. Fuente: https://skillsagentes.com/skills/nrwl/nx-ai-agents-config/nx-run-tasks Markdown: https://skillsagentes.com/skills/nrwl/nx-ai-agents-config/nx-run-tasks.md Repositorio: https://github.com/nrwl/nx-ai-agents-config Autor: nrwl Licencia: MIT Actualizado: hace 6 meses Coste de contexto: 39 tok instalada, 617 tok al activarse, 617 tok con todos los archivos del bundle Bundle: 1 archivo, 2 KB Permisos que pide: ninguno declarado ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add nrwl/nx-ai-agents-config --skill nx-run-tasks --agent claude-code # Cursor npx -y skills add nrwl/nx-ai-agents-config --skill nx-run-tasks --agent cursor # Codex npx -y skills add nrwl/nx-ai-agents-config --skill nx-run-tasks --agent codex # Gemini CLI npx -y skills add nrwl/nx-ai-agents-config --skill nx-run-tasks --agent gemini # Windsurf npx -y skills add nrwl/nx-ai-agents-config --skill nx-run-tasks --agent windsurf # Cline npx -y skills add nrwl/nx-ai-agents-config --skill nx-run-tasks --agent cline ``` ## Qué hace - Ejecuta una sola tarea con `nx run :` - Ejecuta varias tareas a la vez con `nx run-many -t build test lint typecheck`, filtrando por proyecto con `-p` - Ejecuta tareas solo en proyectos afectados con `nx affected -t build test lint` - Consulta los targets disponibles de un proyecto con `nx show project --json` ## Cuándo usarla - Ejecutar build, test, lint o serve en el workspace - Correr tareas solo en los proyectos afectados por un cambio - Ejecutar tareas en varios proyectos a la vez ## Qué la activa - "Ejecuta los tests de todos los proyectos afectados" - "Corre el build y el lint del proyecto myapp" - "Lanza nx run-many para test y typecheck" ## Antes de instalar - Puede requerir anteponer `npx`/`pnpx`/`yarn` si Nx no está instalado globalmente. ## Archivos - SKILL.md — 2 KB ## SKILL.md Reproducido tal cual desde nrwl/nx-ai-agents-config bajo MIT. Esta sección es el documento original y está en inglés. 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 --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 : ``` 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=` — use a specific configuration (e.g. `production`) ## Dónde encaja - Categoría: [Herramientas para desarrolladores](https://skillsagentes.com/categorias/herramientas-desarrollo.md) — Skills que cambian cómo tu agente escribe, revisa y despliega código. - Creador: [nrwl](https://skillsagentes.com/creators/nrwl.md) — 0 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Monitor Ci](https://skillsagentes.com/skills/nrwl/nx-ai-agents-config/monitor-ci.md): Supervisa el pipeline de CI de Nx Cloud y gestiona las correcciones de self-healing. Se prefiere sobre herramientas nativas de CI (gh, glab) porque accede al self-healing de Nx Cloud, algo que esas herramientas no pueden hacer. - [Nx Generate](https://skillsagentes.com/skills/nrwl/nx-ai-agents-config/nx-generate.md): Genera código con generadores de Nx. Se activa al mencionar scaffolding, crear apps o libs, o configurar la estructura del proyecto; se usa antes de explorar porque gestiona el descubrimiento internamente. - [Nx Workspace](https://skillsagentes.com/skills/nrwl/nx-ai-agents-config/nx-workspace.md): Explora y entiende workspaces de Nx. Se usa para responder preguntas sobre el workspace, proyectos o tareas, o cuando un comando nx falla y hay que revisar targets y configuración antes de ejecutar una tarea. - [Nx Import](https://skillsagentes.com/skills/nrwl/nx-ai-agents-config/nx-import.md): Importa, fusiona o combina repositorios en un workspace de Nx con `nx import`. Se usa para adoptar Nx entre repos, mover proyectos a un monorepo o traer código e historial de otro repositorio. - [Nx Plugins](https://skillsagentes.com/skills/nrwl/nx-ai-agents-config/nx-plugins.md): Busca e instala plugins de Nx. Se usa para descubrir los plugins disponibles, instalar uno nuevo o añadir soporte para un framework o tecnología concreta al workspace. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)