Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nrwl/nx/llms.txt

Use this file to discover all available pages before exploring further.

AI coding assistants often hallucinate outdated Nx commands and lack context about your workspace structure. Without workspace awareness, they suggest commands that don’t exist or miss project relationships entirely. The Nx AI integration gives assistants accurate, real-time information about your workspace, projects, and available commands — making them smarter when working in an Nx monorepo and more autonomous when iterating on CI failures.

Configure Nx AI integration

Automatic setup

To automatically configure your Nx monorepo to work best with AI agents and assistants, run:
npx nx configure-ai-agents
This command prompts you to select which AI agents and assistants to configure, then sets up:
  • The Nx MCP server — gives your AI real-time access to workspace structure, project graph, and available tasks
  • Agent configuration filesAGENTS.md, CLAUDE.md, and similar files that prime the agent with workspace-specific guidance
  • Agent skills — for workspace exploration, code generation, and task execution
For Claude Code, skills are installed via a plugin. For other agents (Cursor, Copilot, etc.), they are copied directly into your workspace.
Alternatively, you can install just the skills without the Claude Code plugin:
npx skills add nrwl/nx-ai-agents-config
This copies the skills into your workspace but does not install the Claude Code plugin.

What the Nx MCP server provides

The Nx MCP server exposes structured, real-time workspace data to your AI agent. Instead of the agent grepping through files and guessing, it gets:

Workspace understanding

Graph-aware exploration of project dependencies and relationships. The agent gets structured data about every project, target, and how they connect.

Real-time terminal integration

The AI can read your terminal output, running processes, and error messages directly — no copy-pasting required.

Reliable code generation

The agent invokes Nx generators for predictable scaffolding, then adapts the result to your workspace. Faster, standardized, and fewer hallucinations.

Autonomous CI workflows

The CI monitor skill bridges your local agent with Nx Cloud. Push, monitor, get failures, fix, repeat — until CI is green. You review the final PR, not every intermediate fix.

Files Nx manages for AI agents

After running nx configure-ai-agents, Nx creates and manages several files that help AI agents understand your workspace:
A markdown file at the root of your workspace that describes the workspace structure, available commands, and conventions. AI agents that support AGENTS.md (such as Claude Code) automatically load this file at the start of each session.
my-workspace/
└── AGENTS.md    # Agent-readable workspace context
A Claude Code-specific configuration file that provides additional context and primes the agent with Nx-specific knowledge, including which commands to use and which to avoid.
For Cursor users, Nx writes rule files into .cursor/rules/ that configure how Cursor’s AI understands the workspace. These rules cover available generators, workspace conventions, and Nx-specific patterns.
my-workspace/
└── .cursor/
    └── rules/
        └── nx.mdc

AI-enhanced CI

Nx also integrates AI directly into your CI runs to automatically detect failed tasks, analyze errors, and propose fixes that can be reviewed and applied directly to your pull request. This is called Self-Healing CI: an AI agent on your CI pipeline detects failures, analyzes the root cause, proposes a fix, and verifies it — automatically.

Self-Healing CI

Learn how Nx Cloud’s AI agent automatically detects, analyzes, and fixes CI failures before you even see them.

Creating new workspaces with AI

When using AI assistants to create new Nx workspaces, use the CLI command:
npx create-nx-workspace@latest --template=nrwl/<name>-template
Available templates include react-template, angular-template, and typescript-template. For adding Nx to an existing project:
npx nx init

Learn more