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.
npx skills add stevesolun/ctx --skill migrate-to-shoehorn --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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 ## Install ```bash npm i @total-typescript/shoehorn ``` ## Migration patterns ### Large objects with few needed properties Before: ```ts type Request = { body: { id: string }; headers: Record<string, string>; cookies: Record<string, string>; // ...20 more properties }; it("gets user by id", () => { // Only care about body.id but must fake entire Request getUser({ body: { id: "123" }, headers: {}, cookies: {}, // ...fake all 20 properties }); }); ``` After: ```ts import { fromPartial } from "@total-typescript/shoehorn"; it("gets user by id", () => { getUser( fromPartial({ body: { id: "123" }, }), ); }); ``` ### `as Type` → `fromPartial()` Before: ```ts getUser({ body: { id: "123" } } as Request); ``` After: ```ts import { fromPartial } from "@total-typescript/shoehorn"; getUser(fromPartial({ body: { id:
- Why shoehorn?
- Install
- Migration patterns
- Large objects with few needed properties
- as Type → fromPartial()
- as unknown as Type → fromAny()
- When to use each
- Workflow
npm i @total-typescript/shoehorn
What does the migrate-to-shoehorn skill do?
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.
How do I install it?
Run `npx skills add stevesolun/ctx --skill migrate-to-shoehorn --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From stevesolun/ctx, a repository with 569 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
