> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nevermined.app/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Coding Skill

> Import Nevermined payment knowledge into your AI coding assistant and start building monetizable agents in minutes.

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.

## What's Included

The skill provides 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`)

## Install the Skill

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

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

    **Commands to install** from the Nevermined repository:

    ```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

    cp -R skills/nevermined-payments ~/.claude/skills/

    cd -
    rm -rf "$tmpdir"

    ```

    This downloads the `SKILL.md` and all reference files into your local Claude Code skills directory. Claude Code automatically loads the skill when it's relevant to your work.

    **Alternative — manual installation:**

    1. Clone or download the skill files:
       ```bash theme={null}
       git clone https://github.com/nevermined-io/docs.git /tmp/nvm-docs
       ```
    2. Copy to your personal skills directory:
       ```bash theme={null}
       cp -r /tmp/nvm-docs/skills/nevermined-payments ~/.claude/skills/
       ```
    3. Or copy to a project-specific location:
       ```bash theme={null}
       cp -r /tmp/nvm-docs/skills/nevermined-payments .claude/skills/
       ```

    Claude Code discovers skills automatically from `~/.claude/skills/` (personal) and `.claude/skills/` (project).
  </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 -o .cursor/rules/nevermined-payments.mdc \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.cursor/rules/nevermined-payments.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 -o .windsurf/rules/nevermined-payments.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.windsurf/rules/nevermined-payments.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 -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 -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/
    ```

    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 -o .clinerules/nevermined-payments.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.clinerules/nevermined-payments.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 -o .amazonq/rules/nevermined-payments.md \
      https://raw.githubusercontent.com/nevermined-io/docs/main/.amazonq/rules/nevermined-payments.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

| Tool               | Config File                                          | Auto-Activates                     |
| ------------------ | ---------------------------------------------------- | ---------------------------------- |
| **Claude Code**    | `~/.claude/skills/nevermined-payments/SKILL.md`      | Yes — when relevant                |
| **Cursor**         | `.cursor/rules/nevermined-payments.mdc`              | Yes — on `.ts`, `.js`, `.py` files |
| **Windsurf**       | `.windsurf/rules/nevermined-payments.md`             | Yes — model decides                |
| **GitHub Copilot** | `.github/copilot-instructions.md`                    | Yes — always                       |
| **Codex CLI**      | `AGENTS.md` or `.agents/skills/nevermined-payments/` | Yes — always or when relevant      |
| **Cline**          | `.clinerules/nevermined-payments.md`                 | Yes — on `.ts`, `.js`, `.py` files |
| **Amazon Q**       | `.amazonq/rules/nevermined-payments.md`              | Yes — always                       |

## 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://docs.nevermined.app/mcp"
    }
  }
}
```

This gives your assistant the ability to search the full Nevermined documentation on-demand. See [Build Using Nevermined MCP](/docs/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="/docs/integrate/quickstart/5-minute-setup">
    Register your first agent and plan
  </Card>

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

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

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