Cursor Windsurf Settings to 5x AI's Output Quality (Works with VS Code too)

1.31k views2434 WordsCopy TextShare
Yifan - Beyond the Hype
AI coding assistants can't guess everything; they need the right context to be truly effective. In t...
Video Transcript:
context is ke for AI here's what people frequently forget AI can't magically guess everything when building Real World products you can't rely on AI to just guess everything correctly the secret is not about better prompts or more powerful models it's about concrete context today I'll show you how one simple rules file can transform your AI coding assistant into a much more reliable development partner whether you're using vs code cursor or WI or any other coding editors that supports a similar feature let's dive straight in first of all these are context that get included on all
of your AI chats whether it's your composer runs your chat your wind Cascades your GitHub co-pilot edit sessions as previously mentioned the three major code editors all have a similar feature here but just stored in different files vs code keeps this inside the GitHub Code Pilot instructions cursor there's a cursor rules files at the root of the room repository and wind surf there's a do wind surve rules that has just been recently released let's create a new chat when we take type anything short hello how's it going this context gets included directly as part of
that prompt automatically just as something obvious let's say ho ho ho at the beginning of the output every single time then we can save the file and type this into cursor chat how's it going you'll see it always says ho ho ho there's a very easy way to verify whether your rules file is working correctly or not you'll notice one key rule I've applied at the beginning is this line every time you choose to apply a rule explicitly state the rule in the output you can abbreviate the rule description to a single word or phrase
this is to make sure that I can clearly see in the output which rules has been followed specifically for each one of the edit sessions just so that I can easily sanity check oh has it missed anything and has it applied all of the rules correctly otherwise you just have a I implicitly following the rules and then you can only guess from the output whether it's doing things correctly or not so I keep this always as the first line of the rules file the second thing I include is the project context is a quick short
description of what this project is doing this is not describing the implementation but mostly describing the purpose of the project the high level goal that you are trying to achieve so here I was working on a system that helps me auto book Visa appointment for shenen area because I got so annoyed about it and so that's what I describe the problem is the next section in the file I outline the rough structure of my code base because I generally prefer a monor repo structure which is not so common so I always clearly outline how I
structure my code so that AI has context on what to do on the server side it has front end as well as back in logic so you have the react and server API code directly in there and because because this also has a Chrome extension there's a separate folder for that there's also a shared package for reusing components across different part of the project you can see why this is actually important let's say we create something really simple say for getting the first 10 digigit of Pi and directly you can see in the output that
it's already looking to implement this utils functions inside the shed folder this is without any explicit prompting inside agent mode it hasn't even looked directly into the directory to know to Output it the only reason it knows is by inferring this context directly from the rules file that provided and then it was able to list the directory to see if there's anything already there and then create this math content file add it to the index.ts file here it also clearly outlined every single rules it has followed it says oh follow the project directory structure and
then I always have explicit return types as my typescript rules and then making sure is a pure function adding proper GS docs and having named exports for every one of the project how convenient is that the next section in the file is specifying the text stack that's being used the reason for specifying text tack is that the bigger your project gets when you're generating code you don't want AI to just introduce a random dependency this makes sure that it knows exactly what you're using as context when it goes into that code generation if you're using
a database you probably also want to include the omm library that you're using here if you're using very common text tack say nextjs for both front end and backend there's no specific backend logic then you probably don't need to specify this because that's already well known and the model has mostly already been trained on so that's very straightforward but if you're using something a bit more tailor made and custom you always want to specify it explicitly here and because my specific project had to use Chrome extension and I made sure to call out a few
very quum extension specific implementation detail I preferred say oh I always want to use the Chrome manifest V3 making sure that whenever it uses Chrome's internal messaging it always generates specific type for that and handle permissions appropriately using the most restricted set and so on this just makes sure that for any specific text tack that you have additional rules for you can also put it in here and say if you're using a specific spefic RM and you wanted to generate say all lowercase for your field names you can specify that here there's a whole bunch
more like a syntax formatting and UI so you can imagine everything here is just clearly stating your preference you should only add preferences when you notice that AI is consistently getting your idea wrong if it's already doing things correctly there's nothing you need to change you only need to add things in here when you notice is constantly doing the wrong thing another quck for AI is that the more context you shove in doesn't necessarily mean better code it's about the concise context only giving it what it needs because if you give it too much it
can get confused and longer rules file also makes it much harder for you to maintain in the long term because you might easily have conflicting rules or outdated rules that you forgot to update so the more concise the better creating this file should be an iterative approach this line was a very specific one that added because I noticed that cursa tends to generate the MPX sh- UI command somehow which is already deprecated command because now it's always with the shaen at latest and notice that it constantly makes that mistake so I've added this specific line
here whenever it generates a new line to add components generate this command instead you can put anything in this rules file any context you think might might be useful for the AI to better understand project to generate higher quality code for you git is a very specific one I quite enjoyed because for my git comits I like having a very clean git history to visualize all of the different type of work I've done so I've clearly outlined how I should categorize the different type of commit messages how I should be framing each one of the
commit messages to make sure it can generate that concisely every single time cousin now has this oneclick button to to generate a commit message and that also reads the rules file so that it generates a consistent get commit message every time based on my requirements it can even help you maintain your front page read me file if needed because if you specify there's a significant change in one of the libraries that you modified it knows to update the readme file specifically for commenting I generally dislike commenting in code and find that AI generates inconsistent comment
across different code sometimes it generates really illustrative comments and sometime it just leaves it completely blank so I asked it to only include comments for complex logic and document things that are critical to the system's performance but ignore all else there's a few key principles to follow when maintaining these files rule number one you want to keep the file con size as previously mentioned AI gets confused when you give it too much context so the clearer the instruction the better when you have clear instructions in the rules file it makes sure that AI can very
easily follow your instructions and generate outputs exactly based on your requirement so the key principle here making sure you only add rules that you find AI constantly making mistakes and add context that are critical for your project that AI needs to know to generate implementations well say whether it's security requirements whether it's usage of specific libraries that can go directly into the rules file the key keep it concise rule number two you want to be constantly updating the file as you discover new problems this is not something that you said once at the beginning of
project and then just forget as you discover new things that you find AI is making mistakes on you'll notice there are additional rules that you can put into the file to make it generate output more consistently so you should continuously edit the file as you go along and because this a file that lives in your repository this can even get updated as part of your PO request that gets committed into your code base how convenient is that if you follow those two rules I think you'll find that the AI coding assistance is now able to
generate output much more consistently than before you normally wouldn't notice this if you're just working on a prototype the context is relatively small it's just within a few files AI almost always have the full cont text of the entire codebase this is not an issue for it to generate consistent output and because you ask it to slot on the blank State there's no conventions to follow whatever it generates as long as it completes a functionality is correct but if you're working on existing project or as your project grows that becomes an issue that's why these
rules become more important the later stage you get with your project if you're also like me that likes to test out all of the latest AI features across different editors I current L have VSS code co-pilot wind Surf and cursor all insall at the same time you can symbolically link the single cursor rules file into the co-pilot instructions file into thewi rules file as well so that you can keep a single file that updates the instructions for all of the AIS for the different code editors looking to the future I think there's so many opportunity
for improving the experience for manually adding contact for AI providing it the more abstract high level context to code better one is allowing the breakdown of files a is not great at dealing with huge context but sometimes you might have a lot of complex context for your codebase and you want to include all of that I've tried a few different ways but I could not figure out how to conditionally include context files say oh here's the file you should look at when you're doing database related work here's the file you should look at when you're
doing math Rel Rel at work here's the file you should look at when you're doing UI related work could not get that level of customization that would be a new feature I'd really love adding something straightforward would be nice say I link the file to you know like uh code generation rules code generation rules I save it in my prompts folder and I have a separate code generation rules MD file it knows to read into the additional rules file that would be so much more convenient secondly I love to see what I try to do
do at the end of the rules file to be automatically added you know the auto memory scheme for those of you who have used chat gbt you might have noticed the memory feature it tries to find points in your chat where it feels like that's part of the knowledge of how the model should understand you whether this person is a software engineer this person likes to code using goand this person likes the code using node.js so it notices those kind of preferences as you chat with the system and they add that into its memory so
that in your future chats it knows to pull the right context from those memories so that it applies the right preferences in new generations without you having to manually do anything as previously mentioned all these workflows that we're doing we're manually adding that context we know it's making mistakes what would be nice is for those AI editors to notice the issues where you have a really extended chat taking you know five six iterations to get something correct and based on those iterations it should be able to infer oh this is the preference of the person
oh this is the places where my previous generation was making mistakes therefore those are the things I need to change for the future here's a suggested addition to your rules file can I add that in if they integrate that feature into the existing rules file it would be great because those suggested edits also gets committed into the codebase everything's versioned but you don't have to go through through the manual workflow to maintain this file that would be the best place that we could be in now you know how to make your AI coding assistant much
more reliable than ever before if you've enjoyed the video check out my other AI coding assistant Pro tips just up there until then Happy shipping and I'll see you in the next one
Related Videos
You were RIGHT! The Best Smart Home Combo for 2025
14:42
You were RIGHT! The Best Smart Home Combo ...
Technithusiast
26,184 views
Windsurf vs Cursor: In-Depth AI Code Editor Comparison
18:14
Windsurf vs Cursor: In-Depth AI Code Edito...
Yifan - Beyond the Hype
15,172 views
Build Anything with Claude Agents, Here’s How
18:35
Build Anything with Claude Agents, Here’s How
David Ondrej
169,411 views
5x Your Cursor AI Coding Quality With These Pro Tips
16:34
5x Your Cursor AI Coding Quality With Thes...
Yifan - Beyond the Hype
8,680 views
I Built a Low Code n8n Content to Video Automation
13:18
I Built a Low Code n8n Content to Video Au...
AlexK1919 | AI-Native Workflow Automation
4,028 views
Devin just came to take your software job… will code for $8/hr
5:13
Devin just came to take your software job…...
Fireship
944,390 views
A Confession From The Man Who Shot JFK | Confessions Of An Assassin | @DocoCentral
1:20:10
A Confession From The Man Who Shot JFK | C...
Documentary Central
337,402 views
One Neovim Plugin, 10x Quality of Life.
8:36
One Neovim Plugin, 10x Quality of Life.
DevOps Toolbox
57,070 views
Windsurf Masterclass: How to Build & Deploy AI Apps | STEP-BY-STEP
1:00:03
Windsurf Masterclass: How to Build & Deplo...
Ahmed Mukhtar | AI Automations
6,182 views
Unlocking Cursor AI: Top 8 Hidden Features
13:57
Unlocking Cursor AI: Top 8 Hidden Features
Yifan - Beyond the Hype
9,174 views
Which AI Code Editor is ACTUALLY The Best? (Cursor vs Windsurf)
8:34
Which AI Code Editor is ACTUALLY The Best?...
Melkey
18,526 views
Andrew Ng Explores The Rise Of AI Agents And Agentic Reasoning | BUILD 2024 Keynote
26:52
Andrew Ng Explores The Rise Of AI Agents A...
Snowflake Inc.
192,117 views
I Made an iOS App in MINUTES with This AI Tool!
13:20
I Made an iOS App in MINUTES with This AI ...
Creator Magic
437,096 views
5 Python Libraries You Should Know in 2025!
22:30
5 Python Libraries You Should Know in 2025!
Keith Galli
62,729 views
Moore's Law is Dead — Welcome to Light Speed Computers
20:27
Moore's Law is Dead — Welcome to Light Spe...
S3
1,455,440 views
Something is wrong with ISPs in India 🇮🇳
13:17
Something is wrong with ISPs in India 🇮🇳
Mehul - Codedamn
48,514 views
Is Windsurf Editor Better Than Cursor AI?
6:25
Is Windsurf Editor Better Than Cursor AI?
Corbin Brown
14,661 views
How to Build Robust Applications with Cursor AI + Playwright
20:04
How to Build Robust Applications with Curs...
Yifan - Beyond the Hype
5,980 views
The Ultimate Prototyping Workflow: Cursor AI + Replit
13:24
The Ultimate Prototyping Workflow: Cursor ...
Yifan - Beyond the Hype
3,747 views
How to Pick the Best AI Open-source Projects for Production Use
18:42
How to Pick the Best AI Open-source Projec...
Yifan - Beyond the Hype
2,267 views
Copyright © 2025. Made with ♥ in London by YTScribe.com