TypeScript Best Practices

Enforce idiomatic TypeScript patterns for classes, functions, modules, and async logic.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/ntluong95/agent-skills-statistics --skill typescript-best-practices-ntluong95
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: TypeScript Best Practices
Source: https://github.com/ntluong95/agent-skills-statistics/tree/main/.github/skills/typescript/best-practices
Command: npx skills add https://github.com/ntluong95/agent-skills-statistics --skill typescript-best-practices-ntluong95

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces idiomatic TypeScript patterns, ensuring code is clean, maintainable, and robust, preventing common pitfalls and improving developer productivity.

Core Features & Use Cases

  • Enforces Naming Conventions: Guides consistent naming for classes, variables, functions, and constants.
  • Optimizes Async/Await: Promotes the correct use of async/await and Promise.all for efficient asynchronous operations.
  • Ensures Type Safety: Guides the use of explicit types, never for exhaustiveness, and asserts for runtime checks, strictly prohibiting the use of any.
  • Use Case: Refactor an existing JavaScript codebase to TypeScript, ensuring all new modules adhere to best practices for structure, typing, and async operations.

Quick Start

Apply TypeScript best practices to the provided code snippet.

Frequently Asked Questions about TypeScript Best Practices

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

FAQPage Schema
How do I refactor JavaScript code to TypeScript with strict typing and no any types?

To refactor JavaScript to TypeScript, enforce strict typing by prohibiting the `any` type, using explicit types, and applying `never` for exhaustiveness checks to ensure robust, maintainable code.

What's the best way to handle asynchronous operations in TypeScript modules?

The best way to handle asynchronous operations in TypeScript is by using `async/await` syntax and implementing `Promise.all` for efficient, concurrent execution within your modules.

How do I enforce naming conventions for TypeScript classes and functions?

Enforce naming conventions for TypeScript classes, variables, functions, and constants by applying idiomatic patterns that guide consistent naming structures across your entire codebase.

When do I need to use asserts and never for type checking in TypeScript?

Use `asserts` for runtime type checks and `never` for exhaustiveness checking in TypeScript to ensure strict type safety and prevent unhandled states in your logic.

Can I use TypeScript best practices for organizing clear module structures?

Yes, you can apply TypeScript best practices to establish clear module organization, ensuring your classes, functions, and asynchronous logic adhere to idiomatic patterns for maintainability.