Skip to content

TypeScript strict-mode patterns that replace unions, nested inline types, and any with const-derived types and guards.

CCM score
63 of 100
skills.sh installs
255
GitHub stars
15.3K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers const-object type extraction, flat interfaces, utility types, type guards, and discriminated unions for coupled optional props
  • Includes unknown over any guidance, a Record<Union, ...> pattern for known key sets, and import type usage
  • Enforces pnpm run typecheck (tsc, TypeScript 5.5 strict) as the validation step for the ui package
  • Designed for implementing or refactoring .ts/.tsx code where type safety must be tightened

Install

$ npx -y skills add prowler-cloud/prowler --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.

When you need the ordered list too (iteration, z.enum), a const array works the same way:

// ui/types/severities.ts
export const SEVERITY_LEVELS = ["critical", "high", "medium", "low", "informational"] as const;
export type SeverityLevel = (typeof SEVERITY_LEVELS)[number];

// Known key set -> Record<Union, ...> (typos fail to compile)
export const SEVERITY_DISPLAY_NAMES: Record<SeverityLevel, string> = { /* ... */ };

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
}

Details

Repository
github.com/prowler-cloud/prowler
Categories
Frontend & UI Code, Code Review & Quality
First seen
Jun 3, 2026

Questions

What does the typescript skill for Claude Code do?

The typescript skill gives Claude Code strict TypeScript patterns for .ts and .tsx files, covering types, interfaces, generics, const maps, type guards, removing any, and tightening unknown. It guides Claude to write type-safe code when implementing or refactoring TypeScript.

How do I install the typescript skill?

Run npx -y skills add prowler-cloud/prowler --skill typescript -y in your project to install the typescript skill. Once installed, the typescript skill applies its strict typing rules whenever Claude works on TypeScript files.

Where does the typescript skill stand in the Frontend and UI Code category?

The typescript skill is listed in the Frontend and UI Code category next to vercel-react-best-practices, web-design-guidelines, design-taste-frontend, vercel-composition-patterns, and lark-apps. Its focus is type discipline in TypeScript itself rather than visual design or component layout.

Does the typescript skill need any accounts, keys or extra tools?

The typescript skill's SKILL.md lists allowed tools such as Read, Edit, Write, Glob, Grep, Bash, WebFetch, WebSearch and Task. Its validation step runs pnpm run typecheck in the ui folder with TypeScript 5.5 in strict mode.

More from prowler-cloud/prowler

All 6

Similar to Typescript

More Frontend & UI Code