typescript

Enforce explicit TypeScript typings and flat interfaces in code reviews.

Updated Jan 26, 2026
One-click install
npx skills add https://github.com/theofernandezz/ai-library --skill typescript-theofernandezz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/theofernandezz/ai-library/tree/main/.opencode/skills/typescript
Command: npx skills add https://github.com/theofernandezz/ai-library --skill typescript-theofernandezz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Type-safe TypeScript patterns help teams avoid runtime errors and maintainable debt by codifying proven practices. Many projects struggle with vague typings, excessive use of any, and non-flat interfaces that complicate refactors. This skill provides a curated set of rules, examples, and guidelines to standardize TypeScript usage across the codebase.

Core Features & Use Cases

  • Forbid using any and enum patterns to prevent runtime ambiguity and promote explicit typing.
  • Enforce flat interfaces and discriminated unions to simplify reasoning and improve type safety.
  • Promote effective use of utility types, generics with constraints, and null-safety practices to improve robustness.
  • Use as a reference during code reviews, onboarding, and API surface design to align teams.

Quick Start

Audit a new file or a PR to apply TypeScript patterns according to the rules.

Frequently Asked Questions about typescript

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

FAQPage Schema
How do I enforce type-safe TypeScript patterns to avoid runtime errors?

You can enforce type-safe TypeScript patterns by requiring explicit typings, avoiding the any type, and prohibiting enums. Applying flat interfaces and discriminated unions across your codebase prevents runtime ambiguity and maintains code quality.

What is the best way to eliminate any types from a TypeScript codebase?

The best way to eliminate any types is to enforce explicit typing rules and promote utility types with generics constraints. This prevents runtime ambiguity and improves overall type-safety during code reviews and API surface design.

Why should I use discriminated unions instead of enums in TypeScript?

Discriminated unions should be used instead of enums because prohibiting enums prevents runtime ambiguity. Flat interfaces combined with discriminated unions simplify reasoning, improve type safety, and make refactoring significantly easier across your project.

Can I apply these TypeScript lint-style rules to both React and Node projects?

Yes, you can apply these TypeScript lint-style rules to both React and Node projects. The patterns enforce type-safety and code quality across backend and frontend code, including serverless projects, by standardizing utility types and null-safety practices.

How do I audit a pull request for production-grade TypeScript best practices?

You audit a pull request for production-grade TypeScript best practices by checking for explicit typings, avoidance of any, and proper use of generics. Use the rules as a reference during code reviews to align teams on API surface design.

When should I use utility types and generics with constraints in TypeScript?

You should use utility types and generics with constraints in TypeScript to improve robustness and maintainability. Disciplined application of these features, alongside null-safety practices, ensures type-safe development and reduces maintainable debt during refactors.