retrofitting-types

Add type safety incrementally to untyped JavaScript codebases.

1|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/baphled/dotopencode --skill retrofitting-types
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: retrofitting-types
Source: https://github.com/baphled/dotopencode/tree/main/skills/retrofitting-types
Command: npx skills add https://github.com/baphled/dotopencode --skill retrofitting-types

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of introducing type safety into existing JavaScript or other untyped codebases by providing a structured, incremental approach that enhances code quality without necessitating a complete rewrite.

Core Features & Use Cases

  • Incremental Typing: Focuses on adding types at module boundaries first for immediate benefit.
  • Strictness Goal: Guides users to start with permissive configurations and gradually enable stricter TypeScript rules.
  • TypeScript Migration Path: Provides a step-by-step process for migrating JavaScript projects to TypeScript, including enabling allowJs and checkJs, using @ts-check, and gradually renaming files.
  • Type Definitions for 3rd-Party JS: Assists in creating custom .d.ts files for libraries lacking type definitions.

Quick Start

Use the retrofitting-types skill to add types to the untyped JavaScript file 'utils.js'.

Frequently Asked Questions about retrofitting-types

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I gradually add TypeScript types to an existing JavaScript codebase?▼

Gradually add TypeScript types by enabling allowJs and checkJs, using @ts-check in files, and adding types at module boundaries first for immediate code quality benefits.

What is the best way to migrate legacy JavaScript to TypeScript without a complete rewrite?▼

Migrate legacy JavaScript to TypeScript incrementally by prioritizing boundary typing and using permissive configurations, gradually enabling stricter rules to enhance maintainability without rewriting.

Why should I use unknown instead of any when retrofitting types?▼

Use unknown instead of any when retrofitting types to improve error detection and enforce type safety checks, preventing untyped variables from bypassing the compiler.

How do I add type definitions for third-party JavaScript libraries lacking types?▼

Add type definitions for untyped third-party JavaScript libraries by creating custom .d.ts files, allowing your TypeScript migration to recognize their APIs and improve code readability.

Can I start with permissive TypeScript configurations and enable strictness later?▼

You can start with permissive TypeScript configurations and gradually enable strictness rules, following an incremental approach to enhance code quality and maintainability over time.

When do I need to add type definitions at module boundaries during a TypeScript migration?▼

Add type definitions at module boundaries during a TypeScript migration to secure immediate type safety benefits across untyped APIs before typing internal logic.