typescript-best-practices

Enforce explicit typings and modular structure in TypeScript code.

Updated Jun 17, 2025
One-click install
npx skills add https://github.com/kristijorgji/react_ts_vite_tailwind_sb --skill typescript-best-practices-kristijorgji
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-best-practices
Source: https://github.com/kristijorgji/react_ts_vite_tailwind_sb/tree/main/.agents/skills/typescript-best-practices
Command: npx skills add https://github.com/kristijorgji/react_ts_vite_tailwind_sb --skill typescript-best-practices-kristijorgji

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TypeScript Best Practices provides a disciplined approach to writing, reviewing, and refactoring TypeScript code to improve type safety, reuse, and maintainability.

Core Features & Use Cases

  • Enforce explicit typings across parameters, return values, props, and state.
  • Promote code reuse by centralizing shared types and utilities in src/c/types, src/c/hooks, and src/c/utils.
  • Encourage safe import practices, including type-only imports and consistent path aliases.

Quick Start

Audit your TypeScript codebase against these guidelines and start applying explicit types, modular structure, and consistent imports to improve safety and maintainability.

Frequently Asked Questions about typescript-best-practices

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

FAQPage Schema
How do I enforce explicit TypeScript types and avoid using any in my codebase?

To enforce explicit TypeScript types, apply explicit typings to parameters, return values, props, and state while strictly avoiding the any type. This discipline ensures type safety and improves overall code maintainability across components, hooks, and utilities.

What is the best way to organize shared TypeScript types and utilities for reuse?

The best way to organize shared TypeScript types is to centralize them in dedicated directories like src/c/types, src/c/hooks, and src/c/utils. This modular structure promotes code reuse and maintainability across your entire project.

How do I use type-only imports and path aliases when refactoring TypeScript code?

Refactoring TypeScript code requires using type-only imports and consistent path aliases to ensure safe import practices. This approach enhances modularity and enforces strict type safety throughout your components and shared utilities.

Does enforcing explicit return types improve type safety in TypeScript components?

Enforcing explicit return types directly improves TypeScript type safety by clearly defining function outputs across components, hooks, and utilities. This practice eliminates ambiguous return values and ensures strict adherence to your coding standards.

Can I audit my existing TypeScript codebase against these best practices for refactoring?

You can audit your existing TypeScript codebase against these best practices to identify areas needing explicit types, modular structure, and consistent imports. This refactoring process improves type safety, reuse, and overall maintainability.

Why should I apply linting and formatting rules alongside TypeScript type safety standards?

Applying linting and formatting rules alongside TypeScript type safety standards ensures consistent code quality and explicit typings across your project. This combination enforces coding standards and prevents type-related errors during development.