type-safety

Enforce strict type safety in TypeScript and Python code.

2|2|Updated Feb 9, 2017
One-click install
npx skills add https://github.com/sumik5/dotfiles --skill type-safety
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-safety
Source: https://github.com/sumik5/dotfiles/tree/main/claude-code/skills/type-safety
Command: npx skills add https://github.com/sumik5/dotfiles --skill type-safety

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces strict type safety in TypeScript/JavaScript and Python projects, preventing common runtime errors caused by incorrect data types. It eliminates the use of any/Any types, promotes explicit type definitions, and guides the implementation of robust type-checking mechanisms, saving debugging time and improving code reliability.

Core Features & Use Cases

  • any/Any Type Prohibition: Strictly forbids the use of any in TypeScript and Any in Python, pushing for explicit and precise type definitions.
  • Strict Mode & Type Hinting: Guides the configuration of TypeScript's strict mode and the thorough application of type hints in Python.
  • Type Guard Implementation: Provides patterns and best practices for safely narrowing down unknown or ambiguous types using type guards.
  • Use Case: When refactoring a legacy JavaScript codebase to TypeScript, this Skill ensures that all new or modified code adheres to strict type safety rules, preventing regressions and making the code easier to maintain.

Quick Start

Review the provided Python code for type safety, ensuring no Any types are used and all functions have explicit type hints.

Frequently Asked Questions about type-safety

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

FAQPage Schema
How do I eliminate `any` types when refactoring JavaScript to TypeScript?

Type safety prevents `any` types by enforcing explicit type definitions across your codebase. Replace `any` with precise types or `unknown` with type guards, ensuring the TypeScript compiler validates all data at compile time rather than allowing runtime surprises.

What's the best way to configure TypeScript strict mode for type safety?

Strict mode enables comprehensive type checking by enforcing non-null types, strict function types, and strict property initialization. Enable it in your `tsconfig.json` to catch type errors early and work alongside this Skill's prohibition on `any` types for maximum code integrity.

How do I add type hints to Python code to prevent runtime errors?

Type hints in Python document expected types for function parameters and return values, enabling static checkers to verify correctness before execution. This Skill eliminates `Any` type hints in favor of explicit, precise types, reducing debugging time and improving reliability.

Can I enforce type safety when handling external API responses?

Type safety applies during API response handling by requiring explicit type definitions for parsed JSON data rather than treating responses as `any`. Type guards validate the structure matches expectations, preventing type mismatches that cause runtime failures.

Why should I avoid `any` and `Any` types in production code?

`any` and `Any` disable type checking entirely, allowing incorrect data to pass undetected until runtime. Type safety eliminates these escape hatches, ensuring the compiler catches type errors before deployment and making code safer and easier to maintain.

Do I need type guards when working with external libraries?

Type guards validate that data from external libraries matches expected types before use, preventing errors from type mismatches. This Skill guides implementing guards alongside strict type definitions when integrating third-party code into type-safe projects.