migrate-to-shoehorn

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @total-typescript/shoehorn.

What problem does it solve? TypeScript tests often rely on as type assertions or as unknown as Type casts to fake large objects, which bypasses type safety and requires manually faking every property. This Skill migrates those assertions to @total-typescript/shoehorn, letting tests pass partial data while keeping type checking intact. ## Core Features & Use Cases - Assertion Replacement: Converts as Type casts to fromPartial() and as unknown as Type double-casts to fromAny(). - Partial Test Data: Lets tests supply only the properties they care about instead of faking entire large objects. - Guided Migration Workflow: Provides a checklist covering installation, grep-based discovery of as assertions, replacement, and type-check verification. - Use Case: A test calls getUser({ body: { id: "123" } } as Request) where Request has 20+ properties. After migration, it becomes getUser(fromPartial({ body: { id: "123" } })) with full type safety. ## Quick Start Ask the AI to migrate the as type assertions in your test files 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?

Install @total-typescript/shoehorn and replace `as Type` casts with `fromPartial()`, which accepts partial data while keeping type checking. For intentionally wrong data, replace `as unknown as Type` with `fromAny()`.

What is the difference between fromPartial, fromAny, and fromExact in shoehorn?

fromPartial accepts partial data that still type-checks, fromAny accepts intentionally wrong data while keeping autocomplete, and fromExact forces a full object that can later be swapped to fromPartial.

Can I use @total-typescript/shoehorn in production code?

No. Shoehorn is intended for test code only, where passing partial mock data is acceptable. Production code should always construct fully typed objects.

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

Run `grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts"` to locate type assertions in test files, then replace each with the appropriate shoehorn function and run the type checker to verify.

When should I not use shoehorn for test mocks?

Avoid shoehorn when a test genuinely needs a fully valid object, since partial data can hide integration issues. Use fromExact to require the complete shape, or construct real objects for critical paths.