migrate-to-shoehorn

Refactor TypeScript test files by replacing unsafe type assertions with @total-typescript/shoehorn utilities.

45|2|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/hachej/boring-ui --skill migrate-to-shoehorn-hachej
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/hachej/boring-ui/tree/main/.agents/skill-library/miscellaneous/migrate-to-shoehorn
Command: npx skills add https://github.com/hachej/boring-ui --skill migrate-to-shoehorn-hachej

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 suites, which often lead to brittle tests and hidden type errors.

Core Features & Use Cases

  • Type-Safe Partial Data: Replaces unsafe as assertions with fromPartial to allow partial object definitions in tests.
  • Intentional Type Mismatch: Provides fromAny to handle cases where intentionally incorrect data is required for error testing.
  • Use Case: When refactoring a large test suite, use this skill to systematically identify and replace all instances of as Type and as unknown as Type with the appropriate shoehorn utilities to improve test reliability.

Quick Start

Run the migrate to shoehorn skill to scan the current directory for test files and replace all unsafe type assertions with the appropriate shoehorn 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 type assertions in TypeScript test files?

To replace unsafe type assertions in TypeScript test files, refactor them using the shoehorn library to substitute `as` syntax with type-safe `fromPartial` and `fromAny` utility patterns.

What is the best way to handle partial object mocks in TypeScript unit testing?

The best way to handle partial object mocks in TypeScript unit testing is using the `fromPartial` utility, which safely allows partial object definitions without relying on brittle type assertions.

How does shoehorn improve type safety for intentional type mismatches in tests?

Shoehorn improves type safety for intentional type mismatches by providing the `fromAny` utility, allowing you to inject intentionally incorrect data for error testing without bypassing the type checker.

Can I systematically refactor `as unknown as` syntax in a large test suite?

Yes, you can systematically refactor `as unknown as` syntax in a large test suite by scanning specified files and replacing all instances with appropriate shoehorn functions to improve overall test reliability.

Does the migrate-to-shoehorn skill require any specific dependencies?

Yes, the migrate-to-shoehorn skill requires the `@total-typescript/shoehorn` dependency to implement type-safe refactoring patterns across your test environment.