# Cursor prompt engineering best practices

**URL:** <https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592>\
**Category:** Discussions\
**Created:** [November 12, 2023, 4:23pm UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592 "2023-11-12T16:23:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![raw.works](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/raw.works/32/500_2.png) [@raw.works](https://forum.cursor.com/u/raw.works)\
**Post date:** [November 12, 2023, 4:23pm UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/1 "2023-11-12T16:23:25Z")

</div>

most of the time cursor does a pretty good job of understanding the context and content of the different embedded references, at least with gpt-4. the purpose of this post is to unearth best practices for prompt engineering that are specific to cursor.

for example, let’s say that i have documentation, a style guide, and an example. what are the best practices for labeling those `@` differently so that the llm understands the appropriate context? i’ve been doing something like this:

> using the style guide @style-guide, and following the example @example, write a @Hugo layout template that does …

any thoughts on this approach? (as additional nuance, this might return very different results with or without the “full codebase context” (cmd + return))

any cursor-specific prompting tricks that others are willing to share?

([now is the time for the grimoires](https://www.oneusefulthing.org/p/now-is-the-time-for-grimoires))

---

<div class="post-metadata">

**Author:** ![nishant](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/nishant/32/712_2.png) [@nishant](https://forum.cursor.com/u/nishant)\
**Post date:** [November 13, 2023, 6:55am UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/2 "2023-11-13T06:55:28Z")

</div>

This is not a prompt guide as such, but I wanted to understand the changes that are being done to a particular Object so I saved the log of it and passed it as file and asked gpt-4 to give me the dummy value of this object considering this as the starting point. This helped me better understand the code

---

<div class="post-metadata">

**Author:** ![g4d](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/g4d/32/11527_2.png) [@g4d](https://forum.cursor.com/u/g4d)\
**Post date:** [November 17, 2024, 11:56pm UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/3 "2024-11-17T23:56:22Z")

</div>

@raw.works After a year now, I’m wondering what you’ve learned, if anything, to improve your prompting.

---

<div class="post-metadata">

**Author:** ![raw.works](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/raw.works/32/500_2.png) [@raw.works](https://forum.cursor.com/u/raw.works)\
**Post date:** [November 21, 2024, 8:48pm UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/4 "2024-11-21T20:48:42Z")

</div>

success with cursor is all about context management.

“@codebase” is pretty risky. your basically admitting that you have no idea what is important for the AI to pay attention to, so you’re rolling the dice that the cursor reranker is going to get it right for you. this could be ok if know what to search for, like the name of a function, but i try not to use @codebase without also adding some specific files .

so if you can do things like “this is the backend @/backend.py, this is the frontend @/frontend.js, now go do \_\_\_\_” - you’re going to be way better off than just “@codebase, go do \_\_\_\_”.

also - for frameworks that aren’t likely to have a lot of examples in the training (ie, they are new or rare) - then i would recommend using cursor to ingest the docs and come up with advice, which you then put in .cursorrules

1. add the new docs as custom doc
2. tell the AI to generate the key things to remember about this framework.
3. then tell it to write those to .cursorrules voila. AI teaching AI. (learned the hard way after constantly reminding sonnet to re-read the svelte 5 docs)  
 ![CleanShot 2024-11-20 at 14.11.24@2x](https://us1.discourse-cdn.com/cursor1/original/2X/2/2402c20bd0001eda209ef454deb63e413c2fa343.png)  
 ![CleanShot 2024-11-20 at 14.12.07@2x](https://us1.discourse-cdn.com/cursor1/original/2X/6/6bec6d01694de40038d0319822bb5963fe3fe376.png)

see my tweet with this advice: [x.com](https://x.com/raw_works/status/1859314019460358261)

---

<div class="post-metadata">

**Author:** ![g4d](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/g4d/32/11527_2.png) [@g4d](https://forum.cursor.com/u/g4d)\
**Post date:** [November 21, 2024, 11:30pm UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/5 "2024-11-21T23:30:51Z")

</div>

> [@raw.works](#):
>
> - tell the AI to generate the key things to remember about this framework.
> - then tell it to write those to .cursorrules

Ah, I have been just @ mentioning the docs every time, but I like this approach. Will give it a try.  
Thanks for the detailed response, very helpful.

---

<div class="post-metadata">

**Author:** ![ericzakariasson](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ericzakariasson/32/11130_2.png) [@ericzakariasson](https://forum.cursor.com/u/ericzakariasson)\
**Post date:** [November 22, 2024, 12:10am UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/6 "2024-11-22T00:10:00Z")

</div>

this is clever, nice one!

---

<div class="post-metadata">

**Author:** ![raw.works](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/raw.works/32/500_2.png) [@raw.works](https://forum.cursor.com/u/raw.works)\
**Post date:** [November 22, 2024, 7:39pm UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/7 "2024-11-22T19:39:15Z")

</div>

related to the above - one of the most common annoyances that i experience (in particular with composer mode) is that the AI re-writes methods that are already available.

for example, i have a `utility.ts` with all of the methods and auth to call some API. making sure to remind cursor: “first see if there is already a method in @utility.ts before attempting to write any new methods” can save a lot of time and a lot of “no, don’t rewrite that when there is already a function for that you idiot”.

i haven’t played much with “notebooks”, but it seems to me that this would be a better use case for a notebook (with the @ references) than a .cursorrules (which i don’t believe can support @ references).

so i’m thinking i should make one notebook with all of the:

```auto
the backend is @/backend
the frontend is @/frontend
the functions you need are probably in @/utility.ts

```

then that could get re-used in chat or composer…

---

<div class="post-metadata">

**Author:** ![ericzakariasson](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ericzakariasson/32/11130_2.png) [@ericzakariasson](https://forum.cursor.com/u/ericzakariasson)\
**Post date:** [November 22, 2024, 9:49pm UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/8 "2024-11-22T21:49:10Z")

</div>

this is a great use case for notepads. i still have to write docs on this, but the gist of it is

- share context between composers
- write code, @-references and attach files to them

curious to hear when you’ve tried it out

---

<div class="post-metadata">

**Author:** ![securecodecreator](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/securecodecreator/32/12733_2.png) [@securecodecreator](https://forum.cursor.com/u/securecodecreator)\
**Post date:** [November 22, 2024, 10:20pm UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/9 "2024-11-22T22:20:47Z")

</div>

Sur cursor l’IA est vraiment bien renseignée sur le fichier avec le CTRL + I avec l’ensemble des fichiers mais il faut tout de même un bon prompt et amener les bons fichier pour améliorer le résultat donc je dirai que l’approche est pas mal avec les allias

J’ai fais pas mal de test avec Claude, gpt 4, cursor small, gpt 4-o mini et si le prompt est optimisé, le résultat est présent à 80% du temps

Il faut quand même avoir un peu de base pour pas laisser l’IA sans instructions

Je fais avec Next Js et perso les instructions sont nécessaires même avec un bon prompt parfois

---

<div class="post-metadata">

**Author:** ![raw.works](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/raw.works/32/500_2.png) [@raw.works](https://forum.cursor.com/u/raw.works)\
**Post date:** [January 6, 2025, 12:49am UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/10 "2025-01-06T00:49:38Z")

</div>

this is next level:

> [@Mastering Long Codebases with Cursor, Gemini, and Claude: A Practical Guide](https://forum.cursor.com/t/mastering-long-codebases-with-cursor-gemini-and-claude-a-practical-guide/38240/):
>
> This guide outlines my approach to building software projects using Cursor IDE, leveraging Gemini (gemini-exp-1206, gemini-2.0-flash-exp) and Claude (3.5 sonnet and 3 opus) for effective development and maintaining code integrity. 1. Project Setup: Laying the Foundation for AI Collaboration Think of your project as a well-organized workshop where you and your AI collaborators (Gemini and Claude) will build something amazing. The first step is to set up the workshop properly. 1.1. Define the Ru…

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [June 18, 2026, 10:23am UTC](https://forum.cursor.com/t/cursor-prompt-engineering-best-practices/1592/11 "2026-06-18T10:23:21Z")

</div>

Closed on June 18, 2026, 10:23am UTC


