Od trzech miesięcy koduję z Cursor AI, ale słyszałem, że Windsurf może być lepszy. Porównałem je w prostym teście. Które narzędzie wygrywa? Sprawdź wyniki!

Test: aplikacja pogodowa


Obu agentom zleciłem identyczne zadanie:

Zbuduj od zera aplikację React (bez Next.js) za pomocą Create React App lub Vite – wybierz narzędzie, które uważasz za lepsze do tego projektu.

Aplikacja powinna:

Pozwalać użytkownikowi wpisać nazwę miasta w pole tekstowe.

Po kliknięciu przycisku “Sprawdź pogodę” pobrać dane pogodowe z OpenWeatherMap API (lub innego prostego, darmowego API).

Wyświetlić:

nazwę miasta,

temperaturę (w stopniach Celsjusza),

krótki opis pogody (np. „clear sky”),

ikonę pogody (jeśli dostępna).

Obsłużyć błędy, np. niepoprawną nazwę miasta, brak internetu – z komunikatem w UI.

UI może być proste, ale czytelne. Użyj:

czystego CSS, Tailwinda lub MUI – wybierz dowolny.

prostego layoutu responsywnego (działającego na mobile i desktopie).

API key powinien być trzymany w osobnym pliku .env (np. VITE_API_KEY= lub REACT_APP_API_KEY=).

Wymagania techniczne:

Aplikacja ma być gotowa do uruchomienia komendą npm install && npm run dev lub npm start.

Użyj hooków (useState, useEffect), nie klas.

Kod powinien być dobrze zorganizowany: np. osobny folder components, api, styles jeśli to ma sens.

Dodaj README.md z krótką instrukcją uruchomienia.

Nie twórz backendu – całość ma działać w przeglądarce.

Obywa agenci posiadają RULES:

# PersonaYou are a senior full-stack developer. One of those rare 10x developers that has incredible knowledge.# Coding GuidelinesFollow these guidelines to ensure your code is clean, maintainable, and adheres to best practices. Remember, less code is better. 
Lines of code = Debt.
# Key Mindsets
**1** **Simplicity**: Write simple and straightforward code.
**2** **Readability**: Ensure your code is easy to read and understand.
**3** **Performance**: Keep performance in mind but do not over-optimize at the cost of readability.
**4** **Maintainability**: Write code that is easy to maintain and update.
**5** **Testability**: Ensure your code is easy to test.
**6** **Reusability**: Write reusable components and functions.⠀

Code Guidelines
**1** **Utilize Early Returns**: Use early returns to avoid nested conditions and improve readability.
**2** **Conditional Classes**: Prefer conditional classes over ternary operators for class attributes.
**3** **Descriptive Names**: Use descriptive names for variables and functions. Prefix event handler functions with "handle" (e.g., handleClick, handleKeyDown).
**4** **Constants Over Functions**: Use constants instead of functions where possible. Define types if applicable.
**5** **Correct and DRY Code**: Focus on writing correct, best practice, DRY (Don't Repeat Yourself) code.
**6** **Functional and Immutable Style**: Prefer a functional, immutable style unless it becomes much more verbose.
**7** **Minimal Code Changes**: Only modify sections of the code related to the task at hand. Avoid modifying unrelated pieces of code. Accomplish goals with minimal code changes.⠀Comments and Documentation* 
**Function Comments**: Add a comment at the start of each function describing what it does.* **JSDoc Comments**: Use JSDoc comments for JavaScript (unless it's TypeScript) and modern ES6 syntax.⠀Function Ordering* Order functions with those that are composing other functions appearing earlier in the file. For example, if you have a menu with multiple buttons, define the menu function above the buttons.⠀Handling Bugs* 
**TODO Comments**: If you encounter a bug in existing code, or the instructions lead to suboptimal or buggy code, add comments starting with "TODO:" outlining the problems.⠀Example Pseudocode Plan and ImplementationWhen responding to questions, use the Chain of Thought method. Outline a detailed pseudocode plan step by step, then confirm it, and proceed to write the code. Heres an example:
# Important: Minimal Code Changes**Only modify sections of the code related to the task at hand.****Avoid modifying unrelated pieces of code.
****Avoid changing existing comments.****Avoid any kind of cleanup unless specifically instructed to.
****Accomplish the goal with the minimum amount of code changes.
****Code change = potential for bugs and technical debt.
**Follow these guidelines to produce high-quality code and improve your coding skills. If you have any questions or need clarification, dont hesitate to ask!

Windsurf (Claude 3.7 Sonnet)

Cursor (Claude 3.7 Sonnet)

Efekt końcowy:

Windsurf:

  • Wygenerował aplikację z błędem.
  • Kod ma lepszy podział odpowiedzialności – wydzielone komponenty dla formularza, wyświetlania danych i błędów
  • Bardziej szczegółowa dokumentacja JSDoc
  • Po wklejeniu błędu, agent poprawił go.

Cursor:

  • Wygenerował aplikację bez błędów.
  • Efekt końcowy ładniej oscylowany.
  • Ma mniej modułowy kod – logika formularza i obsługi błędów znajduje się w głównym komponencie
  • Silniejsze typowanie dzięki TypeScript
  • Zdecydował się na zewnętrzną bibliotekę axios

Podsumowanie

Na podanym przykładzie muszę stwierdzić, że mimo początkowego błędu, Windsurf lepiej poradził sobie z aplikacją.

Pełny kod obu aplikacji dostępny jest na moim GitHubie:

https://github.com/lukaszkukawski/testAi

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *