Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
gentleman-programming avatar

Typescript

  • 426 installs
  • 614 repo stars
  • Updated March 28, 2026
  • gentleman-programming/gentleman-skills

typescript is a Claude agent skill that teaches strict TypeScript patterns—const-derived unions, flat interfaces, and generics—for developers who want safer, refactor-friendly type definitions.

About

typescript is version 1.0 of a gentleman-programming/gentleman-skills agent skill licensed Apache-2.0 that codifies strict TypeScript conventions for everyday coding. It triggers when writing types, interfaces, or generics and mandates patterns such as deriving unions from const objects instead of inline string unions, plus flat interface shapes for maintainability. Developers reach for typescript when an agent might emit loose unions, nested interfaces, or ad-hoc typing that breaks autocomplete and refactors. The skill supplies concrete before-and-after TypeScript snippets agents should follow. Use it on greenfield modules or refactors where consistent typing discipline matters across a codebase.

  • typescript
  • Development

Typescript by the numbers

  • 426 all-time installs (skills.sh)
  • Ranked #994 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/gentleman-programming/gentleman-skills --skill typescript

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs426
repo stars614
Last updatedMarch 28, 2026
Repositorygentleman-programming/gentleman-skills

What TypeScript typing patterns prevent brittle union types?

For development and infrastructure management.

Who is it for?

Developers enforcing strict, refactor-safe TypeScript patterns while agents generate or edit type definitions.

Skip if: Teams working only in JavaScript without TypeScript or projects that already enforce equivalent ESLint and compiler rules.

When should I use this skill?

An agent writes or refactors TypeScript types, interfaces, generics, or const-derived status enums.

What you get

Const-derived union types, flat interfaces, and generics aligned with strict TypeScript conventions.

By the numbers

  • Documented as gentleman-skills typescript version 1.0
  • Apache-2.0 licensed TypeScript pattern skill

Files

SKILL.mdMarkdownGitHub ↗

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

Related skills

FAQ

Why does the typescript skill prefer const objects over unions?

The typescript skill requires const objects first, then extracted types, because that pattern gives a single source of truth, runtime values, autocomplete, and easier refactors. Inline string unions lack those benefits in generated code.

When does the typescript skill activate?

The typescript skill activates when writing TypeScript code involving types, interfaces, or generics. gentleman-programming/gentleman-skills version 1.0 documents const-type and flat-interface rules agents must follow.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.