ban-type-assertions

Community

Replace unsafe casts with compiler-checked types.

AuthoroElberte
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill prevents brittle, unverifiable TypeScript as assertions by forcing you to use compiler-checked narrowing or runtime-validated schemas instead.

Core Features & Use Cases

  • Enforces safe type assertions: Enables @typescript-eslint/consistent-type-assertions with assertionStyle: 'never' to block as X casts.
  • Provides replacement patterns by boundary type: Uses Zod parsing for external data boundaries, control-flow narrowing for union types, and a justified last resort only when unavoidable.
  • Improves maintainability across packages: Guides you to centralize duplicated types/schemas into @factory/common and update tests so mocks validate correctly.

Quick Start

Use it to enable the rule in your package by adding @typescript-eslint/consistent-type-assertions with assertionStyle: 'never' in packages/<name>/.eslintrc.js, then fix each as X violation by applying the appropriate replacement pattern.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: ban-type-assertions
Download link: https://github.com/oElberte/dotfiles/archive/main.zip#ban-type-assertions

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.