migrate-to-shoehorn

Migrate TypeScript `as` assertions in test files to `@total-typescript/shoehorn`.

779|80|Updated Jun 20, 2025
One-click install
npx skills add https://github.com/Haohao-end/openagent --skill migrate-to-shoehorn-haohao-end
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/Haohao-end/openagent/tree/main/api/internal/core/skills/catalog/migrate-to-shoehorn
Command: npx skills add https://github.com/Haohao-end/openagent --skill migrate-to-shoehorn-haohao-end

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you replace unsafe TypeScript as type assertions in tests with @total-typescript/shoehorn for safer, more reliable type narrowing.

Core Features & Use Cases

  • Batch migration for test modernization: Identify as assertions in test files and convert the relevant assertions to shoehorn-based equivalents without changing behavior.
  • Type-safe testing: Improve compile-time correctness of assertions so your tests better reflect the intended types.
  • Team-ready refactoring workflow: Supports repositories with many existing as assertions where manual migration would be slow and error-prone.

Quick Start

Ask the AI to migrate all as-based test type assertions to @total-typescript/shoehorn, file by file, keeping the tests’ runtime behavior unchanged.

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 files with safer alternatives?▼

You can replace unsafe TypeScript `as` assertions in test files by migrating them to `@total-typescript/shoehorn` type-safe equivalents, converting eligible assertions batch by batch while preserving runtime behavior.

What is the best way to batch convert `as` type assertions to shoehorn for test modernization?▼

The best way to batch convert `as` type assertions for test modernization is discovering eligible assertions across files, mapping them to shoehorn equivalents, and performing per-file migrations to avoid manual edits.

Why should I migrate TypeScript test assertions to use type-safe narrowing instead of `as`?▼

Migrating TypeScript test assertions to type-safe narrowing improves compile-time correctness so your tests better reflect intended types, reducing errors that unsafe `as` assertions allow through.

Can I migrate `as` assertions in a large codebase without changing existing test behavior?▼

Yes, you can migrate `as` assertions in a large codebase without changing existing test behavior by performing per-file conversions that map unsafe assertions to shoehorn equivalents while preserving runtime logic.

Does migrating test assertions to shoehorn require manual edits for every file?▼

Migrating test assertions to shoehorn does not require manual edits for every file when using batch conversion, which discovers eligible `as` assertions and applies mappings automatically across test files.

When should I not use shoehorn to replace `as` type assertions in my TypeScript tests?▼

You should not use shoehorn to replace `as` type assertions when your tests rely on intentional type widening or narrowing behavior that shoehorn's stricter type-safe equivalents would restrict at compile time.