clean-typescript

Enforce clean, efficient TypeScript coding standards including explicit typing and avoiding `any`.

Updated Feb 10, 2026
One-click install
npx skills add https://github.com/mrpitch/mrp-claude-plugin --skill clean-typescript-mrpitch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-typescript
Source: https://github.com/mrpitch/mrp-claude-plugin/tree/main/plugins/mrp-nextjs/skills/clean-typescript
Command: npx skills add https://github.com/mrpitch/mrp-claude-plugin --skill clean-typescript-mrpitch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

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

Core Features & Use Cases

  • Type Philosophy Enforcement: Guides users on preferring explicit types, avoiding any, and using unknown appropriately.
  • Interface vs. Type Aliases: Recommends when to use type aliases versus interface.
  • Function & API Best Practices: Advises on explicit return types and avoiding unnecessary function overloads.
  • Nullability & Safety: Promotes explicit handling of null and undefined.
  • Enum & Constant Usage: Discourages enum in favor of union types or as const.
  • Error Handling: Encourages explicit typing of errors and result objects.
  • Use Case: When refactoring a legacy JavaScript codebase to TypeScript, this Skill can ensure the new TypeScript code adheres to modern best practices for clarity and robustness.

Quick Start

Apply clean TypeScript best practices to the provided code snippet.

Frequently Asked Questions about clean-typescript

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

FAQPage Schema
What is the best way to avoid `any` and handle unknown types in TypeScript?

The best way to avoid `any` in TypeScript is to use explicit, readable types and apply the `unknown` type appropriately when the exact shape is uncertain. This enforces type safety and reduces bugs by requiring type checking before usage.

When should I use `interface` vs `type` aliases in TypeScript?

Use `interface` vs `type` aliases in TypeScript based on your structure needs; the Skill guides you on preferring explicit definitions to enforce coding standards. Choosing correctly between them reduces cognitive load and improves maintainability.

How do I handle null and undefined safely in TypeScript functions?

Handle null and undefined in TypeScript functions by enforcing explicit nullability handling within your signatures. The Skill advises on explicit return types and promotes strict checks to prevent runtime errors and ensure robust API design.

Why should I use union types or `as const` instead of TypeScript enums?

You should use union types or `as const` instead of TypeScript enums to enforce cleaner type safety and avoid unexpected runtime behavior. This coding standard reduces bugs and simplifies constant usage within your codebase.

How do I manage error handling and explicit return types when refactoring JavaScript to TypeScript?

Manage error handling when refactoring JavaScript to TypeScript by explicitly typing errors and result objects. The Skill advises on explicit function signatures and avoiding unnecessary overloads to modernize legacy code and reduce cognitive load.