# migrate-to-shoehorn

> Claude/Codex skill by [@mattpocock](https://omgskills.com/library/mattpocock/index.md) · 199k stars · 534k installs · Updated 2026-07-31

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.

## Install

```sh
git clone https://github.com/mattpocock/skills /tmp/skills && ln -s /tmp/skills/skills/misc/migrate-to-shoehorn ~/.claude/skills/migrate-to-shoehorn
```

## From README

Migrate to Shoehorn Why shoehorn? shoehorn lets you pass partial data in tests while keeping TypeScript happy. It replaces as assertions with type-safe alternatives. Test code only. Never use shoehorn in production code. Problems with as in tests: Trained not to use it Must manually specify target type Double-as (as unknown as Type) for intentionally wrong data Migration patterns Large objects with few needed properties Before: After: as Type → fromPartial() Before: After: as unknown as Type → fromAny() Before: After: When to use each | Function | Use case | | --------------- | -------------------------------------------------- | | fromPartial() | Pass partial data that still type-checks | | fromAny() | Pass intentionally wrong data (keeps autocomplete) | | fromExact() | Force full object (swap with fromPartial later) | Workflow Gather requirements - ask user: What test files have as assertions causing problems? Are they dealing with large objects where only some properties matter?

## Links

- HTML page: https://omgskills.com/library/mattpocock/skills/migrate-to-shoehorn/
- GitHub: https://github.com/mattpocock/skills
- Author: [@mattpocock](https://omgskills.com/library/mattpocock/index.md)

## More from this repo

- [chief-of-staff](https://omgskills.com/library/mattpocock/skills/chief-of-staff/index.md) — Pursue a long-running goal in a single session by co-ordinating subagents.
   - [@mattpocock](https://omgskills.com/library/mattpocock/index.md) · 324k stars
- [tdd](https://omgskills.com/library/mattpocock/skills/tdd/index.md) — Test-driven development.
   - [@mattpocock](https://omgskills.com/library/mattpocock/index.md) · 323k stars
- [implement-spec](https://omgskills.com/library/mattpocock/skills/implement-spec/index.md) — Implement the result of /to-spec and /to-tickets in code.
   - [@mattpocock](https://omgskills.com/library/mattpocock/index.md) · 322k stars
