migrate-to-shoehorn

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

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/MSC72m/DevForge --skill migrate-to-shoehorn-msc72m
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/MSC72m/DevForge/tree/main/skills/migrate-to-shoehorn
Command: npx skills add https://github.com/MSC72m/DevForge --skill migrate-to-shoehorn-msc72m

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @total-typescript/shoehorn.

What problem does it solve? TypeScript tests often rely on as type assertions to fake large objects, which bypasses type safety, requires manually specifying target types, and forces awkward double-assertions (as unknown as Type) for intentionally wrong data. This Skill replaces those assertions with type-safe shoehorn helpers. ## Core Features & Use Cases - Partial test data: Replace as Type with fromPartial() so tests only specify the properties they actually care about while still type-checking. - Intentionally wrong data: Replace as unknown as Type with fromAny() for error-path testing while keeping autocomplete. - Full-object enforcement: Use fromExact() to require a complete object now and swap to fromPartial() later. - Use Case: A test suite fakes an entire Express-style Request object with 20+ properties just to check body.id. Migrate it so the test passes only { body: { id: "123" } } via fromPartial() and still compiles. ## Quick Start Ask the AI to find all as assertions in your test files and migrate them to @total-typescript/shoehorn using fromPartial and fromAny.

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 in TypeScript tests?▼

Replace `as Type` with `fromPartial()` from @total-typescript/shoehorn, which accepts partial data that still type-checks. Replace `as unknown as Type` with `fromAny()` when passing intentionally wrong data for error testing.

What is @total-typescript/shoehorn used for?▼

Shoehorn lets you pass partial data in tests while keeping TypeScript happy, replacing `as` assertions with type-safe alternatives. It provides fromPartial, fromAny, and fromExact functions and is intended for test code only, never production code.

When should I use fromPartial vs fromAny vs fromExact?▼

Use fromPartial() to pass partial data that still type-checks, fromAny() to pass intentionally wrong data while keeping autocomplete, and fromExact() to force a full object that you can swap to fromPartial() later.

Can I use shoehorn in production code?▼

No. Shoehorn is designed for test code only and should never be used in production code, since it deliberately bypasses full type requirements to make faking test data convenient.

How do I find all `as` assertions in my test files?▼

Run grep -r " as [A-Z]" with --include="*.test.ts" and --include="*.spec.ts" to locate assertions in test files. After migrating, run the TypeScript type check to verify everything compiles.