What problem does it solves?
Ensuring strict type safety, consistent coding style, and adherence to modern patterns in TypeScript and React projects can be difficult without automated enforcement, leading to bugs and maintainability issues. This Skill enforces TypeScript/JavaScript style best practices.
Core Features & Use Cases
- Core Standards: Enforcement of Strict TypeScript mode, ESLint type-checked rules, avoidance of
any type, and explicit function return types.
- Naming Conventions: Guidelines for PascalCase types/interfaces, camelCase functions/variables, and
is/has/can/should prefixes for booleans.
- Type Definitions: Examples for preferring union types over enums, using
as const for constant objects, and implementing discriminated unions.
- React Patterns: Guidance on using typed props, typed hooks (
useState), and typed event handlers (React.FormEvent).
- Anti-Patterns to Avoid: Identification of common pitfalls like using
any, missing return types, == vs ===, and unhandled promises.
- Use Case: Writing new TypeScript/React components with strict type safety; refactoring existing JavaScript to TypeScript; ensuring ESLint rules are followed; identifying and fixing common TypeScript anti-patterns.
Quick Start
Use the typescript-style skill to refactor the attached React component to use typed props and state, adhering to strict TypeScript rules.