typescript-best-practices

Enforce strict TypeScript best practices for types, generics, and React props.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mnadalc/dotfiles --skill typescript-best-practices-mnadalc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-best-practices
Source: https://github.com/mnadalc/dotfiles/tree/main/.ai/skills/typescript
Command: npx skills add https://github.com/mnadalc/dotfiles --skill typescript-best-practices-mnadalc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces strict, high-quality TypeScript coding standards, preventing common pitfalls and improving code maintainability and robustness.

Core Features & Use Cases

  • Type Safety: Enforces strict typing rules to eliminate any and undefined errors.
  • Code Quality: Provides guidelines for modern TypeScript patterns, generics, and React typing.
  • Configuration: Offers best practices for tsconfig.json and environment variable validation.
  • Use Case: When writing new TypeScript features or reviewing existing code, use this Skill to ensure adherence to best practices for types, interfaces, and component props.

Quick Start

Apply the typescript-best-practices skill to review the provided TypeScript code for strictness and quality.

Frequently Asked Questions about typescript-best-practices

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

FAQPage Schema
How do I eliminate `any` and enforce strict type safety in TypeScript?

To enforce strict type safety, you must eliminate `any` by applying strict TypeScript typing rules, focusing on proper type design, interfaces, and robust runtime validation at system boundaries. This prevents common pitfalls and undefined errors.

What are the best practices for typing React component props in TypeScript?

Typing React component props requires defining explicit interfaces for props, ensuring proper JSX typing, and avoiding generic `any` types. Applying TypeScript best practices guarantees that React components adhere to strict type safety and modern patterns.

How do I configure tsconfig.json for optimal TypeScript code quality?

Configuring tsconfig.json for optimal code quality involves enabling strict TypeScript settings, validating environment variables, and applying best practices for application code. This configuration enforces high-quality standards and improves code maintainability.

When should I use generics in TypeScript to improve code quality?

You should use generics in TypeScript when designing reusable components and functions to maintain strict type safety without relying on `any`. Effective use of generics is a modern TypeScript pattern that significantly improves code quality and robustness.

Does this TypeScript best practices guidance cover runtime validation at system boundaries?

Yes, this TypeScript best practices guidance explicitly addresses robust runtime validation at system boundaries. It ensures that external data entering your application is strictly validated, complementing compile-time type safety to prevent runtime errors.

Why does my TypeScript code fail strict type checks despite having interfaces?

TypeScript code can fail strict type checks if interfaces are poorly designed, `any` is used, or tsconfig.json lacks strict settings. Reviewing your code against strict TypeScript best practices helps identify type design issues and performance considerations.