Skip to main content

Ci Optimization

Find what makes a workspace's Nx Cloud CI slow, flaky or expensive, from recorded CI data. Use this skill when a user asks for the flakiest or most costly flaky tasks, tasks to atomize or shard, targets with a low cache hit rate or inputs that are too broad, idle or oversized workers, or how CI compute and credits are trending, including as a recurring or scheduled check. Requires the nx-cloud-api skill for API access.

v1.0.0New

Install this skill

No account required. Pick your tool, or use the command that detects it for you.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install nx-monorepo-ci-optimization
Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/nx-monorepo-ci-optimization/SKILL.md

Setup guide →

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
Key
skills-hub-ed25519-2026-11
Signed
0Save

Instructions

CI optimization

How to find CI improvements in recorded Nx Cloud data. Each reference covers
one kind of finding: where its data is, how to rank it, and what to suggest.

FindingReference
Flaky tasksreferences/flaky-tasks.md
Tasks to atomize or shardreferences/sharding.md
Cache misses and broad inputsreferences/cache-misses.md
Worker utilization, compute, creditsreferences/compute.md

Where the data is

Use the Nx Cloud CLI where it has a command, and npx nx-cloud api (the
nx-cloud-api skill: authentication, pagination, errors, counting rules) for
the rest. The CLI commands need NX_CLOUD_EXPERIMENTAL_CLI=true; read their
--help for flags and JSON shapes.

DataSource
Pipelines in a windownpx nx-cloud pipeline list --since 7d --branch <b> --status FAILED
One pipeline's tasks, retries, cache statenpx nx-cloud pipeline task list <pipeline> --retried --attempts (1)
Failed task logs, earlier attemptsnpx nx-cloud pipeline logs, npx nx-cloud pipeline task logs --attempt
Organization usage (credits or dollars)npx nx-cloud org usage --daily (organization admins only)
Daily flakiness per taskAPI flaky-tasks, then flaky-tasks/{metricId}/executions
Daily runs, hit rate, p50/p95 per targetAPI task-stats
Runs with retried tasks across pipelinesAPI runs with hasRetriedTasks=true
CI compute, utilization and creditsAPI cipe-stats, each CIPE's compute, run-group workers

(1) It makes one request per run of the pipeline, reads at most 500 tasks per
run (truncated: true when a run has more), and has no hash or cacheable.
For large pipelines, or those fields, read the runs' tasks with the API:
batch/v0/run-tasks for up to 25 runs in one request.

Names differ between sources: the task ID is taskId in the CLI and id in
the API, and the project filter is project on flaky-tasks but
projectName on task-stats. Check each with --describe or --help.

The API has no record of a task's resolved inputs, its configuration or the
reason for a miss. For those, read the workspace in a checkout of the analyzed
branch: nx show project <name> --json gives resolved targets and inputs,
including inferred ones, but needs installed dependencies and computes the
project graph, which in a Gradle or Maven workspace starts the build tool.
Without it, read nx.json (targetDefaults, namedInputs, plugins),
project.json and package.json; inferred targets such as e2e-ci--* are not
in those files. Say which statements come from recorded data and which from the
checkout.

Things that skew every finding

  • Aggregate rows before ranking. task-stats and flaky-tasks have one
    row per task per UTC day. Sum the days, weighting rates by their counts.
  • Group sharded and atomized siblings. test-ci-group-1..12 or
    e2e-ci--<file> targets are one target; group them by name pattern, or one
    problem fills the whole list. targetGroupName is the target's group label
    in the project (such as E2E (CI) or a Gradle task group), not a sign that
    a target was split.
  • Rank by time, not by rate. A 2% flake on a 20-minute task that runs 500
    times a week costs more than a 40% flake on a lint that runs twice.
  • Big windows are many pages. A large, atomized workspace has thousands
    of task-stats rows a day, so a week can be tens of pages. One way: read one
    full recent day, rank projects by miss time, then read the week for the top
    projects with projectName. Say what the data leaves out.
  • Today is not over. Daily rows for the current UTC day still change.
  • Compare like with like. Measure two windows the same way. task-stats
    and flaky-tasks have no branch filter, and mix the default branch, PRs and
    scheduled jobs (a nightly matrix can dominate some targets). To separate
    them, sample pipelines with pipeline list --branch or cipe-stats with
    branch.
  • Leave out tasks whose duration isn't work. Non-cacheable tasks,
    continuous tasks, and servers that other tasks wait for (a local registry
    or dev server with a ready signal) run as long as their consumers and
    always miss.

Following up

nx-cloud-cache-investigator explains one cache miss in depth, and
nx-cloud-ci-failure-review one failed pipeline. A finding is a hypothesis
until a change is measured in CI; link the recorded data that supports it.

This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →
monitor-ciMonitor Nx Cloud CI pipeline and handle self-healing fixes. USE WHEN user says "monitor ci", "watch ci", "ci monitor", "watch ci for this branch", "track ci", "check ci status", wants to track CI status, or needs help with self-healing CI fixes. Prefer this skill over native CI provider tools (gh, glab, etc.) for CI monitoring — it integrates with Nx Cloud self-healing which those tools cannot access.0 installsnx-cloud-apiQuery the read-only Nx Cloud Public API for workspace data with `npx nx-cloud api`. Use this skill when a user asks to inspect or retrieve CIPEs, pipelines, run groups, runs, tasks, workflows, agents, task statistics, flaky tasks, cache data, CI compute or credit estimates, or API endpoint details. Use this skill before any Nx Cloud API call. It covers endpoint discovery, link navigation, pagination, asset downloads, and error recovery. Do not use it for live CI monitoring.0 installspolygraphGuidance for coordinating changes across multiple repositories using Polygraph. When the request implies that some information from another repo has to be read, another repo has to be updated, or the user asks about what other repos are doing with shared code/APIs/endpoints, use this skill.0 installsnx-cloud-apiQuery the read-only Nx Cloud Public API for workspace data with `npx nx-cloud api`. Use this skill when a user asks to inspect or retrieve CIPEs, pipelines, run groups, runs, tasks, workflows, agents, task statistics, flaky tasks, cache data, or API endpoint details. Use this skill before any Nx Cloud API call. It covers endpoint discovery, link navigation, pagination, asset downloads, and error recovery. Do not use it for live CI monitoring.0 installsget-latest-ciFetch the latest CI pipeline execution for the current branch. Returns the most recent CIPE which may be completed, in progress, or null. Use when you need to review CI status, check failures, or inspect CI state.0 installsawait-polygraph-ciWait for CI to settle across all repos in a Polygraph session, then report results and investigate failures. USE WHEN user says "await polygraph", "wait for polygraph ci", "polygraph ci status", "check polygraph ci", "watch polygraph session", "monitor polygraph".0 installs

More from Nx AI Agents Config

View source →
nx-run-tasksHelps 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.2 installsnx-pluginsFind and add Nx plugins. USE WHEN user wants to discover available plugins, install a new plugin, or add support for a specific framework or technology to the workspace.1 installsnx-importImport, merge, or combine repositories into an Nx workspace using nx import. USE WHEN the user asks to adopt Nx across repos, move projects into a monorepo, or bring code/history from another repository.1 installsnx-workspaceExplore and understand Nx workspaces. USE WHEN answering questions about the workspace, projects, or tasks. ALSO USE WHEN an nx command fails or you need to check available targets/configuration before running a task. EXAMPLES: 'What projects are in this workspace?', 'How is project X configured?', 'What depends on library Y?', 'What targets can I run?', 'Cannot find configuration for task', 'debug nx task failure'.1 installsnx-generateGenerate code using nx generators. INVOKE IMMEDIATELY when user mentions scaffolding, setup, structure, creating apps/libs, or setting up project structure. Trigger words - scaffold, setup, create a new app, create a new lib, project structure, generate, add a new project. ALWAYS use this BEFORE calling nx_docs or exploring - this skill handles discovery internally.1 installslink-workspace-packagesLink workspace packages in monorepos (npm, yarn, pnpm, bun). USE WHEN: (1) you just created or generated new packages and need to wire up their dependencies, (2) user imports from a sibling package and needs to add it as a dependency, (3) you get resolution errors for workspace packages (@org/*) like "cannot find module", "failed to resolve import", "TS2307", or "cannot resolve". DO NOT patch around with tsconfig paths or manual package.json edits - use the package manager's workspace commands to fix actual linking.1 installs

More Build skills

Browse category →
senior-frontendBuild and review React, Next.js, TypeScript or Tailwind frontends: components, scaffolding, performance and bundle size. Use whenever the user wants a new component or app, a page feels slow, the bundle is too big, or asks for a frontend code review.647 installsui-design-systemUse when building a design system: tokens, component docs, responsive scales or developer handoff. Generates tokens with design_token_generator.py.549 installsfrontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.357 installssenior-backendBuild and fix backend services: REST or GraphQL APIs, auth, microservices, PostgreSQL queries, migrations and load tests. Use whenever the user's API is slow or broken, needs login or auth added, a schema change, or a new endpoint or service scaffolded.258 installsself-improving-agentCurate what the agent has learned into durable project knowledge. Reviews Claude Code auto-memory (MEMORY.md and its topic files) for learnings worth keeping, promotes proven ones into CLAUDE.md or .claude/rules/, records a correction as a lesson that persists across sessions, prunes stale or duplicate entries, and turns a recurring fix into a reusable skill. Use whenever the user asks what you have learned or saved about the project, which memories should become permanent rules, to remember a lesson or stop repeating a mistake, or to clean up, audit or check memory health.183 installsusing-superpowersUse when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions147 installs

Frequently asked questions about ci-optimization

What does the ci-optimization skill do?

Find what makes a workspace's Nx Cloud CI slow, flaky or expensive, from recorded CI data. Use this skill when a user asks for the flakiest or most costly flaky tasks, tasks to atomize or shard, targets with a low cache hit rate or inputs that are too broad, idle or oversized workers, or how CI compute and credits are trending, including as a recurring or scheduled check. Requires the nx-cloud-api skill for API access. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the ci-optimization skill?

Run `npx @skills-hub-ai/cli install nx-monorepo-ci-optimization` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/nx-monorepo-ci-optimization/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does ci-optimization work with?

ci-optimization runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the ci-optimization skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use ci-optimization after installing it?

In Claude Code, type `/nx-monorepo-ci-optimization` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the ci-optimization skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.