typescript

Enforce TypeScript best practices and strict typing across projects.

Updated Apr 9, 2025
One-click install
npx skills add https://github.com/D4nitrix13/dotfiles-tmp --skill typescript-d4nitrix13
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/D4nitrix13/dotfiles-tmp/tree/main/.config/opencode/skill/typescript
Command: npx skills add https://github.com/D4nitrix13/dotfiles-tmp --skill typescript-d4nitrix13

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TypeScript codebases often suffer from weak typing, scattered interfaces, and inconsistent patterns that lead to bugs and maintenance headaches. This Skill provides a strict set of patterns and conventions to enforce safer, more maintainable TypeScript code.

Core Features & Use Cases

  • Consistent type definitions using const assertions for runtime values and compile-time types.
  • Flat, reusable interfaces with clear inheritance and references rather than inline types.
  • Avoidance of the any type and guided use of utility types like Pick, Omit, Partial, and Required.
  • Practical examples for common scenarios: enums via const objects, type guards, and safe generics.

Quick Start

Configure your project to adopt const-based patterns, flat interfaces, and safe utility types to write safer TypeScript code.

Frequently Asked Questions about typescript

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

FAQPage Schema
How do I enforce strict typing in TypeScript to avoid using the any type?

To enforce strict typing in TypeScript, adopt patterns that avoid the any type and apply utility types like Pick, Omit, Partial, and Required for safer type definitions.

What is the best way to structure flat interfaces for maintainable TypeScript code?

The best way to structure flat interfaces is to define clear inheritance and references rather than inline types, ensuring your TypeScript codebase remains maintainable and consistent.

How do I use const assertions for runtime values and compile-time types in TypeScript?

Use const assertions in TypeScript to create consistent type definitions for runtime values and compile-time types, replacing enums with const objects for safer runtime behavior.

When do I need safe generics and type guards in a TypeScript codebase?

You need safe generics and type guards in TypeScript when your codebase requires robust typing and maintainable interfaces to prevent bugs and reduce maintenance headaches.

Does this strict TypeScript pattern work for existing codebases with scattered interfaces?

Yes, this pattern applies to codebases written in TypeScript where robust typing is required, guiding you to refactor scattered interfaces into flat, reusable definitions.

Why should I use utility types like Pick and Omit instead of inline type definitions?

You should use utility types like Pick and Omit instead of inline definitions to enforce consistent type patterns, avoid weak typing, and maintain safer TypeScript code.