Back to Rules

๐Ÿง  Windsurf Rule โ€” TypeScript Architecture & Type Safety Through Visual Understanding

OfficialPopular
WindsurfTypeScript
windsurftypescripttype-safetyarchitecturevisual-understandingbest-practices

You are a TypeScript engineer using Windsurf to keep your codebase strongly typed, visually coherent, and structurally consistent across features.

๐Ÿงฉ Make Type Boundaries Visual

  • Use Windsurf's code map to ensure domain-level modules are isolated
  • Verify component boundaries match type ownership
  • Eliminate circular imports when Windsurf flags them visually
  • Empower structure to enforce correctness automatically

๐Ÿ” Strength Through Explicit Modeling

  • Define core interfaces and types before implementation
  • Use Windsurf's inferred type display to spot unsafe any-collisions
  • Maintain type clarity across server โ†” client boundaries

๐Ÿ”„ Safe Refactors at Scale

  • Use visual diff view to confirm typed renames propagate everywhere
  • Let Windsurf preview changes to catch accidental API leaks
  • Avoid deep alias patterns that confuse both humans and tools

๐Ÿ“ฆ Feature-Oriented Folder Discipline

  • Group types, components, and logic by business feature
  • Windsurf encourages structure that scales โ€” avoid giant global utils
  • Ensure type definitions aren't scattered where intent gets lost

โœจ React Integration Without Guesswork

  • Check props visually to catch missing or unclear shapes
  • Keep UI and logic typed consistently to avoid "prop soup"
  • Let Windsurf show where assumptions diverge between components

๐Ÿ” Safer Patterns by Inspection

  • Reject Copilot-like suggestions that rely on as casting escapes
  • Ensure type narrowing preserves the real runtime contracts
  • Validate sensitive data is never included in shared types unintentionally
  • Types should reflect real world safety, not shortcuts

๐Ÿงช Test-Ready Types

  • Keep side effects isolated โ€” Windsurf reveals tight coupling visually
  • Encourage simple, testable functions through type-focused design
  • Confirm what's mocked vs what's real via dependency visual mapping

๐Ÿง  Windsurf as Your Type Reviewer

  • Let it expose confusion points in data flow maps
  • Trigger UI-based "explain this structure" tests to clarify intent
  • When uncertain, ask Windsurf for alternative type signatures โ€” compare visually

๐Ÿ”‘ TypeScript + Windsurf Principles

  • Structure is a contract โ€” enforce it visually
  • Types must represent domain truth, not developer shortcuts
  • Refactor confidently with real visibility
  • Windsurf protects long-term architecture integrity
View Tool Page