Skip to content

Strict TypeScript patterns for const-derived types, flat interfaces, type guards, and utility types.

CCM score
54 of 100
skills.sh installs
505
GitHub stars
681
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers const-object-derived union types, flat interface design, and rules for avoiding any in favor of unknown and generics
  • Includes a reference table of utility types (Pick, Omit, Partial, Record, ReturnType, and others) with usage notes
  • Enforces that nested objects get dedicated interfaces rather than inline definitions, and that types are imported with import type
  • Designed for writing new TypeScript code involving types, interfaces, and generics under strict mode

Install

$ npx -y skills add gentleman-programming/gentleman-skills --skill typescript -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

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];
}

Details

Repository
github.com/gentleman-programming/gentleman-skills
Category
Frontend & UI Code
First seen
Jun 3, 2026

Questions

What does the typescript skill do for an AI agent?

The typescript skill teaches an AI agent strict TypeScript patterns and best practices when it writes types, interfaces and generics. It covers const object types, flat interfaces, avoiding any in favor of unknown and generics, utility types, type guards and type-only imports.

How do I install the typescript skill?

Run npx -y skills add gentleman-programming/gentleman-skills --skill typescript -y inside your project. After that, the typescript skill guides the agent to write TypeScript code with strict typing.

Where does the typescript skill rank in Frontend & UI Code on Claude Marketplaces?

The typescript skill is listed under Frontend & UI Code on Claude Marketplaces, next to vercel-react-best-practices, web-design-guidelines, design-taste-frontend, vercel-composition-patterns and lark-apps. It stands apart by focusing on TypeScript typing rules rather than UI design or React-specific guidance.

Does the typescript skill need an API key or extra tools?

The typescript skill is a set of instructions in a SKILL.md file and needs no API key or extra service. It is installed with the skills CLI and then applies to TypeScript code the agent writes.

More from gentleman-programming/gentleman-skills

All 13

Similar to Typescript

More Frontend & UI Code