Saving prompts for cmd/ctrl +k instructions

I typically use the cmd/ctrl + k to create styles for a file or to edit code using simple instructions. I typically use the same prompts like “Create a stylesheet for this component and place the styles at the bottom of the file.” and it works wonderfully, but I’m wondering if we could save prompts somewhere and possibly reference them so that it could save some time and reduce small inconsistencies in applying instructions.

Basic outline of requested behavior:
When using cmd/ctrl + k, you should be able to reference saved instructions.
The instructions could either be saved in editor settings or the project, but preferably the editor settings.

10 Likes

This could be a great addition to Cursor. This is nicely implemented in Continue with prompt files (experimental) and custom slash commands. I think this feature is missing in Cursor and I would love to add the ability to reuse commonly used prompts

1 Like

You can save prompts, for example, in a folder called “prompts” and refer to them when interacting with the AI.

By “refer to them” you mean copy-pasting the contents from the file to the IDE prompt? Or you propose a more streamlined way?

EDIT: Perhaps something like this?

It should be as a mention of a file, not as copy and paste.

1 Like

This is really a good method. But I didn’t think of it.

I recommend using a gist or a github repo for storing your prompts. Than you can use the doc crawling feature in cursor to mention those prompts with @ symbol. This way, you don’t have to keep your propmpts locally.

Why not just use Espanso?

Made a guide, default integration would be awesome Smart customized Prompts on top of main System Prompt with espanso: A Practical Guide

Although Espanso provides a possible workaround, it is not a streamlined solution. I’ve proposed an approach for using sharable, configurable, reusable, and per-project-defined prompt files—see my comment here.

It’s baffling to me that I’ve yet to see[1] an AI assistant system with a composable prompt language!

The suggestion of saving the prompt as text in a file is not a complete solution. The special constructs like @-syntax are not serializable to text (by the user).

I get that this would pose escaping issues - you would essentially need to define a new small mini language. Still - when you already have created the rich text editor for editing the prompt in the chat view - how hard can it possibly be to allow this to be used as a editor mode? Simplest solution: define the prompt language format to be the serialization of the document nodes (I’m sure Monaco allow serializing a document to json…). Use .cursor-prompt as an extension and use the already exsiting prompt editor to edit these json documents in a user friendly way.

Why is no-one doing this? I would allow much more powerful prompt libraries.

Also - such a prompt system should support optional parameters to be interpolated into the prompt template.

And people using these tools know how to code right, editing the raw prompt as, say, XML would be perfectly fine for composing a reusable prompt library…

[1] Well - I suppose Souregraph’s Cody implements something like this - at least it’s possible to add some @ constructs to their saved prompts. But the prompt format is not open, so it’s not possible generate them for instance. And last I checked the prompt editor was only available online.

I also see now that Zed support this, but only in the (legacy?) “text-thread” system