
Migrate to Shoehorn
Swap risky `as` type casts in TypeScript tests for type-safe shoehorn helpers.
- Repository
- mattpocock/skills
- Stars
- 309,658
- Licence
- MIT
- Files
- 2 files
What it does
When you ask, the agent rewrites TypeScript test files that use `as` type casts to fake test data, replacing them with helpers from the @total-typescript/shoehorn library. Those helpers let a test pass partial objects while keeping the type checker useful, and they offer a way to pass deliberately wrong data for error testing. The agent can also install the library, find the casts with a search command, and run a type check afterwards.
Great for
- TypeScript developers whose test files are full of `as Type` casts
- Teams with large request or config types where tests only need a few properties
- Anyone who wants a cleaner way to pass intentionally invalid data in tests
Skip it if
- Production code: the skill itself says shoehorn is for test code only, since it bypasses type checking
- Projects not using TypeScript, where the migration has no meaning
- Codebases that rely on the type checker to catch missing fields in tests, because fromPartial relaxes that check
Try asking
- “Migrate the `as Request` casts in my test files to shoehorn's fromPartial”
- “Replace my `as unknown as User` casts in the spec files with fromAny”
- “Install shoehorn and find all the `as` assertions in my .test.ts files”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 2 original files, the MIT licence and an attribution note.
migrate-to-shoehorn.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip migrate-to-shoehorn.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip migrate-to-shoehorn.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Ask the agent to run your type check after migration, since the skill's final step relies on it to verify the changes.
- Review each replacement: fromPartial and fromAny silence checks that `as` also silenced, so the tests lose some safety.
- Point the agent at specific folders if the project has many test files, to keep the diff reviewable.
What's inside
- agents/openai.yaml
- SKILL.md
Redistributed unmodified from mattpocock/skills under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.