migrate-to-shoehorn

Replace unsafe as type assertions in TypeScript tests with shoehorn helper functions.

Updated May 9, 2026
One-click install
npx skills add https://github.com/kk20300113-png/my-claude-skills --skill migrate-to-shoehorn-kk20300113-png
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/kk20300113-png/my-claude-skills/tree/main/migrate-to-shoehorn
Command: npx skills add https://github.com/kk20300113-png/my-claude-skills --skill migrate-to-shoehorn-kk20300113-png

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the common pain point of using unsafe as type assertions in TypeScript test files, which require manual type specification, often need double as casts for intentionally incorrect test data, and violate TypeScript best practices.

Core Features & Use Cases

  • Replace as Type assertions: Swap standard as type casts with the type-safe fromPartial() function for partial test data.
  • Replace double as casts: Swap as unknown as Type patterns with the fromAny() function for intentionally incorrect test data used in error testing.
  • Reduce test boilerplate: Eliminate the need to fake all properties of large objects when only a subset of properties are relevant to the test case.

Quick Start

Use the migrate-to-shoehorn skill to replace all as type assertions in your TypeScript test files with the appropriate @total-typescript/shoehorn helper 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 remove unsafe as type assertions in TypeScript test files?

To remove unsafe as type assertions in TypeScript test files, replace them with type-safe @total-typescript/shoehorn helpers like fromPartial() to maintain type safety while reducing boilerplate for partial test data.

What is the best way to replace as unknown as Type casts when testing TypeScript errors?

The best way to replace as unknown as Type casts in TypeScript error testing is using the fromAny() helper from @total-typescript/shoehorn, which safely handles intentionally incorrect test data without requiring manual double as casts.

How do I reduce TypeScript test boilerplate for partial mock data?

Reduce TypeScript test boilerplate for partial mock data by applying the fromPartial() helper, which allows you to specify only the properties relevant to the test case instead of faking all properties of large objects.

Does migrating test assertions to shoehorn helpers modify production code?

Migrating test assertions to shoehorn helpers does not modify production code, as the type-safe replacement patterns are applied strictly to TypeScript unit and integration test suites to adhere to TypeScript best practices.

When should I replace as Type casts in my TypeScript test suite?

You should replace as Type casts in your TypeScript test suite when you need to reduce test boilerplate for partial test data, eliminate double as casts for error testing, and enforce type safety without violating TypeScript best practices.