> ## Documentation Index
> Fetch the complete documentation index at: https://neverminedag-docs-payments-v1-11-0.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Coding Skill

> Import Nevermined payment and Router knowledge into your AI coding assistant — build agents that charge, and agents that buy.

Use the **Nevermined AI Skill** to give your coding assistant deep knowledge of the Nevermined Payments SDK, the x402 payment protocol, and integration patterns for Express.js, FastAPI, Strands agents, MCP servers, and Google A2A.

Instead of copy-pasting docs, you import the skill once and your AI assistant knows how to wire up payments for you.

## Two skills, opposite directions

There are two, and which one you want depends on which side of the payment you're on.

| Skill                     | Your agent is…                                   | Covers                                                                                                                                                                                                               |
| ------------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`nevermined-payments`** | **receiving** money, or buying a Nevermined plan | SDK integration, middleware, plans, credits — the rest of this page                                                                                                                                                  |
| **`nevermined-router`**   | **spending** money at external services          | Discovering services in the catalog, creating a spending Delegation, paying any x402 or MPP endpoint through the [Nevermined Router](/products/router/overview), and the guardrails an autonomous buyer must respect |

Installing both is fine — they don't overlap. Every supported tool can now reach the Router:

* **Claude Code** — install them as plugins, one command each. See the tab below.
* **Cursor, Windsurf, Cline, Amazon Q** — swap `nevermined-payments` for `nevermined-router` in the paths below, or run the extra command shown in each tab.
* **Codex CLI and GitHub Copilot** — `AGENTS.md` and `.github/copilot-instructions.md` are *single* files with no skill name to swap, so each one carries **both** halves: the payments guidance and a condensed Router section. Take the whole file. Codex can also install `nevermined-router` as a proper skill directory under `.agents/skills/` — see its tab.

## What's Included

The skills provide your coding assistant with:

* **SDK initialization** patterns for TypeScript and Python
* **Framework-specific middleware** (Express.js, FastAPI, Strands, MCP, Google A2A)
* **x402 protocol** flow — headers, verification, settlement
* **Payment plan** registration and configuration
* **Client-side** integration — ordering plans, generating tokens, calling protected APIs
* **Troubleshooting** for common errors (402, `-32003`, `-32002`)

And, from the Router skill:

* **Service discovery** in the public Agent Services Catalog
* **Spending Delegations** — creating a capped budget and funding the buyer wallet
* **Paid calls** over x402 and MPP through one endpoint, with the protocol auto-detected
* **Guardrails** — every `BCK.ROUTER.*` code, what's retryable, and why a refusal must not be worked around

## Install the Skill

Choose your AI coding tool below for step-by-step installation instructions.

<Tabs>
  <Tab title="Claude Code">
    ### Claude Code

    Install from the Nevermined plugin marketplace — two commands, and Claude Code keeps the skills up to date for you:

    ```text theme={null}
    /plugin marketplace add nevermined-io/docs

    /plugin install nevermined-payments@nevermined    # charging for your agent
    /plugin install nevermined-router@nevermined      # buying from external services
    ```

    Those are Claude Code commands — type them in Claude Code, not in a shell.

    Install either or both. The marketplace is named `nevermined` (that's the `@nevermined` suffix); `nevermined-io/docs` is just the repository it's served from.

    Claude Code loads each skill when it's relevant to your work, and refreshes it in the background when we publish changes. To update by hand it takes two steps — `/plugin marketplace update nevermined` refreshes the catalogue, then `/plugin update nevermined-router@nevermined` updates the installed plugin itself (restart to apply).

    **Alternative — copy the files directly.** Use this if you'd rather take a snapshot you control, or you're on a Claude Code build without plugin support:

    ```bash theme={null}
    mkdir -p ~/.claude/skills

    tmpdir="$(mktemp -d)"
    git clone --depth 1 --filter=blob:none --sparse https://github.com/nevermined-io/docs "$tmpdir"
    cd "$tmpdir"
    git sparse-checkout set skills/nevermined-payments skills/nevermined-router

    cp -R skills/nevermined-payments ~/.claude/skills/
    cp -R skills/nevermined-router ~/.claude/skills/    # buying through the Router

    cd -
    rm -rf "$tmpdir"
    ```

    Claude Code discovers skills automatically from `~/.claude/skills/` (personal) and `.claude/skills/` (project). Copied this way they're a snapshot — you re-run the command to update.
  </Tab>

  <Tab title="ClawHub">
    ### ClawHub

    Both skills are published to the [ClawHub](https://clawhub.ai) registry under the `nevermined-io` publisher, so any tool that reads a `skills/` directory can pull them with one command:

    ```bash theme={null}
    npx clawhub install nevermined            # the payments skill
    npx clawhub install nevermined-router     # buying through the Router
    ```

    This writes to `skills/<slug>/` in the current directory. `--dir` sets a different target — it's a global flag, so it goes **before** the subcommand:

    ```bash theme={null}
    npx clawhub --dir ~/.claude/skills install nevermined-router
    ```

    You don't need an account to install. `npx clawhub update --all` pulls the latest published versions (the bare `update` errors — it wants a slug or `--all`), and `npx clawhub inspect nevermined-router` shows what you'd get without installing it.

    The install lock is per working directory, so if you installed with `--dir`, run the update from that same directory with the same flag: `npx clawhub --dir ~/.claude/skills update --all`.

    <Note>
      Two ClawHub surprises worth knowing. The payments skill is published under the slug **`nevermined`**, not `nevermined-payments` (the Router skill's slug matches its name). And the version `clawhub inspect` reports for the payments skill won't match the `Skill version` in its own `SKILL.md` header — the registry assigns its own numbering. Trust the registry's version for "is my copy current", and the file's for what changed.
    </Note>
  </Tab>

  <Tab title="Cursor">
    ### Cursor

    **Option A — Remote rule import (recommended):**

    1. Open **Cursor Settings** (gear icon)
    2. Navigate to **Rules** section
    3. Click **Add Remote Rule**
    4. Paste the GitHub repository URL: `https://github.com/nevermined-io/docs`
    5. Cursor syncs the rules automatically

    **Option B — Copy rule files to your project:**

    Download the rule file and add it to your project:

    ```bash theme={null}
    mkdir -p .cursor/rules
    curl --fail -o .cursor/rules/nevermined-payments.mdc \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.cursor/rules/nevermined-payments.mdc

    # Buying from external x402 / MPP services through the Router
    curl --fail -o .cursor/rules/nevermined-router.mdc \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.cursor/rules/nevermined-router.mdc
    ```

    The `.cursor/rules/*.mdc` format supports glob-based activation — the Nevermined rule auto-activates when you work with `.ts`, `.js`, or `.py` files.
  </Tab>

  <Tab title="Windsurf">
    ### Windsurf (Codeium)

    Copy the rule file to your project's Windsurf rules directory:

    ```bash theme={null}
    mkdir -p .windsurf/rules
    curl --fail -o .windsurf/rules/nevermined-payments.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.windsurf/rules/nevermined-payments.md

    # Buying from external x402 / MPP services through the Router
    curl --fail -o .windsurf/rules/nevermined-router.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.windsurf/rules/nevermined-router.md
    ```

    Windsurf automatically discovers rules from `.windsurf/rules/` and applies them based on their activation mode.

    <Note>
      Windsurf rules have a 6,000-character limit per file. The Nevermined rule file stays within this limit with the most essential patterns. For the full reference, point your assistant to the `SKILL.md`.
    </Note>
  </Tab>

  <Tab title="GitHub Copilot">
    ### GitHub Copilot

    **Repository-wide instructions:**

    Add the instructions file to your project:

    ```bash theme={null}
    mkdir -p .github
    curl --fail -o .github/copilot-instructions.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.github/copilot-instructions.md
    ```

    Copilot reads `.github/copilot-instructions.md` automatically for every request within the repository.

    **Path-specific instructions (optional):**

    For more targeted activation, create a file at `.github/instructions/nevermined.instructions.md`:

    ```markdown theme={null}
    ---
    applyTo: "**/*.ts,**/*.tsx,**/*.js,**/*.py"
    ---

    When working with Nevermined payments, use the patterns from .github/copilot-instructions.md
    ```
  </Tab>

  <Tab title="Codex CLI">
    ### OpenAI Codex CLI

    Codex CLI reads `AGENTS.md` files for project context. Add it to your project:

    ```bash theme={null}
    curl --fail -o AGENTS.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/AGENTS.md
    ```

    Codex CLI discovers `AGENTS.md` automatically by scanning from the current directory up to the repository root.

    **Alternative — install as a Codex skill:**

    ```bash theme={null}
    mkdir -p .agents/skills
    cp -r skills/nevermined-payments .agents/skills/
    cp -r skills/nevermined-router .agents/skills/    # buying through the Router
    ```

    Codex CLI detects skills from `.agents/skills/` and loads them when relevant.
  </Tab>

  <Tab title="Cline">
    ### Cline (VS Code)

    Copy the rule file to your project:

    ```bash theme={null}
    mkdir -p .clinerules
    curl --fail -o .clinerules/nevermined-payments.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.clinerules/nevermined-payments.md

    # Buying from external x402 / MPP services through the Router
    curl --fail -o .clinerules/nevermined-router.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.clinerules/nevermined-router.md
    ```

    Cline discovers all `.md` files in the `.clinerules/` directory and applies them based on the `paths` frontmatter. The Nevermined rule activates for `.ts`, `.js`, and `.py` files.

    You can also create rules through the Cline UI: click the **+** button in the Rules popover below the chat input.
  </Tab>

  <Tab title="Amazon Q">
    ### Amazon Q Developer

    Copy the rule file to your project:

    ```bash theme={null}
    mkdir -p .amazonq/rules
    curl --fail -o .amazonq/rules/nevermined-payments.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.amazonq/rules/nevermined-payments.md

    # Buying from external x402 / MPP services through the Router
    curl --fail -o .amazonq/rules/nevermined-router.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.amazonq/rules/nevermined-router.md
    ```

    Amazon Q automatically uses rules from `.amazonq/rules/` as context. You can toggle rules on/off via the Rules button in the Amazon Q chat panel.
  </Tab>

  <Tab title="Other / Manual">
    ### ChatGPT, Claude.ai, or any other assistant

    Share the skill content directly with your assistant:

    1. Open the [`SKILL.md` file](https://github.com/nevermined-io/docs/blob/main/skills/nevermined-payments/SKILL.md)
    2. Copy the contents
    3. Paste into your assistant's context, knowledge base, or system prompt

    For a more concise version, use the [`AGENTS.md` file](https://github.com/nevermined-io/docs/blob/main/AGENTS.md) instead.
  </Tab>
</Tabs>

## Supported Tools at a Glance

`<skill>` is `nevermined-payments` or `nevermined-router` — install either or both.

| Tool               | Config File                                    | Router available?                                             | Auto-Activates                     |
| ------------------ | ---------------------------------------------- | ------------------------------------------------------------- | ---------------------------------- |
| **Claude Code**    | plugin, or `~/.claude/skills/<skill>/SKILL.md` | Yes                                                           | Yes — when relevant                |
| **Cursor**         | `.cursor/rules/<skill>.mdc`                    | Yes                                                           | Yes — on `.ts`, `.js`, `.py` files |
| **Windsurf**       | `.windsurf/rules/<skill>.md`                   | Yes                                                           | Yes — model decides                |
| **GitHub Copilot** | `.github/copilot-instructions.md`              | Yes — condensed, in the same single file                      | Yes — always                       |
| **Codex CLI**      | `AGENTS.md` or `.agents/skills/<skill>/`       | Yes — condensed in `AGENTS.md`, in full via `.agents/skills/` | Yes — always or when relevant      |
| **Cline**          | `.clinerules/<skill>.md`                       | Yes                                                           | Yes — on `.ts`, `.js`, `.py` files |
| **Amazon Q**       | `.amazonq/rules/<skill>.md`                    | Yes                                                           | Yes — always                       |
| **Any** (ClawHub)  | `skills/<slug>/SKILL.md`                       | Yes                                                           | Depends on the tool                |

<Note>
  The Copilot and Codex files are **condensed** — they carry the buy loop, the money traps and every `BCK.ROUTER.*` retry decision, but not the full reference set: they omit `0004`/`0005`, everything the Router refuses outright (MPP splits, internal targets, redirects, forged `X-Router-*`), and the relay limits. For the complete Router skill, install it as a directory (Claude Code plugin, ClawHub, or `.agents/skills/`).
</Note>

## Example Prompts

After installing the skill, try prompts like:

<CardGroup cols={2}>
  <Card title="Add payments to Express.js" icon="node-js">
    "Add Nevermined x402 payment protection to my Express.js API. I want to charge 1 credit per request on the `/ask` endpoint."
  </Card>

  <Card title="Protect a FastAPI endpoint" icon="python">
    "Integrate Nevermined payments into my FastAPI app. Use dynamic credits based on the token count in the response."
  </Card>

  <Card title="Build a paid MCP server" icon="laptop">
    "Create an MCP server with Nevermined payments. Register a weather tool that costs 5 credits per call."
  </Card>

  <Card title="Add payments to a Strands agent" icon="robot">
    "Protect my Strands agent tool with the @requires\_payment decorator. Charge 2 credits per call."
  </Card>
</CardGroup>

## Alternative: Use the MCP Search Server

If you prefer real-time documentation search over a static skill, you can connect your coding assistant to the Nevermined MCP documentation server:

```json theme={null}
{
  "mcpServers": {
    "nevermined-docs": {
      "url": "https://nevermined.ai/docs/mcp"
    }
  }
}
```

This gives your assistant the ability to search the full Nevermined documentation on-demand. See [Build Using Nevermined MCP](/development-guide/build-using-nvm-mcp) for details.

## Skill vs. MCP Server

| Approach                | Best For                                   | Tradeoff                           |
| ----------------------- | ------------------------------------------ | ---------------------------------- |
| **AI Skill** (SKILL.md) | Fast, offline-capable, consistent patterns | Static — update when SDK changes   |
| **MCP Search Server**   | Always up-to-date, full doc coverage       | Requires network, slower per-query |

For the best experience, use both: install the skill for core patterns and connect the MCP server for edge cases.

## What's Next?

<CardGroup cols={2}>
  <Card title="5-Minute Setup" icon="rocket" href="/integrate/quickstart/5-minute-setup">
    Register your first agent and plan
  </Card>

  <Card title="Express.js Integration" icon="node-js" href="/integrate/add-to-your-agent/express">
    Full Express.js payment middleware guide
  </Card>

  <Card title="FastAPI Integration" icon="python" href="/integrate/add-to-your-agent/fastapi">
    Full FastAPI payment middleware guide
  </Card>

  <Card title="MCP Integration" icon="laptop" href="/integrations/mcp">
    Build monetizable MCP servers
  </Card>
</CardGroup>
