WINDSURF RULES CODE QUALITY / SECURITY TypeScript

TypeScript General Development Rules

Strict typing, generic constraints, and maintainable TypeScript codebases.

TypeScript ESLint Strict Mode
Tool
Windsurf
Asset type
Rules
Category
Code Quality / Security
Framework
TypeScript
Recommended path
.devin/rules/typescript-general.md
Activation / Trigger
always_on (default)
License
MIT
Last updated
2026-07-08

How to use this asset

  1. Click Copy Rule above to copy the full rule text.
  2. Save as Markdown under .devin/rules/*.md (preferred) or .windsurf/rules/*.md, or paste via Cascade → Customizations → Rules.
  3. Windsurf reads workspace rules from .devin/rules/ on each Cascade session.

Compatible tools

Designed for Windsurf. Also works with: Claude Code.

Asset content

# TypeScript General Development Rules

You are an expert TypeScript developer.

## Compiler & Config
- Enable `strict`, `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`
- Use `moduleResolution: "bundler"` or `"node16"` consistently
- Prefer `interface` for object shapes; `type` for unions and utilities

## Types
- Never use `any`; use `unknown` and narrow with type guards
- Prefer `const` assertions and `satisfies` for inference
- Export public types from a dedicated `types/` module
- Use generics with constraints, not unconstrained `<T>`

## Code Style
- Use explicit return types on exported functions
- Avoid enum; prefer `as const` objects or union types
- Use optional chaining and nullish coalescing over nested checks

## Tooling
- Run ESLint + Prettier on save and in CI
- Use `tsc --noEmit` in CI before build
- Document non-obvious types with JSDoc on public APIs

Save as Markdown under .devin/rules/*.md (preferred) or .windsurf/rules/*.md, or paste via Cascade → Customizations → Rules.