@tank/typescript

Apply advanced TypeScript patterns for type-safe application development.

1|1|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/tankpkg/skills --skill tank-typescript
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: @tank/typescript
Source: https://github.com/tankpkg/skills/tree/main/skills/typescript
Command: npx skills add https://github.com/tankpkg/skills --skill tank-typescript

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write more reliable and maintainable code by leveraging TypeScript's advanced type system to catch errors at compile time, rather than runtime.

Core Features & Use Cases

  • Compile-time Safety: Enforce invariants and prevent impossible states using advanced types like discriminated unions and branded types.
  • API Design: Create robust, self-documenting APIs that clearly define expected inputs and outputs.
  • Refactoring: Safely migrate JavaScript codebases to TypeScript with clear type definitions and strict configuration.
  • Use Case: Design a state management system where the types guarantee that only valid state transitions can occur, preventing bugs related to unexpected state changes.

Quick Start

Provide a TypeScript code snippet that demonstrates a type-safe API for handling user authentication, including registration and login.

Frequently Asked Questions about @tank/typescript

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

FAQPage Schema
How do I use TypeScript discriminated unions to prevent invalid state transitions?

TypeScript discriminated unions enforce compile-time safety by requiring a shared literal property across variants, ensuring only valid state transitions occur and preventing impossible runtime states.

What is the best way to create type-safe APIs with branded types in TypeScript?

Branded types create type-safe APIs by tagging base types with unique literal properties, allowing the compiler to distinguish structurally identical values and prevent incorrect data assignment.

How do I configure a strict tsconfig for migrating JavaScript to TypeScript?

A strict tsconfig enables options like noImplicitAny and strictNullChecks, enforcing rigorous type checks during JavaScript migration to catch runtime errors at compile time.

When should I use conditional types and mapped types over standard interfaces?

Use conditional and mapped types when you need to dynamically derive new type structures based on existing ones, whereas standard interfaces define static object shapes.

How do template literal types improve type safety for API design?

Template literal types improve API design by enforcing compile-time validation of string patterns, allowing you to define exact string formats and catch invalid concatenations before runtime.

Can I implement type-safe error handling without external dependencies?

Yes, type-safe error handling is implemented purely with advanced TypeScript patterns like discriminated unions, ensuring errors are caught by the compiler without external libraries.