type-safety

Enforce strict TypeScript type-safety by disallowing 'any', 'as T', and '!' assertions.

1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/g-bastianelli/nuthouse --skill type-safety-g-bastianelli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-safety
Source: https://github.com/g-bastianelli/nuthouse/tree/main/subroutine/skills/type-safety
Command: npx skills add https://github.com/g-bastianelli/nuthouse --skill type-safety-g-bastianelli

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill enforces strict type safety in TypeScript files, preventing the use of 'any', 'as T', or '!' assertions to ensure type correctness and code maintainability.

Core Features & Use Cases

  • Prevent 'any' Usage: Disallows the use of 'any' to force type-checking throughout the codebase.
  • Prohibit 'as T' Assertions: Promotes safer type checks through type guards and schema parsing instead of 'as T' assertions.
  • Ban '!' Non-null Assertions: Encourages optional chaining, explicit null checks, or local narrowed variables over '!' non-null assertions.
  • Use Case: By applying this discipline to all TypeScript files, developers can write more robust and maintainable code, reducing the risk of runtime errors.

Quick Start

Run the type-safety skill in your TypeScript files to enforce these rules.

Frequently Asked Questions about type-safety

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

FAQPage Schema
How do I enforce strict type safety in TypeScript and ban 'any'?

This discipline enforces type safety by disallowing 'any' types, 'as T' assertions, and '!' non-null assertions, preventing the use of 'any' to force type-checking throughout the codebase, which reduces runtime errors.

What is the best way to avoid 'as T' type assertions in TypeScript?

The best way to avoid 'as T' type assertions is to enforce strict type safety rules that promote safer type checks through type guards and schema parsing, preventing unsafe casting and ensuring code maintainability.

Why should I ban non-null assertion operators in TypeScript?

You should ban non-null '!' assertions to enforce strict type safety, encouraging optional chaining, explicit null checks, or local narrowed variables over unsafe assertions to improve code robustness and maintainability.

Do I need external dependencies to enforce type guards and type inference in my project?

No, you do not need external dependencies to enforce type guards and type inference. This discipline applies to all TypeScript files in the specified paths, promoting better type checking without requiring any external packages.

When should I use optional chaining instead of non-null assertions in TypeScript?

You should use optional chaining instead of non-null '!' assertions whenever you need to handle potentially undefined or null values, as this enforces strict type safety and reduces the risk of runtime errors in your codebase.