|
| 1 | +--- |
| 2 | +id: using-llms |
| 3 | +title: Using NEAR documentation with your AI Coding Agents |
| 4 | +sidebar_label: Docs with AI Coding Agents |
| 5 | +description: "Using llms.txt to improve your workflow when using AI coding agents." |
| 6 | +--- |
| 7 | + |
| 8 | +NEAR Docs hosts a [`llms.txt`](https://docs.near.org/llms.txt) file to provide information to help LLMs use the complete NEAR documentation at inference time. |
| 9 | + |
| 10 | +While websites serve both human readers and LLMs, LLMs benefit from concise information gathered in a single, accessible location. This is critical for use cases like development environments, where LLMs need quick access to programming documentation and APIs. |
| 11 | + |
| 12 | +:::info |
| 13 | + |
| 14 | +If you want to learn more about the `llms.txt` standard, check [this website](https://llmstxt.org/). |
| 15 | + |
| 16 | +::: |
| 17 | + |
| 18 | +## Using `llms.txt` |
| 19 | + |
| 20 | +The `llms.txt` core purpose is to provide context that the AI agent can reference before generating or modifying code. |
| 21 | + |
| 22 | +Using an `llms.txt` file as a reference for AI coding agents is an advanced technique to guide the AI's behavior, improve code quality, and enforce project-specific patterns. It's essentially a way to provide contextual, in-the-flow documentation. |
| 23 | + |
| 24 | +Next, you can find examples of how to integrate `llms.txt` with [Visual Studio Code](#visual-studio-code) and [Cursor](#cursor). |
| 25 | + |
| 26 | +## Visual Studio Code |
| 27 | + |
| 28 | +To use [NEAR Docs llms.txt](https://docs.near.org/llms.txt) as reference when working with Copilot Chat, follow these steps. |
| 29 | + |
| 30 | +1. Open the Copilot Chat sidebar on VS Code. |
| 31 | +2. Ask your question, and use the `#fetch` keyword to add `https://docs.near.org/llms.txt` as reference. |
| 32 | + For example: |
| 33 | + ``` |
| 34 | + How can I upgrade a contract state? |
| 35 | + #fetch https://docs.near.org/llms.txt |
| 36 | + ``` |
| 37 | + |
| 38 | +  |
| 39 | + |
| 40 | +3. Get your AI-generated answer, along with direct reference links from the NEAR documentation site. |
| 41 | + |
| 42 | +  |
| 43 | + |
| 44 | +## Cursor |
| 45 | + |
| 46 | +When using Cursor, you can add [NEAR Docs llms.txt](https://docs.near.org/llms.txt) as documentation reference following these steps, so it will be available when asking questions to the AI agent. |
| 47 | + |
| 48 | +1. Open Cursor Chat window. |
| 49 | +2. Click on `@`, select `Docs`, and `+ Add new doc`. On the text box, enter: |
| 50 | + ``` |
| 51 | + https://docs.near.org/llms.txt |
| 52 | + ``` |
| 53 | + |
| 54 | +  |
| 55 | + |
| 56 | +2. You can now select `NEAR Protocol` as documentation reference when asking your questions. |
| 57 | + |
| 58 | +  |
| 59 | + |
| 60 | +3. Get your AI-generated answer based on NEAR documentation. |
| 61 | + |
| 62 | +  |
0 commit comments