Is there a way in Cursor AI that I can guide the AI to follow official documentation

Perhaps this is more of a question I should address on an AI forum and if so then I would welcome advice on where best to ask it.

In using cursor with Claude for iOS coding I have noticed that it seems to often do things that do not adhere to Apple Best practices. So I asked Claude about this and the reply was:

Always check official documentation (in this case, Apple’s SwiftUI documentation)

Is there a way in Cursor that I can guide Claude to check the official documentation?

Hey, you can add any documentation and reference it in your requests. Here’s more information about this feature:

1 Like

Thank you very much for your advice. Another quick question. When I add something like this add a document it says: Cursor will then index and learn the doc, and you will be able to use it as context like any other doc.

So does that mean if I enter a top level URL, that Cursor will go through every page and learn from all it can find. I would like to add in the latest Apple documentation for example. There’s a lot there for Cursor to scan.

Also once it has scanned it, then how does it know to use the facts it learned. I thought it was just the AI that had to know the information. Sorry but I don’t understand the difference between what Cursor knows and what it learns from the models.

Hope you or someone can advise me.

Thanks

You talk to the model, Cursor just adds context (more text) to your chat. It’s like chatgpt with dropping some code in.

It does not “know” anything, there is just more context for next word prediction from the LLM.

If you accept code changes, Cursors own models apply the diffs. Autocomplete is also a Cursor model.

1 Like

Great question!

You are correct that, when you index a document, as long as you set the entrypoint and prefix correctly, the scraper will find all the pages in the documentation and scrape a copy of them all!

You don’t have to worry about filesize, as we only cache each website once across all our users, which means most documentation you want to add may have already been scraped, and will likely always be up to date as other users use it too!

When you @ the doc in your chat or composer sessions, and send off the prompt, we first look at what you are asking and use that to semantically search the documentation for the most relevant sections for what you are trying to do. These sections are then returned to the AI to use in its response.

1 Like

Thanks for your advice. I used @doc, created a document linked to:

https://developer.apple.com/documentation/swift/

Based on what you said, as that’s a very common link, will that have been something you already cached?

What confuses me is your statement “we first look at what you are asking and use that to semantically search the documentation for the most relevant sections for what you are trying to do. These sections are then returned to the AI to use in its response.”

So you mean something in your Cursor server application looks through the document, and then sends that to the AI.

Sorry if my question is confusing, do you have any Cursor document that I could read to get a better idea of how the internals work.

Thanks

Kind of, yes. We can’t send the whole documentation to the AI, so we use a process where we look at what you are asking, then get the most relevant sections of the documentation and send that to the AI.

Basically, Cursor picks the most useful sections of documentation to send to the AI, are we can’t send everything!

1 Like