Skip to content

Commit b4aef4b

Browse files
authored
explain how to use llms.txt (#2845)
* screenshots * Update llms.md
1 parent f007fb0 commit b4aef4b

File tree

7 files changed

+63
-0
lines changed

7 files changed

+63
-0
lines changed

docs/ai/llms.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
![VS Code](/assets/docs/tools/llm-vscode1.png)
39+
40+
3. Get your AI-generated answer, along with direct reference links from the NEAR documentation site.
41+
42+
![VS Code](/assets/docs/tools/llm-vscode2.png)
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+
![VS Code](/assets/docs/tools/llm-cursor1.png)
55+
56+
2. You can now select `NEAR Protocol` as documentation reference when asking your questions.
57+
58+
![VS Code](/assets/docs/tools/llm-cursor2.png)
59+
60+
3. Get your AI-generated answer based on NEAR documentation.
61+
62+
![VS Code](/assets/docs/tools/llm-cursor3.png)

website/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ const sidebar = {
164164
items: [
165165
'ai/introduction',
166166
'ai/near-mcp',
167+
'ai/using-llms',
167168
{
168169
"Shade Agents": [
169170
{
257 KB
Loading
242 KB
Loading
577 KB
Loading
419 KB
Loading
398 KB
Loading

0 commit comments

Comments
 (0)