typescript

Enforce TypeScript strict patterns and best practices in .ts and .tsx codebases.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/mfang0126/language-arts --skill typescript-mfang0126
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/mfang0126/language-arts/tree/main/.opencode/skills/typescript
Command: npx skills add https://github.com/mfang0126/language-arts --skill typescript-mfang0126

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach to writing TypeScript by enforcing strict constant patterns, clean interfaces, proper use of unknown, and safe generic usage. It helps teams reduce runtime errors and improve maintainability by standardizing type patterns across projects.

Core Features & Use Cases

  • Const Types Pattern: Encourage defining a single runtime constant collection and deriving types from it for safe enums and mappings.
  • Flat Interfaces: Promote one-level deep interfaces with clear separation of data shapes and avoid inline nested objects.
  • Never Use any & Type Safety: Favor unknown and generics to preserve type safety while enabling flexible APIs.
  • Utility Types: Use Pick, Omit, Partial, Required, Readonly, and other utility types for concise, expressive type definitions.
  • Use Case: Teams refactor a TS codebase to enforce consistent types and prevent accidental use of any across modules.

Quick Start

  • Add a sample TypeScript file and implement the Const Types Pattern as shown in this skill.
  • Refactor interfaces to a flat structure and replace nested/object types with separate interfaces.
  • Replace any with unknown and demonstrate a generic function example.

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 during codebase refactoring?

To enforce strict TypeScript patterns during refactoring, apply const-based constant collections, derive types from them, use flat one-level interfaces, and replace any with unknown. This standardizes type safety and reduces runtime errors across .ts and .tsx modules.

What is the best way to handle unknown types instead of any in TypeScript?

Handling unknown types instead of any in TypeScript involves favoring unknown for flexible APIs and using generics. This preserves type safety while allowing dynamic data handling without bypassing the compiler's strict type checks.

How do I structure clean TypeScript interfaces for complex data shapes?

Structuring clean TypeScript interfaces requires keeping them flat at one level deep. Separate nested inline objects into distinct interfaces to clearly define data shapes, which improves maintainability and prevents accidental type mismatches.

Can I use this to refactor .tsx files or does it only support standard TypeScript?

You can use this to refactor .tsx files as well as standard TypeScript files. It targets both .ts and .tsx codebases to enforce strict type patterns, safe generic usage, and proper unknown handling during feature development.

Do I need a specific TypeScript toolchain setup to enforce these code quality patterns?

You need a standard TypeScript toolchain setup including Node.js, npm or yarn, and TypeScript installed in your project. This environment is required to validate and apply the strict type rules and best practices.

Why should I use utility types like Pick and Omit instead of custom TypeScript interfaces?

Using utility types like Pick, Omit, Partial, and Readonly instead of custom interfaces provides concise and expressive type definitions. They enable safe type derivations from existing shapes, reducing boilerplate and preventing type duplication errors.