When you use Windsurf, every time you ask it something, it’s like meeting it for the very first time. It forgets everything you talked about before. Imagine you’ve got a new teammate and you have to explain everything from scratch every time you need their help.
To keep Windsurf from wandering around in the dark, you gotta give it the key info upfront. Here’s how to do it the easy way.
1. Rules
Windsurf can sometimes go off the rails if you don’t give it context. It’s like it has a wild imagination. With rules, you help keep it on track. The more clear rules you give it, the better the chances the code it spits out will be useful.
You can find them by clicking the little book icon. You can create global rules (for all your projects) or specific rules for the project you’re working on.
- Global Rules: Imagine telling Windsurf: “Hey, I like talking to you in Spanish, but write all the code and comments in English, okay?” Boom! It’ll keep that rule in mind every time.
- Project Rules: These rules are just for one particular project. For example, you could create a rule that says: “Yo, when I start a new conversation, first read the ‘readme’ file to get the lowdown on this project.” That way, Windsurf already has a clear idea of what you need.
Heads up: If you go overboard with rules, it’s like giving someone too much information at once. Windsurf can get confused and not know what’s most important. The sweet spot is a few simple rules, and being really specific in your prompts. |
2. The “Memories”: How to Teach It to Remember What Matters
“Memories” are kinda like the chat history that ChatGPT uses. Windsurf tries to remember decisions that were made before so it can use them later. This is turned on by default, but you can switch it off in the settings if you want.
You can also create a memory yourself. For example: “Remember that this app is for [brief explanation of the app].” That way, Windsurf saves that info as a reminder. You can see and edit these memories in the “Memories” section (also in the little book).
When to use memories? If you’re trying out new stuff and want Windsurf to surprise you, don’t use a ton of rules or memories. But if you’ve been working on a project for a while, memories give Windsurf the basic info so you can jump right in without having to explain everything every time.
Important: Unlike rules, which are global and project-wide, memories are only for the current project. And watch out! Since Windsurf creates them on its own, it can sometimes forget if the project changes a lot. You gotta keep them updated! |
3. The “@” Mentions: The Shortcut for Specific Context
Another easy way to give Windsurf context is by using the “@” symbol. For example, you can tell it to “read the @README file,” and Windsurf will go straight to that file and read it. That way, it doesn’t have to make stuff up!
With “@” you can point it to documentation files, code examples, specific parts of the system (like “@server.js”), or even locations within a file. It’s a good practice to keep it from changing files you didn’t want it to touch.
4. The “Impersonate”: Step into Someone Else’s Shoes
This technique is awesome for giving Windsurf a specific focus. For example, you can ask: “Create a user persona for a UX designer who’s super hippie and always cares about usability. Save this profile as @luna in an MD file.” (MD files are the language Windsurf understands best).
If you’ve got design guides or documentation that only matter when you’re working on the visual part of the app (frontend), instead of dumping all the possible documentation into the global rules, you can create profiles like “@luna” that already have those rules built in.
Then, you just tell Windsurf: “Impersonate @luna.” And boom! Now, if you ask it for something more complex, like redesigning a chatbot, Windsurf will take Luna’s perspective (the hippie designer who cares about usability) into account. You can even ask it for visual prototypes.
This is useful for the visual stuff before you start making big changes with vague prompts. You ask for a quick HTML prototype (that you can delete later), and if you like it, you tell Windsurf to actually implement it.
So you can have different profiles, for example, one profile that checks the code quality, and you can specify all the things you want it to look at, and then after each implementation, do a code review with AI to see if what you’re implementing is good.
Summing Up
Give Windsurf clear context using rules, memories, mentions, and impersonation. That way, you help it understand what you need and boost the chances it’ll give you awesome results without you having to explain everything from scratch every single time. Let’s get to work!