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

将测试文件从 `as` 类型断言迁移到 @total-typescript/shoehorn。适用于用户提到 shoehorn、想替换测试中的 `as`,或需要局部测试数据时。

1,550stars136forksUpdated 7/7/2026
Web DevelopmentTesting & QA#migration#refactoring#testing#type-safety#typescript

Security Assessment

Safe(100/100)
Security Score100/100

About migrate-to-shoehorn

A migration guide for moving test files away from TypeScript as type assertions and toward the @total-typescript/shoehorn library. The documentation is written in Simplified Chinese and triggers when a user mentions shoehorn, wants to replace as in tests, or needs partial test data. shoehorn lets tests pass partial data while keeping the TypeScript compiler satisfied, replacing as casts with type-safe alternatives.

It is explicit that shoehorn is for test code only and should never appear in production. The rationale is that as assertions in tests train developers to ignore type safety, force manual specification of the target type, and require a double cast through unknown for deliberately wrong data. shoehorn addresses each case with dedicated helpers: fromPartial for passing partial data that still type-checks, fromAny for intentionally wrong data while keeping autocomplete, and fromExact for forcing a full object that can later be relaxed to fromPartial.

The guide includes concrete before-and-after examples, such as faking a large Request object when a test only cares about one field, and shows the corresponding imports from the package. Installation is a single npm install of @total-typescript/shoehorn. A short workflow walks through gathering requirements from the user, installing the package, locating as assertions in test and spec files, replacing as Type with fromPartial and as unknown as Type with fromAny, adding the imports, and finally running a type check to verify. Use it to make test data terser and safer without weakening type checking across a TypeScript test suite.

FAQ

When should I use this skill?

When migrating test files from as assertions to @total-typescript/shoehorn, or when you need to pass partial test data.

Can I use shoehorn in production code?

No. It is intended for test code only and should never be used in production.

What replaces an as Type assertion?

The fromPartial helper, which lets you pass partial data that still type-checks.

What replaces an as unknown as Type assertion?

The fromAny helper, used for deliberately wrong data while preserving autocomplete.

How is the library installed?

With npm i @total-typescript/shoehorn.

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

vinvcn/mattpocock-skills-zh-cn

Related Skills

short-form-video

14

multi-asset-morning-briefing

7,907

content-strategy

2,901

doherty-threshold

2,901