migrate-to-shoehorn

Refactor TypeScript test suites by replacing unsafe type assertions with shoehorn utilities.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/henrycashe26/my_skills --skill migrate-to-shoehorn-henrycashe26
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/henrycashe26/my_skills/tree/main/misc/migrate-to-shoehorn
Command: npx skills add https://github.com/henrycashe26/my_skills --skill migrate-to-shoehorn-henrycashe26

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @total-typescript/shoehorn.

What problem does it solve?

This skill addresses the fragility and maintenance burden of using TypeScript type assertions (as) in test files, which often lead to runtime errors and poor type coverage.

Core Features & Use Cases

  • Partial Data Injection: Safely pass partial objects in tests using fromPartial to satisfy type requirements without mocking entire structures.
  • Intentional Type Bypassing: Use fromAny to handle intentionally malformed data for error testing while maintaining IDE autocomplete.
  • Refactoring Workflow: Automates the identification and replacement of legacy as assertions with robust, type-safe alternatives from the shoehorn library.

Quick Start

Run the migrate-to-shoehorn skill to scan the current directory for test files and replace all instances of as assertions with the appropriate shoehorn utility functions.

Frequently Asked Questions about migrate-to-shoehorn

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

FAQPage Schema
How do I replace unsafe TypeScript type assertions in test files?

To replace unsafe TypeScript type assertions, scan your test files and substitute the `as` keyword with type-safe alternatives from the `@total-typescript/shoehorn` library to improve test reliability.

What is the best way to pass partial mock objects in TypeScript unit tests?

Passing partial mock objects in TypeScript unit tests is best achieved using the `fromPartial` utility from `@total-typescript/shoehorn`, which safely satisfies type requirements without mocking entire data structures.

How do I test intentionally malformed data in TypeScript without losing type safety?

To test intentionally malformed data in TypeScript without losing type safety, use the `fromAny` utility from `@total-typescript/shoehorn` to bypass types while maintaining IDE autocomplete functionality.

Does the shoehorn refactoring process require installing new dependencies?

Yes, the shoehorn refactoring process requires installing the `@total-typescript/shoehorn` package as a dependency before replacing your legacy type assertions with robust, type-safe alternatives.

Why should I refactor TypeScript test suites to remove the as keyword?

Refactoring TypeScript test suites to remove the `as` keyword eliminates the fragility and maintenance burden of type assertions, preventing runtime errors and improving overall type coverage.