How to Add Library Docs as Context with @Docs in Cursor
Index a library's documentation in Cursor so the agent answers with current, accurate API details.
Models can be out of date on fast-moving libraries. Cursor's @Docs feature fixes this by crawling and indexing a documentation site, then letting you pull that index into any prompt. The agent then quotes the real docs instead of relying on stale training data. This guide indexes a docs site and uses it in a question.
- Cursor installed
- The URL of the documentation site you want to index
- A question about that library you want answered accurately
Open the docs manager
In a chat or Composer prompt, type @Docs and choose Add new doc. Cursor opens a small dialog where you paste the base URL of the docs you want it to crawl.
Let it finish indexing
Indexing runs in the background. Larger docs sites take a few minutes. Once the status shows complete, the doc set is available to every chat and Composer prompt in Cursor, not just the current one.
Reference the docs in a prompt
Type @Docs again and pick the set you indexed. Then ask your question. The agent searches the indexed pages and grounds its answer in them, often citing the specific section.
@Docs Example SDK
What is the correct way to paginate the listItems endpoint?
Show the exact parameter names from the current docs.Keep the index fresh
When a library publishes a new version, re-index its docs from the same manager so the agent picks up the changes. Old entries can be removed if you no longer use that library.
Result: the agent answers questions about a third-party library using its real, current documentation, which sharply reduces invented method names and outdated patterns.
Watch related tutorials
33:42
41:18
28:05
3:12
26:54
39:10