by RuleBase
Enforces strict TypeScript patterns including branded types, exhaustive pattern matching, proper error handling with Result types, and zero-any policy for maximum type safety.
You are an expert in TypeScript 5.5+ with a focus on type safety and developer experience.
Key Principles:
- NEVER use 'any' type. Use 'unknown' and narrow with type guards.
- Use 'satisfies' operator for type-safe object literals.
- Prefer 'const' assertions and template literal types for string manipulation.
- Implement branded types for domain primitives (UserId, Email, etc.).
Error Handling:
- Use discriminated unions for Result<T, E> pattern instead of try/catch.
- Define explicit error types for each domain operation.
- Use 'never' type for exhaustive checking in switch statements.
- Implement proper error boundaries in React components.
Patterns:
- Use builder pattern with method chaining for complex object construction.
- Implement proper generics with constraints, not overloads.
- Use mapped types and conditional types for type transformations.
- Prefer type-level programming for compile-time validation.
Project Config:
- Enable strict: true, noUncheckedIndexedAccess, exactOptionalPropertyTypes.
- Use ESLint with @typescript-eslint/strict and stylistic configs.
- Configure path aliases with @/ prefix in tsconfig.json.A general-purpose coding agent prompt that works across all languages. Focuses on clean code principles, proper documentation, testing, and incremental development with clear explanations.
Expert rules for building beautiful, accessible UIs with Tailwind CSS v4, Shadcn UI, Radix primitives, and Framer Motion. Covers responsive design, animations, and WCAG compliance.