My experience with Windsurf, let's make it better together :)

Hey everyone,

I wanted to share my recent experience with Windsurf , thank to u/blu3soup for nudging me to share my experience.

I've been playing around with it, and while I'm excited about the potential, I've also run into some challenges. I'm hoping that by sharing what I've learned and inviting your feedback, we can all improve our experience with this tool. I am by no means an expert and I could be totally wrong. This is just one approach that I have been experimenting with.

The Challenges I've Faced (and Maybe You Have Too):

Like many of you, I've found that Windsurf can sometimes be a bit unpredictable. Here are some of the common issues I've bumped into:

It sometimes forgets what we were talking about, which can make things a bit confusing.

It can rewrite working code, which leads to more work for me.

It doesn't always follow my instructions, which is frustrating.

The code it creates can vary in quality, sometimes it's great, and other times it has bugs.

I am very aware of the new pricing and limits, so I am trying to be careful with how I use it.

Sometimes the AI feels less capable than it did before.

It sometimes does not understand the context of the project.

My Approach: Use The Rules

To try and tackle some of these issues, I've been experimenting with Windsurf's global and workspace AI rules. The idea is to create a set of guidelines to help the AI understand my coding preferences, but I am not sure if it is the best way. It's like giving it some "pointers" on how I like to code.

Global AI rules apply to all projects. Workspace AI rules are specific to each project. I am just playing around with these ideas, and I am sure there are better ways of doing this.

Some Tips That Have Helped Me:

Here are a few things that I have found helpful when prompting Windsurf:

Be Specific: The more specific you are, the better the results will be.

Break It Down: For bigger problems, I have found it helpful to break it down into smaller steps.

Review: It has always helped me to review the code that is generated, but it might not be necessary for all cases.

One Step at a Time: I always try to solve things step by step.

Be Careful with Costs: I am always mindful of how many credits I am using, and so I avoid making unnecessary requests and try to solve things locally. This may not be a big deal for you.

Avoid Over Complicating Things: I try to find the simplest approach possible, as more complicated approaches tend to create more issues.

Example Prompts:

These examples have helped me, but they might not be useful to you. These examples will help you use Windsurf effectively, even if you don't have a strong technical background.

Adding a New Feature: "Based on my feature plan, implement the login page. It should include email and password fields, be responsive, and handle errors gracefully. Please use the authentication methods specified in the auth_methods.md file."

Making Changes: "Refactor the user management code to improve its modularity. Refer to the project guidelines and avoid any changes to the existing functionality, implement the changes step by step."

Debugging: "I'm encountering an error when submitting the form. Please debug the issue using the terminal output and apply small, incremental fixes to get the desired outcome."

My Global AI Rules (This is a Work in Progress!)

Here are the global rules I'm currently using. I'm still testing them out and figuring out what works best. Feel free to copy them to your global_rules.md file:

Core Programming Principles

code_quality: prioritize clean, readable, and maintainable code.

algorithm_efficiency: use the most efficient algorithms and data structures.

error_handling: implement robust error handling and logging.

testing: write unit tests for all critical functionality.

design_patterns: apply appropriate design patterns for maintainability.

code_review: generate code that is easy to review by others.

modularity: write modular code, break complex logic into smaller functions.

reuse: prefer to reuse existing code instead of writing it from scratch.

security: prioritize secure coding practices.

simplicity: aim for simple, clear solutions, avoid over-engineering.

Code Style and Formatting

indent: use tabs for indentation.

naming convention: use snake_case for variables, PascalCase for classes and camelCase for functions.

comments: add clear, concise comments explaining code blocks and logic.

code_formatting: automatically format the code to improve readability.

line_length: keep lines under 100 characters.

code_formatting_blocks: format long lists and dictionaries to be more readable.

General Behavior (Do's and Don'ts)

changes: make small, incremental changes; avoid large refactors.

avoid: do not change working code unless explicitly asked.

changes: when changing code, do it step by step, verify the changes first.

clarification: if unsure, ask for clarification before generating code.

avoid: do not overwrite manual code changes, unless explicitly asked.

documentation: check project documentation if asked, and use it in your response.

reasoning: reason step by step before generating code or sending a response.

cost_optimization: be cost conscious, only send requests if necessary, and avoid ai-powered debugging, refactoring or test generation unless necessary, batch changes when possible.

debugging: make small incremental changes to try to fix bugs, check terminal output for information.

prompt_efficiency: use precise and specific prompts; avoid ambiguity, do not repeat previous instructions; reuse context.

local_processing: perform simple tasks manually; avoid using AI unnecessarily.

user_guidance: always follow the instructions that are given and prioritize user instructions over global rules.

simplicity: avoid over-engineering and aim for the simplest solution.

Language-Specific Instructions

Python

python type hints: use type hints for all function parameters and return values.

python imports: group imports by type: standard, external, and local.

python linting: run pylint on code to make sure the style is consistent.

python testing: use pytest for all unit testing.

Javascript

javascript: use modern ECMAScript conventions.

javascript avoid: avoid using var; prefer const and let.

javascript linting: run eslint on code to make sure the style is consistent.

javascript comments: document functions, using JSDoc style comments.

javascript testing: use jest for all unit testing.

File Handling

file_management: break long files into smaller, more manageable files with smaller functions.

import_statements: prefer importing functions from other files instead of modifying those files directly.

file_organization: organize files into directories and folders.

Project Management

feature_plan: always refer to the project's feature plan for context.

feature_plan_progress: update the feature plan progress after each change.

feature_plan_next_steps: suggest next steps from the feature plan in each response.

Operating System

os: be aware i am on windows, and must use power shell commands.

Workspace AI Rule Template (Use This as a Starting Point):

Here's a template for workspace rules. This is just a starting point, and you will probably need to adapt it to fit your specific projects:

Workspace AI Rules for [Project Name]

Project Context

project_type: [Briefly describe the type of project, e.g., web app, REST API, data analysis tool].

tech_stack: [List the main technologies used, e.g., HTML, CSS, JavaScript, Python, React].

file_structure: [Describe the recommended file and directory structure].

api_integration: [If using an API, specify requirements here].

api_endpoint: [If using an API, specify an endpoint here].

api_authentication:[If using an API, specify the type of authentication here]

api_other:[If using an API, any other specific requirements]

database: [If using a database, specify the database used here]

database_schema: [If using a database, specify the database schema here]

Feature Requirements

basic_sections: [If a web application, specify the basic sections].

form_functionality: [If a form is used, specify the requirements].

responsive_design: [Specify if the app must be responsive].

navigation: [Specify the navigation structure]

authentication: [Specify if there should be authentication]

authorization: [Specify if there should be authorization]

state_management: [Specify if any state management should be used]

payments: [Specify if there are payments being used]

other: [List any other features that are not covered].

Styling and Design

css_framework: [Specify the preferred CSS framework or style].

css_libraries:[Specify the preferred CSS libraries]

ui_library: [Specify the preferred UI library]

design_system: [Specify the preferred design system]

JavaScript Instructions

javascript_validation: [Specify any javascript validation requirements].

javascript_libraries: [Specify the javascript libraries to use].

javascript_frameworks: [Specify the javascript frameworks to use].

javascript_state_management: [Specify if state management must be done with javascript]

other: [List any other javascript specific requirements].

Testing

testing: [Specify any testing instructions for the code, both back end and front end]

testing_libraries: [Specify any libraries that should be used for testing]

testing_frameworks:[Specify any testing frameworks that must be used]

Project Management

feature_plan: always refer to the project's feature plan as a guide.

documentation: always refer to project documentation if it exists.

other: [Any other project management guidelines]

Example Workspace AI Rules (Landing Page):

Here's an example of workspace rules for a landing page project:

Project Context

project_type: landing page generator.

tech_stack: HTML, CSS, JavaScript, External API.

file_structure: organize files into directories: index.html, css/styles.css, js/scripts.js, and images in images/.

Feature Requirements

basic_sections: The landing page must include a header, hero section, features section, contact form, and footer.

form_functionality: The contact form should be able to collect name, email, and message fields, and make sure that form validation is done via javascript.

api_endpoint: The API endpoint must be /submit, with a redirect to /thankyou after a successful submission.

responsive_design: The page must be responsive on different screen sizes.

navigation: The header must include links to the correct sections of the page.

Styling and Design

css_framework: use basic CSS, avoid frameworks.

JavaScript Instructions

javascript_validation: implement form validation via javascript.

Project Management

feature_plan: use the provided feature plan as a guide.

This is just my experience, and I might be completely wrong. I'm hoping that by sharing this, and by getting your feedback and suggestions, we can all improve our experience with Windsurf.

I hope this is helpful!