migrate-to-shoehorn

Migrate TypeScript test files from as assertions to shoehorn-compatible helpers.

Updated Apr 28, 2026
One-click install
npx skills add https://github.com/rnaarla/agent_skills --skill migrate-to-shoehorn-rnaarla
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-to-shoehorn
Source: https://github.com/rnaarla/agent_skills/tree/main/skills/misc/migrate-to-shoehorn
Command: npx skills add https://github.com/rnaarla/agent_skills --skill migrate-to-shoehorn-rnaarla

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrate test files from as type assertions to shoehorn-compatible helpers to make tests safer and easier to maintain.

Core Features & Use Cases

  • Pattern-based migration: replace as assertions with fromPartial/fromAny variants.
  • Partial data safety: preserve type checks while focusing on essential fields.
  • Use Case: modernize test suites that heavily rely on type guards and large payloads.

Quick Start

Ask your AI to migrate existing tests by replacing as assertions with shoehorn-enabled 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 type assertions in TypeScript tests with safer partial data helpers?

You can replace `as` type assertions in TypeScript tests with shoehorn-compatible helpers like `fromPartial` and `fromAny` to preserve type safety while using partial data. This migration focuses on essential object fields and updates test data with proper imports for clearer, safer tests.

Why does using `as` for partial mocks in TypeScript test suites cause maintenance issues?

Using `as` for partial mocks in TypeScript test suites bypasses type checking, creating maintenance issues when object structures change. Migrating to shoehorn-compatible helpers focuses type checks on essential fields, making tests safer and preventing invalid mock data from causing silent runtime failures.

Can I use fromPartial to mock large request objects with only a subset of properties in TypeScript tests?

Yes, you can use `fromPartial` to mock large request objects with only a subset of properties in TypeScript tests. It covers common test scenarios where partial data is acceptable, allowing you to focus on essential object fields while preserving type safety during test migrations.

What is the best way to migrate test files from type assertions to shoehorn helpers?

The best way to migrate test files from type assertions to shoehorn helpers is by replacing `as` assertions with `fromPartial` or `fromAny` variants. This pattern-based migration requires adding proper imports and updating test data to maintain type safety for large payloads and mocks.

Does migrating tests with fromPartial and fromAny work for large payloads and mocks in TypeScript?

Yes, migrating tests with `fromPartial` and `fromAny` works for large payloads and mocks in TypeScript. This approach targets test scenarios where only a subset of object properties matter, ensuring partial data remains type-safe while modernizing test suites that heavily rely on large request objects.

When should I not use shoehorn migration for partial data in TypeScript tests?

You should not use shoehorn migration for partial data in TypeScript tests when a test scenario requires the complete object structure with all properties fully populated. The `fromPartial` and `fromAny` migration patterns are designed specifically for cases where partial data and a subset of properties are acceptable.