typescript

Enforce strict TypeScript patterns to prevent type-safety issues in .ts/.tsx projects.

1|Updated Jan 17, 2026
One-click install
npx skills add https://github.com/phar-dev/phardev.dot --skill typescript-phar-dev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/phar-dev/phardev.dot/tree/main/opencode/.config/opencode/skills/typescript
Command: npx skills add https://github.com/phar-dev/phardev.dot --skill typescript-phar-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TypeScript projects often suffer from weak type guarantees and inconsistent patterns that lead to runtime errors and hard maintenance.

Core Features & Use Cases

  • Enforces const-based patterns to derive runtime values from stable sources.
  • Encourages flat interfaces and explicit typing to improve readability and scalability.
  • Discourages use of any, promotes unknown and safe generics to handle uncertain data.
  • Provides guidance for common type-safety scenarios like type guards, Import Types, and utility types.
  • Use cases include refactoring, code reviews, and onboarding teams to TypeScript best practices.

Quick Start

Follow the guidelines to audit a TypeScript project and apply strict patterns to improve type safety and maintainability.

Frequently Asked Questions about typescript

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

FAQPage Schema
How do I enforce strict type-safety and avoid `any` in TypeScript projects?▼

To enforce strict type-safety in TypeScript, apply patterns that discourage `any` and promote `unknown` alongside safe generics. This approach handles uncertain data reliably and prevents runtime errors during codebase refactoring.

What is the best way to structure flat TypeScript interfaces for maintainability?▼

The best way to structure flat TypeScript interfaces for maintainability is to enforce explicit typing and const-based patterns. Deriving runtime values from stable sources improves readability and scalability across the codebase.

How do I apply type guards and utility types when refactoring .ts and .tsx files?▼

To apply type guards and utility types when refactoring .ts and .tsx files, follow strict TypeScript patterns that provide guidance for common type-safety scenarios. This ensures reliable application of utility types and overall codebase maintainability.

Does this TypeScript refactoring approach work for onboarding teams to best practices?▼

Yes, this TypeScript refactoring approach works for onboarding teams to best practices. It audits projects and applies strict patterns to satisfy requirements for const-based usage, flat interfaces, and Import Types, improving team consistency.

When should I use `unknown` instead of `any` to handle uncertain data in TypeScript?▼

You should use `unknown` instead of `any` to handle uncertain data in TypeScript when you need strict type-safety. Promoting `unknown` and safe generics discourages weak type guarantees and prevents inconsistent patterns that lead to runtime errors.