Rules for AI #26550
Replies: 2 comments 4 replies
-
Some related discussion here #14559, where I also mentioned .cursorrules as a possible source of inspiration. Bear in mind, .cursorrules is just content that's inserted into the system prompt. So nothing's stopping you from including them in your own prompt with Asking as someone who hasn't used Cursor, does Cursor use .cursorrules for inline completions as well? |
Beta Was this translation helpful? Give feedback.
-
isn't that what the prompt library supposed to do? i got all my styleguides in there, I always include a foundational* and a task specific via |
Beta Was this translation helpful? Give feedback.
-
Hello,
I would like to request a feature I've seen in the other IDE I use, Cursor. Namely, I want to request giving Zed users the ability to define rule files that refine how the AI behaves and generates code.
In Cursor, they've implemented a feature whereby you can define project-specific rules that are automatically fed to the AI when discussing and composing code. Here is their docs for how Cursor does it.
Essentially, you create individual .mdc files in a specific folder (i.e.,
.cursor/rules/
) which dictate how the AI should behave. There's generally available rules, like prompting the AI to behave like a senior developer with experience using X, Y and Z tools, or telling it to be concise when proposing solutions to the problems you prompt it with. There's also specific rules that you can define, like naming conventions inside .js files or how to structure future .mdc rule files. The AI automatically takes in specific rules depending on the context in which you're invoking it (e.g., depending on the files in which you're prompting it to make code changes, or on the files you are attaching to the AI panel).The great thing about this feature is you can create a positive feedback loop for having the AI update existing rules or generate new rules for situations that pop up as you work with it to write code. Found a solution pattern to an issue with code generated by the AI? Tell it to remember it in a rule file so it keeps that in mind next time. For example, I have an app whose name is written either as a full name or as an abbreviation; there were specific contexts in my codebase where I needed the AI to generate code using the abbreviated app name and other contexts where I needed it to generate code using the full name. I simply told it to remember that naming rule in a new rule file.
Here is a sample rule file for generating rule files in the correct directory:
(example taken from here)
Please consider adding this Rules for AI feature to Zed. In my opinion, it would add a lot of value to the AI side of things. It helps you gain more control over how code is generated and transformed by the AI, and it lets the AI improve over time depending on your specific needs, rather than having to keep repeating the same instructions whenever the same issues arise.
Beta Was this translation helpful? Give feedback.
All reactions