# Using with an AI

> Give the whole documentation to Claude, ChatGPT, Cursor or Copilot so they write correct code.

An AI does not know this module, or knows an old version: it will invent functions or fall back to `discord.ui.View`. The fix: give it the full documentation, prepared for it.

## Files for AI

| File | Content | Size | When to use it |
| --- | --- | --- | --- |
| [`/llms-small.txt`](https://discordpy.levraiberet.ovh/llms-small.txt) | The rules, a minimal bot and every function signature | ~13,000 tokens | **The default choice**: fits any AI, even free plans |
| [`/llms-full.txt`](https://discordpy.levraiberet.ovh/llms-full.txt) | Every guide, the whole reference and every example | ~54,000 tokens | Claude, paid ChatGPT, Gemini: the most complete |
| [`/llms-full-fr.txt`](https://discordpy.levraiberet.ovh/llms-full-fr.txt) | The same in French | ~55,000 tokens | If you want answers using the French terms |
| [`/llms.txt`](https://discordpy.levraiberet.ovh/llms.txt) | The rules and a link to every page | ~6,000 tokens | The AI browses the web and opens only what it needs |
| [`/AGENTS.md`](https://discordpy.levraiberet.ovh/AGENTS.md) | The rules, ready to drop into a project | ~1,000 tokens | Claude Code, Cursor, Copilot, Codex (see below) |
| [`/reference.json`](https://discordpy.levraiberet.ovh/reference.json) | The whole API as JSON: signature, summary, example, URLs | | Tools and scripts |

Every page of these docs also exists as Markdown: add `index.md` to its URL (for example [`…/api/create_button/index.md`](https://discordpy.levraiberet.ovh/docs/en/0.3.0/api/create_button/index.md)). It is the version an AI reads best, without menus or layout.

All these files are regenerated with every release of the docs: they always describe the latest version of the module.

## With Claude or ChatGPT (in the browser)

Download `llms-small.txt` (or `llms-full.txt` for Claude), attach it to your conversation, then ask what you need:

```text
Here is the documentation of the discord-interactions-py module (attached).
Only use this module for components, not discord.ui.

Write a /poll command with two Yes / No buttons
that count votes and update the message.
```

If the AI can browse the web, the address is enough: `Read https://discordpy.levraiberet.ovh/llms-small.txt before answering.`

## With Claude Code, Cursor or Copilot (in your project)

Add an instructions file at the root of your project, which the tool reads automatically:

| Tool | File |
| --- | --- |
| Claude Code | `CLAUDE.md` |
| Cursor | `.cursor/rules/discord.mdc` |
| GitHub Copilot | `.github/copilot-instructions.md` |
| Codex, Windsurf, others | `AGENTS.md` |

The [`AGENTS.md`](https://discordpy.levraiberet.ovh/AGENTS.md) file is ready: the ten rules of the module, a minimal bot and the docs address to read before writing code. Download it under the name your tool expects:

```bash
curl -o AGENTS.md https://discordpy.levraiberet.ovh/AGENTS.md
```

If the instructions file already exists, append to it instead of overwriting it:

```bash
curl https://discordpy.levraiberet.ovh/AGENTS.md >> CLAUDE.md
```

In Cursor you can also add the docs as a source: **Settings > Features > Docs > Add new doc**, with the address `https://discordpy.levraiberet.ovh/llms-full.txt`. Give it a name, then type `@` followed by that name in the chat to load it.

## Why it works better

Every file starts with ten rules written for an AI: import name, single router, 3-second deadline, a single response, Discord limits, no `discord.ui`. These are exactly the mistakes an AI makes without them. Then come the exact signatures of every function and, in the full version, the guides and one example per function. The AI has nothing left to guess.

> **Tip:**
> If the AI's code fails, paste the full console message (with the Discord error code, such as `50035`): the [Common errors](https://discordpy.levraiberet.ovh/docs/en/0.3.0/guides/erreurs/index.md) page is part of the file, so it can find the cause.
