migrate-to-shoehorn

Migrate TypeScript test files from 'as' assertions to Shoehorn type-safe functions.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @total-typescript/shoehorn, and includes scripts (resource) components.

What problem does it solve?

This Skill helps developers eliminate errors caused by 'as' assertions in TypeScript tests and replace them with type-safe options using Shoehorn, streamlining the test code and improving reliability.

Core Features & Use Cases

  • Test Assertion Migration: Replace 'as' assertions with Shoehorn's type-safe functions for better test data management.
  • Partial Data Testing: Enables passing of partial data in tests without compromising TypeScript type checking.
  • Use Case: A developer wants to migrate a test that relies heavily on 'as' assertions for testing partial data and error conditions.

Quick Start

Run the skill by executing the command 'migrate-to-shoehorn --input "path/to/test/files"' to replace 'as' assertions in the specified test files with Shoehorn functions.

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' assertions in TypeScript test files with type-safe alternatives?

You can migrate 'as' assertions in TypeScript test files to type-safe alternatives by running a migration command that identifies 'as' assertions and replaces them with Shoehorn's type-safe functions. This requires Shoehorn to be installed as a dependency.

Why should I migrate TypeScript test assertions away from 'as' casts?

Migrating TypeScript test assertions away from 'as' casts eliminates errors caused by type assertions and replaces them with type-safe options. This streamlines test code, improves reliability, and enables passing partial test data without compromising type checking.

What is the best way to test partial data in TypeScript without using 'as' assertions?

The best way to test partial data in TypeScript without 'as' assertions is to use Shoehorn's type-safe functions. This migration approach allows you to pass partial data in tests while maintaining strict type checking for better test data management.

Does migrating test assertions to Shoehorn require any specific project setup?

Migrating test assertions to Shoehorn requires the @total-typescript/shoehorn package to be installed as a dependency in your project. You then execute the migration command targeting your test file paths to automatically replace the 'as' assertions.

Can I run the TypeScript test assertion migration on a specific directory of test files?

Yes, you can run the migration on a specific directory by executing the command with an input flag pointing to your test files. This processes the specified test files, identifies the 'as' assertions, and replaces them with Shoehorn functions.

Are there limitations when using Shoehorn for partial data testing in TypeScript?

A key limitation is that Shoehorn must be installed as a project dependency before migration. The process targets TypeScript test files relying on 'as' assertions for partial test data and error conditions, so test files without these assertions will not be affected.