clean-typescript

Enforce explicit typing and safe nullability in TypeScript code.

Updated Jan 11, 2025
One-click install
npx skills add https://github.com/rdjakovic/todo2 --skill clean-typescript-rdjakovic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-typescript
Source: https://github.com/rdjakovic/todo2/tree/main/.claude/skills/clean-typescript
Command: npx skills add https://github.com/rdjakovic/todo2 --skill clean-typescript-rdjakovic

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers write cleaner, more maintainable, and less error-prone TypeScript code by enforcing best practices and clear type definitions.

Core Features & Use Cases

  • Type Philosophy: Guides the use of explicit, readable types, avoiding any and unsafe assertions.
  • Function Signatures: Promotes explicit return types for public functions and simple, predictable signatures.
  • Nullability & Safety: Emphasizes explicit handling of null and undefined, discouraging non-null assertions.
  • Use Case: Ensure your entire codebase adheres to a consistent, high-quality TypeScript standard, reducing bugs and improving developer understanding.

Quick Start

Apply the clean-typescript skill to refactor the provided TypeScript code.

Frequently Asked Questions about clean-typescript

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

FAQPage Schema
How do I enforce TypeScript best practices for type safety and avoid using the any type?

To enforce TypeScript best practices, apply the clean-typescript skill to refactor your code. It guides you toward explicit, readable types, avoiding the any type and unsafe assertions, which reduces error-prone code and ensures clear type definitions throughout your codebase.

What's the best way to refactor TypeScript code to handle null and undefined safely?

The best way to handle null and undefined in TypeScript is through explicit nullability handling and avoiding non-null assertions. This ensures predictable function signatures and reduces runtime bugs caused by missing or unexpected values.

Should I use type aliases or interfaces for explicit return types in TypeScript functions?

For explicit return types in TypeScript functions, you should prefer using type aliases. This promotes simple, predictable function signatures and helps maintain a consistent, high-quality TypeScript standard across your codebase.

Why does my TypeScript refactoring still produce bugs when using implicit types?

Implicit typing in TypeScript often produces bugs because it lacks strict type definitions, leading to unpredictable behavior. Refactoring to use explicit return types and avoiding unsafe assertions enforces clear type definitions, significantly reducing bugs and improving maintainability.