typescript

Enforce strict TypeScript patterns for types, interfaces, and generics.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/zeshone/zesh-one-skills --skill typescript-zeshone
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/zeshone/zesh-one-skills/tree/main/skills/frontend/typescript
Command: npx skills add https://github.com/zeshone/zesh-one-skills --skill typescript-zeshone

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TypeScript strict patterns and best practices help teams improve type safety, maintainability, and refactorability by enforcing clear conventions for types, interfaces, and generics.

Core Features & Use Cases

  • Const Types Pattern: enforce a single source of truth for string literals by creating a const object and deriving a type from it.
  • Flat Interfaces: prefer one-level deep interfaces with dedicated nested interfaces to improve readability.
  • Never Use any: promote unknown and type guards to safely narrow types.
  • Utility Types: use Pick, Omit, Partial, Required, and Readonly to derive types from existing ones.
  • Type Guards & Import Types: show runtime checks and type-only imports to keep runtime bundles clean.

Quick Start

Start by applying the const types pattern in any new TS module to ensure runtime values have a single source of truth.

Frequently Asked Questions about typescript

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

FAQPage Schema
How do I enforce strict TypeScript patterns for type safety and best practices?

You enforce strict TypeScript patterns by applying const types for single-source string literals, flat interfaces for readability, and utility types like Pick and Omit to derive safe types across your codebase.

What is the best way to handle unknown values in TypeScript without using any?

The best way to handle unknown values is to replace any with the unknown type and apply type guards, allowing you to safely narrow types at runtime while maintaining strict type safety.

How do I structure TypeScript interfaces to improve code maintainability?

To improve code maintainability, structure TypeScript interfaces to be flat with a maximum depth of one level, creating dedicated nested interfaces for complex objects to ensure better readability and refactorability.

When should I use utility types like Pick, Omit, and Readonly in TypeScript?

Use TypeScript utility types like Pick, Omit, Partial, and Readonly when you need to derive new type definitions from existing ones, ensuring your code remains strictly typed without duplicating type structures.

How do I keep my runtime bundle clean when importing types in TypeScript?

To keep your runtime bundle clean, use TypeScript type-only imports for type definitions so that the compiler strips them out during compilation, preventing unnecessary type logic from affecting the final bundle.

Does applying a const types pattern work for both frontend and backend TypeScript modules?

Yes, the const types pattern works for both frontend and backend TypeScript modules, creating a single source of truth for runtime values that ensures type safety across diverse application environments.