migrate-to-shoehorn

Replace TypeScript as assertions with shoehorn helpers in test files.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill removes unsafe type assertions from TypeScript test code and replaces them with safer, more maintainable helpers for partial or intentionally incorrect test data.

Core Features & Use Cases

  • Partial test fixtures: Build only the object fields a test actually needs without fabricating large mock structures.
  • Intentional invalid data: Provide wrong-shaped values for negative-path testing while keeping autocomplete and type awareness.
  • Common migration path: Convert test code that uses as assertions into shoehorn helpers so the suite becomes easier to read and less brittle.

Quick Start

Ask me to migrate the selected test files from as assertions to shoehorn, and I will replace them with the appropriate fromPartial, fromAny, or fromExact helpers.

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 as assertions in test code with safer helpers?

You can replace unsafe TypeScript as assertions by mapping as Type and as unknown as Type patterns to shoehorn helpers like fromPartial, fromAny, or fromExact, preserving type safety and autocomplete while building partial or intentionally incorrect test data.

What is the best way to build partial TypeScript test fixtures without fabricating large mock objects?

Building partial TypeScript test fixtures is done by replacing as casts with the shoehorn fromPartial helper, allowing you to construct only the object fields a test actually needs without fabricating large mock structures.

Can I test negative paths with intentionally invalid data while keeping TypeScript type awareness?

Yes, you can test negative paths by using the shoehorn fromAny helper to provide wrong-shaped values for negative-path testing while keeping autocomplete and type awareness intact in your TypeScript test suite.

Does the shoehorn migration approach modify production code or only spec files?

The shoehorn migration approach applies exclusively to unit tests and spec files, replacing as Type and as unknown as Type patterns without changing production code.

What TypeScript refactoring patterns are converted when migrating to shoehorn?

Migrating to shoehorn converts as Type and as unknown as Type assertion patterns in TypeScript test code, mapping them to fromPartial, fromExact, or fromAny helpers for safer, more maintainable mocked objects.

Why should I migrate my TypeScript test as-casts to shoehorn helpers?

Migrating TypeScript test as-casts to shoehorn helpers makes your test suite easier to read and less brittle by removing unsafe type assertions and replacing them with safer, more maintainable helpers for partial test data.