migrate-to-shoehorn

Migrate test files from `as` type assertions to @total-typescript/shoehorn helpers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrate test files from as type assertions to shoehorn usage, enabling partial data in tests while preserving type safety.

Core Features & Use Cases

  • Replaces as Type and as unknown as Type patterns with shoehorn helpers like fromPartial and fromAny.
  • Demonstrates when to use fromPartial, fromAny, and fromExact for test data shaping.
  • Provides an incremental migration workflow for test suites to adopt shoehorn gradually.

Quick Start

Use a simple instruction to migrate tests by replacing as assertions with shoehorn helpers and verify type-safe behavior.

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 'as' type assertions with shoehorn in TypeScript tests?

To replace 'as' type assertions with shoehorn in TypeScript tests, this Skill substitutes 'as Type' and 'as unknown as Type' patterns with fromPartial and fromAny helpers, updating imports and test calls to preserve type safety for partial data.

What is the best way to use partial data in TypeScript tests without losing type safety?

Using partial data in TypeScript tests without losing type safety is best achieved by migrating to shoehorn's fromPartial helper, which allows shaping test data like Request mocks while avoiding full object construction and unsafe type assertions.

When should I use fromPartial, fromAny, or fromExact from shoehorn?

Use fromPartial, fromAny, or fromExact from shoehorn depending on your test data shaping needs: fromPartial for partial fixtures, fromAny for bypassing strict checks, and fromExact for requiring complete data structures during TypeScript test migrations.

Can I migrate existing test suites to shoehorn gradually?

Yes, you can migrate existing test suites to shoehorn gradually. This Skill provides an incremental migration workflow, allowing you to replace type assertions with fromPartial and fromAny helpers file by file without breaking your overall test suite.

Does shoehorn work for mocking large TypeScript fixtures and Request-like objects?

Shoehorn works effectively for mocking large TypeScript fixtures and Request-like objects. By using fromPartial and fromAny, you can avoid full object construction while maintaining type safety across complex test data requirements.