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.

307,829 stars 25,903 forksTesting & QA Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add mattpocock/skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add mattpocock/skills --skill migrate-to-shoehorn
Manual install
git clone --depth 1 https://github.com/mattpocock/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/skills/misc/migrate-to-shoehorn ~/.claude/skills/migrate-to-shoehorn

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# 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: "123" } }));
```

### `as unknown as Type` → `fromAny()`

Before:

```ts
getUser({ body: { id: 123 } } as unknown as Request); // wrong type on purpose
```

After:
Read the full skill on GitHub

Details

Skill name
migrate-to-shoehorn
Path
skills/misc/migrate-to-shoehorn/SKILL.md
License
MIT
Repo updated
30 October 2026

FAQ

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 the Migrate to Shoehorn skill?

Claude Code plugin: /plugin marketplace add mattpocock/skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Migrate to Shoehorn popular?

It lives in mattpocock/skills, which has 307,829 GitHub stars and 25,903 forks, and is included in 1 curated skill list.

Related skills

Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.