/engineering-javascript-typescript:migrate-to-shoehornfrom engineering-javascript-typescript
Migrates test files from `as` type assertions to `@total-typescript/shoehorn` for type-safe partial test data. Useful when replacing `as` in tests or needing partial data.
Ships in engineering-javascript-typescript. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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:
as unknown as Type) for intentionally wrong datanpm i @total-typescript/shoehorn
Before:
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:
import { fromPartial } from "@total-typescript/shoehorn";
it("gets user by id", () => {
getUser(
fromPartial({
body: { id: "123" },
}),
);
});
as Type → fromPartial()Before:
getUser({ body: { id: "123" } } as Request);
After:
import { fromPartial } from "@total-typescript/shoehorn";
getUser(fromPartial({ body: { id: "123" } }));
as unknown as Type → fromAny()Before:
getUser({ body: { id: 123 } } as unknown as Request); // wrong type on purpose
After:
import { fromAny } from "@total-typescript/shoehorn";
getUser(fromAny({ body: { id: 123 } }));
| 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) |
Gather requirements - ask user:
as assertions causing problems?Install and migrate:
npm i @total-typescript/shoehornas assertions: grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts"as Type with fromPartial()as unknown as Type with fromAny()@total-typescript/shoehornWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
14 skills in this plugin
/bun-developmentFast, modern JavaScript/TypeScript development with the Bun runtime, inspired by [oven-sh/bun](https://github.com/oven-sh/bun)./bun-runtimeBun as runtime, package manager, bundler, and test runner. When to choose Bun vs Node, migration notes, and Vercel support./dbos-typescriptGuide for building reliable, fault-tolerant TypeScript applications with DBOS durable workflows. Use when adding DBOS to existing TypeScript code, creating workflows and steps, or using queues for concurrency control.npx claudepluginhub marslanalvi/skillsstack --plugin engineering-javascript-typescriptOther plugins' skills for the same job