LogoAwesome Skills
  • Search
  • Category
  • Tag
  • Blog
LogoAwesome Skills
LogoAwesome Skills

Discover Open-Source Agent Skills for AI Coding Assistants

Product

  • Search
  • Category
  • Tag
  • Blog

Resources

  • Claude Skill Docs
  • Antigravity Skills Docs

Tools

  • Claude Code
  • OpenCode
  • Cursor
  • Codex
  • Antigravity

Company

  • Privacy Policy
  • Terms of Service
  • Sitemap

©2026 Awesome Skills. All rights reserved.

Privacy PolicyTerms
Back to Skills

migrate-to-shoehorn

Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.

79,595stars6,868forksUpdated 5/14/2026
Web DevelopmentTesting & QA#unit-testing#code-migration#testing#type-safety#typescript#javascript

Security Assessment

Safe(100/100)
Security Score100/100

About migrate-to-shoehorn

The `migrate-to-shoehorn` skill provides a structured approach to converting TypeScript test files that rely on `as` type assertions into safer, type-checked alternatives using the @total-typescript/shoehorn library. It addresses common problems in test code where developers need to assert types, including the manual specification of large object types or double-casting with `as unknown as Type` to bypass type checking. By introducing functions like `fromPartial` and `fromAny`, this skill helps developers reduce boilerplate code while maintaining type safety, ensuring that tests remain both readable and maintainable.

Key features of this skill include clear migration patterns for different scenarios: converting `as Type` assertions to `fromPartial()` for partial objects, and `as unknown as Type` to `fromAny()` for intentionally incorrect data used in error testing. It emphasizes test-only usage, highlighting that shoehorn should not be used in production code. The workflow guides developers through identifying test files with `as` assertions, applying the appropriate shoehorn functions, and verifying correctness via TypeScript type checks. Additional functions like `fromExact()` are also noted for cases where full objects are required, allowing gradual migration strategies.

This skill is targeted at TypeScript developers and teams who write unit or integration tests that involve large objects or require simulating error scenarios. It is particularly useful for projects where reducing manual type assertions and improving type safety in tests is a priority. By following the provided workflow, users can streamline their test migration process, simplify test data setup, and ensure more robust and maintainable test suites without compromising on TypeScript's type guarantees.

FAQ

Can `migrate-to-shoehorn` be used in production code?

No, the skill is intended for test code only. Using shoehorn in production is not recommended.

Which function should I use to replace `as Type` assertions?

Use `fromPartial()` for partial objects that still satisfy TypeScript type checks.

What should I use for intentionally wrong data in tests?

Use `fromAny()` to pass data that may not match the expected type but still allows autocomplete and testing error scenarios.

Do I need to install anything before using this skill?

Yes, install the library with `npm i @total-typescript/shoehorn` to access the migration functions.

Will using this skill automatically update all test files?

No, the skill provides a workflow and patterns for manual migration. You need to identify test files and apply the appropriate function replacements.

Install migrate-to-shoehorn

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

mattpocock/skills

Related Skills

mantis-reflect

2,507

product-description-generator

1,218

app-store-review

392

github-ops

1,483