typescript-style

Enforce TypeScript/JavaScript coding style and ESLint standards on frontend code.

14|1|Updated Dec 5, 2025
One-click install
npx skills add https://github.com/jpoutrin/product-forge --skill typescript-style
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-style
Source: https://github.com/jpoutrin/product-forge/tree/main/plugins/frontend-experts/skills/typescript-style
Command: npx skills add https://github.com/jpoutrin/product-forge --skill typescript-style

SYSTEM DOCUMENTATION & REQUIREMENTS

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.

Frequently Asked Questions about typescript-style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce strict TypeScript and type safety in my React codebase?

Enforce strict TypeScript mode, enable ESLint with type-checked rules, ban the `any` type, require explicit function return types, and use union types and discriminated unions. This prevents type-related bugs and ensures consistent typing across React components and hooks.

What TypeScript patterns should I follow for React components and hooks?

Use typed props interfaces, typed `useState` declarations with explicit generic parameters, and typed event handlers like `React.FormEvent`. Apply PascalCase for component names and types, camelCase for functions and variables, and `is`/`has`/`can`/`should` prefixes for boolean values.

Can I use ESLint to catch TypeScript anti-patterns automatically?

Yes. ESLint with type-checked rules identifies common anti-patterns: implicit `any`, missing return types, loose equality (`==` vs `===`), and unhandled promises. Configure it alongside strict TypeScript mode for automated enforcement across your codebase.

How do I refactor existing JavaScript to strict TypeScript?

Add explicit type annotations to function parameters and return types, replace `any` with concrete types or unions, use `as const` for constant objects, and apply naming conventions for booleans and types. ESLint rules help identify remaining gaps during migration.

What's the difference between enums and union types in TypeScript?

Union types with `as const` are preferred over enums for better tree-shaking, simpler transpilation, and type inference. They provide equivalent type safety while keeping code more maintainable and reducing runtime overhead.

How large should functions be when following strict TypeScript style?

Keep functions concise and focused—ideally under 30 lines. Smaller functions are easier to type accurately, test, and reason about. They naturally encourage explicit return types and reduce cognitive load for type checking.