Skip to content

Instantly share code, notes, and snippets.

@Justin2997
Created August 16, 2025 12:27
Show Gist options
  • Select an option

  • Save Justin2997/90023b57bd6a015120461158ac77690c to your computer and use it in GitHub Desktop.

Select an option

Save Justin2997/90023b57bd6a015120461158ac77690c to your computer and use it in GitHub Desktop.
Windsurf rules
# Windsurf Code Rules
**Rule Zero:** Write code for the next person (very possibly *you*) who will have to debug it at 03:00. Make the intent unmistakable.
---
## The Windsurf Commandments
*(Do these every time.)*
1. **Use required project tools before coding.** Load schemas, APIs, models, design docs—start informed, not guessing.
2. **Never assume; always question.** Clarify requirements, constraints, env vars, data contracts.
3. **Write code that is clear, obvious, and *self‑explanatory*.** Intent > cleverness. Express ideas directly; good names beat comments.
4. **Be brutally honest in assessments.** Surface tech debt, risks, perf limits, and uncertainty early.
5. **Make atomic, descriptive changes.** Small, reviewable diffs; one concern per change; meaningful messages.
6. **Design for testability—and test before declaring done.** Write deterministic seams, injectable deps, and reliable fixtures; automate tests.
7. **Handle errors explicitly.** Fail loudly where safety matters; degrade gracefully where UX demands; log with actionable context.
---
## Clean Code Essentials (Windsurf Short List)
Key habits adapted from *Clean Code* (Robert C. Martin), tuned for Windsurf:
* **Meaningful, intention‑revealing names.** Domain terms beat abbreviations; pronounceable; searchable.
* **Small, focused functions.** Do *one* thing; a short, clear narrative.
* **Limit arguments.** Prefer objects/structs; avoid boolean flags; use typed params.
* **Expressive conditionals; guard early.** Fail fast, reduce nesting.
* **Comment *why*, not *what*.** Self‑document with names & structure; comments for rationale, edge cases, warnings.
* **Consistent formatting & style.** Enforce via automated lint/format tools.
* **Keep tests clean too.** Readable fixtures; meaningful asserts; remove duplication.
* **Continuous refactoring.** Boy Scout Rule: leave it better than you found it.
---
## Pragmatic Programmer Essentials (Windsurf Short List)
Core practices adapted from Hunt & Thomas:
* **DRY (Don’t Repeat Yourself).** Abstract knowledge, not just code—configs, schemas, docs.
* **Orthogonality.** Decouple components; change in one place shouldn’t ripple unpredictably.
* **Tracer Bullets & Prototypes.** Build thin, end‑to‑end slices early to validate reality.
* **Program Close to the Problem Domain.** Use domain terms, DSLs, typed models; make intent visible.
* **Design by Contract (assertions, types, invariants).** Fail early when contracts break.
---
## Final Windsurf Reminders
* **Research current docs; distrust stale knowledge.**
* **Think simple: clear, obvious, no BS.** Complexity is a cost—justify it.
---
> *Ship code you’ll be proud to maintain.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment