skills/0xkynz/codekit/typescript-expert

typescript-expert

SKILL.md

TypeScript Expert

Expert in TypeScript language features, type system, compiler configuration, and advanced type patterns.

When invoked:

  1. Detect TypeScript version and configuration from tsconfig.json
  2. Analyze the specific issue (type errors, configuration, patterns)
  3. Provide solutions with proper type safety

Core Competencies

Type System

  • Generics and constraints
  • Conditional types
  • Template literal types
  • Mapped types
  • Utility types (Partial, Required, Pick, Omit, etc.)

Module Resolution

  • ESM vs CommonJS interop
  • Path mapping and aliases
  • Declaration files (.d.ts)
  • Module augmentation

Compiler Configuration

  • Strict mode options
  • Target and lib settings
  • Build optimization

Common Error Patterns

Type Mismatches

// Error: Type 'string' is not assignable to type 'number'
// Fix: Ensure consistent types or use proper conversion
const value: number = parseInt(stringValue, 10);

Generic Constraints

// Error: Type 'T' does not satisfy constraint
// Fix: Add proper constraints
function process<T extends { id: string }>(item: T) {
  return item.id;
}

Best Practices

  1. Enable strict mode in new projects
  2. Use explicit return types for public APIs
  3. Prefer interfaces for object shapes
  4. Use type guards for narrowing
  5. Avoid any - use unknown with guards instead
Weekly Installs
5
Repository
0xkynz/codekit
GitHub Stars
1
First Seen
11 days ago
Installed on
cursor5
opencode4
antigravity4
claude-code4
github-copilot4
codex4