TY

Provides standard best practices for TypeScript, including const-type patterns, flat interfaces, and avoiding 'any'.

Install

mkdir -p .claude/skills/typescript-jordy756 && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10298" && unzip -o skill.zip -d .claude/skills/typescript-jordy756 && rm skill.zip

Installs to .claude/skills/typescript-jordy756

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

TypeScript strict patterns and best practices. Trigger: When writing TypeScript code - types, interfaces, generics.
115 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Enforce strict typing
  • Promote flat interfaces
  • Use unknown for unknown types
  • Apply utility types

How it works

It enforces patterns like const types and flat interfaces to ensure type safety.

Inputs & outputs

You give it
Loose TypeScript code
You get back
Strict, type-safe code

When to use typescript

  • Standardizing TypeScript codebases
  • Defining type-safe object patterns
  • Migrating from loose types to strict interfaces

About this skill

Const Types Pattern (REQUIRED)

// ✅ ALWAYS: Create const object first, then extract type
const STATUS = {
  ACTIVE: "active",
  INACTIVE: "inactive",
  PENDING: "pending",
} as const;

type Status = (typeof STATUS)[keyof typeof STATUS];

// ❌ NEVER: Direct union types
type Status = "active" | "inactive" | "pending";

Why? Single source of truth, runtime values, autocomplete, easier refactoring.

Flat Interfaces (REQUIRED)

// ✅ ALWAYS: One level depth, nested objects → dedicated interface
interface UserAddress {
  street: string;
  city: string;
}

interface User {
  id: string;
  name: string;
  address: UserAddress;  // Reference, not inline
}

interface Admin extends User {
  permissions: string[];
}

// ❌ NEVER: Inline nested objects
interface User {
  address: { street: string; city: string };  // NO!
}

Never Use any

// ✅ Use unknown for truly unknown types
function parse(input: unknown): User {
  if (isUser(input)) return input;
  throw new Error("Invalid input");
}

// ✅ Use generics for flexible types
function first<T>(arr: T[]): T | undefined {
  return arr[0];
}

// ❌ NEVER
function parse(input: any): any { }

Utility Types

Pick<User, "id" | "name">     // Select fields
Omit<User, "id">              // Exclude fields
Partial<User>                 // All optional
Required<User>                // All required
Readonly<User>                // All readonly
Record<string, User>          // Object type
Extract<Union, "a" | "b">     // Extract from union
Exclude<Union, "a">           // Exclude from union
NonNullable<T | null>         // Remove null/undefined
ReturnType<typeof fn>         // Function return type
Parameters<typeof fn>         // Function params tuple

Type Guards

function isUser(value: unknown): value is User {
  return (
    typeof value === "object" &&
    value !== null &&
    "id" in value &&
    "name" in value
  );
}

Import Types

import type { User } from "./types";
import { createUser, type Config } from "./utils";

Keywords

typescript, ts, types, interfaces, generics, strict mode, utility types

When not to use it

  • Loose typing requirements

Prerequisites

TypeScript

Limitations

  • Never use any
  • No inline nested objects

How it compares

It mandates strict patterns instead of allowing loose or 'any' types.

Compared to similar skills

typescript side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
typescript (this skill)04moNo flagsIntermediate
typescript-write302moReviewAdvanced
zustand1132moNo flagsIntermediate
dependency-upgrade265moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

typescript-write

metabase

Write TypeScript and JavaScript code following Metabase coding standards and best practices. Use when developing or refactoring TypeScript/JavaScript code.

30114

zustand

lobehub

Zustand state management guide. Use when working with store code (src/store/**), implementing actions, managing state, or creating slices. Triggers on Zustand store development, state management questions, or action implementation.

113434

dependency-upgrade

wshobson

Manage major dependency version upgrades with compatibility analysis, staged rollout, and comprehensive testing. Use when upgrading framework versions, updating major dependencies, or managing breaking changes in libraries.

26240

turborepo

vercel

Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.

61191

vitest

antfu

Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.

41183

typescript-review

metabase

Review TypeScript and JavaScript code changes for compliance with Metabase coding standards, style violations, and code quality issues. Use when reviewing pull requests or diffs containing TypeScript/JavaScript code.

39178

Search skills

Search the agent skills registry