ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified developer tools Safety 5/5

TypeScript

Write type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices.

Why use this skill?

Enhance your OpenClaw agent with professional TypeScript expertise. Master type narrowing, generics, strict mode, and best practices for robust, error-free code.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/ivangdavila/typescript
Or

What This Skill Does

The TypeScript skill provides OpenClaw with the capability to generate, debug, and enforce industrial-grade TypeScript code. It focuses on the principles of type safety, moving away from dangerous patterns like the any type in favor of unknown and robust type narrowing. This skill ensures that your codebase adheres to strict mode, utilizes advanced inference patterns, and maintains proper module boundaries through type-only imports and accurate declaration files.

Installation

To integrate this skill into your environment, run the following command in your terminal: clawhub install openclaw/skills/skills/ivangdavila/typescript

Use Cases

  • Legacy Migration: Transforming untyped JavaScript projects to strictly-typed TypeScript without losing functionality.
  • Complex State Management: Designing discriminated unions to model state transitions accurately.
  • API Integration: Defining interfaces for external JSON responses and using type predicates to narrow them safely.
  • Configuration Management: Utilizing the satisfies operator to validate configuration objects while preserving literal type information for improved IDE autocompletion.
  • Library Authoring: Creating high-quality declaration files (.d.ts) that offer excellent developer experience for consumers.

Example Prompts

  1. "Refactor this function to use discriminated unions instead of checking multiple optional properties; please ensure the switch statement is exhaustive."
  2. "I am getting an 'any' type error with this API response. Can you show me how to use 'unknown' and a type guard to narrow this safely?"
  3. "Convert this config object to use the 'satisfies' operator so I keep the literal types for my CSS classes but still ensure it matches the Config interface."

Tips & Limitations

  • Avoid 'any': Always treat 'any' as a failure. When unsure, 'unknown' is your best friend.
  • Literal Traps: Remember that object properties widen to their base type; always use 'as const' when you need to preserve specific string or number values.
  • Narrowing: Standard tools like filter(Boolean) do not narrow types effectively. Always provide a type predicate (x is T) to maintain safety during array operations.
  • Module Boundaries: Always use import type when bringing in interfaces or types. This helps your bundler prune unused code and prevents runtime import issues.
  • Strictness: Keep 'strict' mode enabled in your tsconfig. If you encounter a complex generic that the compiler cannot infer, don't force it with a type assertion; break the logic into smaller, more granular steps where the compiler can see the flow clearly.

Metadata

Stars2102
Views0
Updated2026-03-06
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-ivangdavila-typescript": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags(AI)

#typescript#type-safety#coding#refactoring#software-engineering
Safety Score: 5/5

Flags: code-execution