بنقرة واحدة
run-nx-checks
Run nx format, lint, test, and build on affected or specified projects, then fix unambiguous failures
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Run nx format, lint, test, and build on affected or specified projects, then fix unambiguous failures
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Audit the current project's agent-memory and, block by block, relocate each entry into a user-controlled home (project doc/skill/rule or user-level skill/rule) or archive it — draining memory so nothing uncontrolled accumulates in the agent's context.
How to write texts meant to be published by humans for other humans.
Fresh-eyes review of a changeset by a fresh-context agent — catches regressions and correctness issues the authoring context reads past.
Check how much of a ticket is already implemented — split it into requirement blocks, judge each against the code, and save a human-readable TICKET-STATUS report in the planning dir.
Author or refine a skill for maximum token economy without losing intent. Use when creating any new skill or editing an existing `SKILL.md`.
Audit what auto-loads into an agent session's context window and suggest lean, reversible fixes to cut startup tokens.
| name | run-nx-checks |
| description | Run nx format, lint, test, and build on affected or specified projects, then fix unambiguous failures |
| context | fork |
| allowed-tools | Bash, Read, Edit, Write, Grep, Glob |
| license | MIT |
| metadata | {"author":"Francesco Borzì","version":"1.6"} |
Run format, lint, test, build. Fix unambiguous failures. Report anything judgment-laden.
$ARGUMENTS — optional, space-separated: [cpuCount] [projectName] [--remote-cache]. Number token
→ cpuCount. Non-number, non-flag token → projectName. --remote-cache flag → opt back into the
remote cache by dropping the remote-cache-off prefix. Default cpuCount = cores - 4 (min 1);
count cores with getconf _NPROCESSORS_ONLN (nproc is GNU-only).
Default project scope = affected. Default remote-cache state = off (see Steps).
Run nx commands from wherever nx.json lives in this repo (commonly the root; in some repos a
subdirectory).
Keep the Nx daemon warm so the project graph is reused across targets:
NX_DAEMON=true npx nx daemon --start >/dev/null 2>&1 || true
Do not rely on export for the remote-cache-off env vars (or any other nx env var) — each Bash
tool call is a fresh shell, so exports do not carry across calls. Always inline env vars on the
command line of each nx invocation (see Steps below).
Affected runs can balloon. Before steps 3–4, check scope with the graph-only
npx nx show projects --affected (fast, no build):
.env false positives. The sandbox denies reading **/.env; nx affected hashes
changed files, so an unreadable .env reads as changed and marks its project affected. Repos
with .env-bearing apps (e.g. apps/*-api) thus drag those into every affected run and build
them for nothing. Tell-tale: git status prints <path>/.env: Operation not permitted for
exactly those projects. Fix: rerun the nx commands with the sandbox disabled so .env reads
succeed, or --exclude those projects.Scope is mandatory — never narrow it yourself. With no $projectName argument, every target
runs at full scope — nx affected for lint/test/build, whole-changeset format:write. The
single-project forms in the steps below apply only when the user explicitly passed
$projectName. Never substitute nx run <proj>:<target>, nx <target> <changedLib>, or
file-scoped format --files for the affected sweep: that skips every other affected project —
exactly where a shared-lib change regresses (a dependent project whose tests import the changed
lib). And never add --skip-nx-cache (see below).
Always prefix each nx command with both remote-cache-off env vars inline. They're additive and the unrecognized one is a no-op, so this is safe regardless of which remote-cache backend (if any) the repo uses:
NX_POWERPACK_CACHE_MODE=no-cache — disables Nx Powerpack remote caches (@nx/azure-cache,
@nx/s3-cache, @nx/gcs-cache — all read the same env var via shared powerpack-utils).NX_NO_CLOUD=true — disables Nx Cloud's remote read-through cache.The invariant: remote cache always off (unless the user passed --remote-cache), local cache
always on. A remote read-through cache gains little locally, and its cloud SDKs' credential
probing can hang every nx call for seconds in a sandbox; a shell-side auth check (e.g.
az account show) doesn't predict the in-process credential chain — always disable, never
autodetect. Full rationale: remote-cache-rationale.md.
If the user explicitly passed --remote-cache, drop both prefixes.
Always keep the local cache on. The env vars above disable only the remote read-through cache;
the local Nx cache must stay enabled so unchanged targets are replayed instead of re-run. Do not
add --skip-nx-cache (nor NX_SKIP_NX_CACHE=true) to any command — it bypasses the local cache
too, making every run slower for no benefit. The only valid reason to pass --skip-nx-cache is a
specific, stated need to bypass the local cache — e.g. investigating a failure you suspect is caused
by a stale cache entry. In that case, scope it to the single command under investigation and say
why; never use it as the default.
Write both env vars literally at the start of each nx command, exactly as in the steps below.
Never stash the prefix in a shell variable (NX_OFF="…"; $NX_OFF npx nx … fails with "command not
found": expanded variables are not parsed as assignments).
NX_POWERPACK_CACHE_MODE=no-cache NX_NO_CLOUD=true npx nx affected -t lint --parallel=$cpuCount --fix
(or NX_POWERPACK_CACHE_MODE=no-cache NX_NO_CLOUD=true npx nx lint $projectName --fix).NX_POWERPACK_CACHE_MODE=no-cache NX_NO_CLOUD=true npx nx format:writeNX_POWERPACK_CACHE_MODE=no-cache NX_NO_CLOUD=true npx nx affected -t test --parallel=$cpuCount --maxWorkers=1
(or NX_POWERPACK_CACHE_MODE=no-cache NX_NO_CLOUD=true npx nx test $projectName).NX_POWERPACK_CACHE_MODE=no-cache NX_NO_CLOUD=true npx nx affected -t build --parallel=$cpuCount
(or NX_POWERPACK_CACHE_MODE=no-cache NX_NO_CLOUD=true npx nx build $projectName --parallel=$cpuCount).Apply the fix rule on any failure in steps 1–4.
--maxWorkers=1 on the test step--parallel caps concurrent projects; each test task still fans out to ~all cores internally, so
without this the cores oversubscribe (CPU pegs at 100%). --maxWorkers=1 pins each task to one
worker → --parallel=$cpuCount ≈ $cpuCount cores. Both Vitest and Jest accept the flag.
--maxWorkers to lint (ESLint) or build (esbuild) fails as an
unknown option.Same reason, --parallel is dropped from single-project lint and test (one task each — no
fan-out). It stays on single-project build, because build has dependsOn: ["^build"], so
building one project fans out across its whole dependency chain.
A failed test target may be flaky, not a real break. On a test failure, re-run that one target
once: NX_POWERPACK_CACHE_MODE=no-cache NX_NO_CLOUD=true npx nx test <project>. If it then
passes, or Nx prints NX detected a flaky task, it's flaky — don't try to "fix" it; record it as
a flaky project:target for the report. If it fails the same way again, treat it as real under
the Fix rule.
This skill runs in a forked context, so its final message is the only channel back to the caller.
End by listing, per target (lint / format / test / build): clean, skipped (with the reason — for
large fan-out, the project count and scope), or each failing project:target with its cause, plus
any flaky project:target. Never report a bare "checks passed" — an unlisted failure or skipped
target reads as green and the caller can't act on it.