# Build with AI

AI agents may not have up-to-date knowledge about Mastra's APIs, patterns, and best practices. These resources give your AI tools direct access to current Mastra documentation, enabling them to generate accurate code and help you build faster.

## Mastra skills

Agent Skills are folders of instructions, scripts, and resources that agents can discover and use to do things more accurately and efficiently. [Mastra Skills](https://mastra.ai/docs/build-with-ai/skills) contain setup instructions, best practices, and instructions on how to fetch up-to-date information from Mastra's documentation.

**npm**:

```bash
npx skills add mastra-ai/skills
```

**pnpm**:

```bash
pnpm dlx skills add mastra-ai/skills
```

**Yarn**:

```bash
yarn dlx skills add mastra-ai/skills
```

**Bun**:

```bash
bun x skills add mastra-ai/skills
```

Read the dedicated [Mastra Skills](https://mastra.ai/docs/build-with-ai/skills) guide to learn more about installation options and available skills.

> **Tip:** If you're interested in giving your agent access to Mastra's documentation, we recommend using **Skills**. While the MCP Docs Server also provides this information, Skills will perform better. Use the MCP Docs Server when you need its tools, e.g. the migration tool.

## MCP docs server

In addition to documentation access, the [MCP Docs Server](https://mastra.ai/docs/build-with-ai/mcp-docs-server) also provides tools to help you migrate to newer versions of Mastra or follow the [Mastra 101 course](https://mastra.ai/course).

Learn how to use the [MCP Docs Server](https://mastra.ai/docs/build-with-ai/mcp-docs-server).

## Embedded package docs

Mastra packages ship with embedded documentation in `dist/docs`. When you install a Mastra package, your AI agent can read these files directly from `node_modules` to understand the package's APIs and patterns.

Each `dist/docs` includes:

- `SKILL.md`: A skill file following the skills standard
- `references/`: A folder with documentation files relevant to the package
- `assets/SOURCE_MAP.json`: A source map file linking public exports to their location in `node_modules`

## Context files

Mastra provides a root [`llms.txt`](https://mastra.ai/llms.txt) file that contains an overview of all available documentation pages.

Each documentation page also has its own `llms.txt` file. These files are streamlined markdown files. At the end of each docs page you'll find a link to the corresponding `llms.txt` file.

Add `/llms.txt` to any Mastra docs URL to access it. You can also request it by adding a `.md` extension to the end of the URL.

Examples for the [introduction page](https://mastra.ai/docs):

- [`/docs/llms.txt`](https://mastra.ai/docs/llms.txt)
- [`/docs.md`](https://mastra.ai/docs.md)

## Mastra's documentation

In addition to the [context files](#context-files) each documentation page also features a "Copy markdown" button at the top of the page. It'll copy the streamlined markdown version to your clipboard. Beside it, you'll find a dropdown menu to open the page on GitHub, in ChatGPT, Claude, and others.