Skip to content
Development
Command

/typescript-patterns

TypeScript best practices and patterns. Use when writing TypeScript, fixing type errors, or working with generics.

From plugin
gsd-skill-creator
7126 skills61 agents26 commands1 MCP
$ npx -y skills add Tibsfox/gsd-skill-creator --agent claude-code

Command definition

typescript-patterns.md
name: typescript-patterns
description: TypeScript best practices and patterns. Use when writing TypeScript, fixing type errors, or working with generics.

TypeScript Patterns

Type vs Interface

| Use Case | Prefer | |----------|--------| | Object shape | interface | | Union types | type | | Extending shapes | interface | | Intersection | type | | Tuple/primitives | type |

Key Patterns

**Discriminated Unions** — model state with tagged types:

type Result<T> = { ok: true; value: T } | { ok: false; error: Error };

**Type Guards** — narrow at runtime:

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

**Generic Constraints:**

function getProperty<T, K extends keyof T>(obj: T, key: K): T[K] { return obj[key]; }

Utility Types

| Type | Purpose | |------|---------| | Partial\<T\> | All optional | | Required\<T\> | All required | | Pick\<T,K\> | Select properties | | Omit\<T,K\> | Remove properties | | Record\<K,V\> | Key-value map | | ReturnType\<T\> | Function return type |

Avoid

  • `any` — use `unknown` and narrow
  • Type assertions (`as`) — use type guards
  • `!` operator — handle null properly
  • Missing return types on complex functions
@tibsfox
Ships withgsd-skill-creator

An adaptive learning and coprocessor architecture for Claude Code, built as an extension to GSD (open-gsd)

71102 skills61 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
71
Star history of Tibsfox/gsd-skill-creator on GitHub, a chart by star-history.com

Other commands on gsd-skill-creator.

env-setup

env-setup

Command

Environment configuration and secrets management. Use when setting up .env files, managing secrets, or configuring environments.

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command