Advanced TypeScript patterns for type-safe, maintainable code using sophisticated type system features. Use when building type-safe APIs, implementing complex domain models, or leveraging TypeScript's advanced type capabilities.
Provides expert guidance on TypeScript's advanced type system features for building type-safe APIs, complex domain models, and robust applications. Use when implementing discriminated unions, conditional types, branded types, or type guards to enforce business rules at compile-time.
/plugin marketplace add NickCrew/claude-ctx-plugin/plugin install nickcrew-claude-ctx@NickCrew/claude-ctx-pluginThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/advanced-generics.mdreferences/branded-types.mdreferences/builder-pattern.mdreferences/common-pitfalls.mdreferences/conditional-types.mdreferences/decorators.mdreferences/discriminated-unions.mdreferences/mapped-types.mdreferences/performance-best-practices.mdreferences/template-literal-types.mdreferences/testing-types.mdreferences/type-guards.mdreferences/type-inference.mdreferences/utility-types.mdExpert guidance for leveraging TypeScript's advanced type system features to build robust, type-safe applications with sophisticated type inference, compile-time guarantees, and maintainable domain models.
TypeScript's type system enables compile-time safety through:
value is Type)Load detailed references on-demand:
| Topic | Reference File |
|---|---|
| Conditional Types | skills/typescript-advanced-patterns/references/conditional-types.md |
| Mapped Types | skills/typescript-advanced-patterns/references/mapped-types.md |
| Template Literal Types | skills/typescript-advanced-patterns/references/template-literal-types.md |
| Type Guards | skills/typescript-advanced-patterns/references/type-guards.md |
| Discriminated Unions | skills/typescript-advanced-patterns/references/discriminated-unions.md |
| Branded Types | skills/typescript-advanced-patterns/references/branded-types.md |
| Builder Pattern | skills/typescript-advanced-patterns/references/builder-pattern.md |
| Advanced Generics | skills/typescript-advanced-patterns/references/advanced-generics.md |
| Utility Types | skills/typescript-advanced-patterns/references/utility-types.md |
| Type Inference | skills/typescript-advanced-patterns/references/type-inference.md |
| Decorators | skills/typescript-advanced-patterns/references/decorators.md |
| Performance Best Practices | skills/typescript-advanced-patterns/references/performance-best-practices.md |
| Common Pitfalls | skills/typescript-advanced-patterns/references/common-pitfalls.md |
| Testing Types | skills/typescript-advanced-patterns/references/testing-types.md |
tsconfig.json with "strict": true)Using any instead of unknown: Loses all type safety
unknown and type guards insteadType assertions without validation: Unsafe runtime behavior
value is Type) over as TypeOverusing generics: Unnecessary complexity
Deep type nesting: Slow compilation, hard to debug
Forgetting readonly: Accidental mutations
readonlyNot enabling strict mode: Missing null checks and type errors
"strict": true in tsconfig.jsonMixing type and interface incorrectly: Confusing semantics
type for unions/utilities, interface for object shapestype UserId = string & { readonly __brand: 'UserId' };
function createUserId(id: string): UserId { return id as UserId; }
type State =
| { status: 'loading' }
| { status: 'success'; data: string }
| { status: 'error'; error: Error };
type Readonly<T> = { readonly [P in keyof T]: T[P] };
type Partial<T> = { [P in keyof T]?: T[P] };
function isString(value: unknown): value is string {
return typeof value === 'string';
}
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.