MCP.Market

migrate-to-shoehorn skill

by mattpocock·mattpocock/skills·324k stars·MIT

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.

A100/100content scan

Is the migrate-to-shoehorn skill safe?

Clean: nothing in its files matched our rules. We read 2 files in the folder on 2026-10-25.

No findings.

Install the migrate-to-shoehorn skill

A skill is a folder. Copy it into your agent's skills folder and the agent loads it when the task matches its description.

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
available in every project

In the Claude apps, zip the folder and upload it from the Skills settings. The folder on GitHub

The instructions your agent would load

SKILL.md as published, without the frontmatter. Read it on GitHub

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

npm i @total-typescript/shoehorn

Migration patterns

Large objects with few needed properties

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 } }));

When to use each

Workflow

  1. Gather requirements - ask user:
  • What test files have as assertions causing problems?
  • Are they dealing with large objects where only some properties matter?
  • Do they need to pass intentionally wrong data for error testing?
  1. Install and migrate:
  • [ ] Install: npm i @total-typescript/shoehorn
  • [ ] Find test files with as assertions: grep -r " as [A-Z]" --include=".test.ts" --include=".spec.ts"
  • [ ] Replace as Type with fromPartial()
  • [ ] Replace as unknown as Type with fromAny()
  • [ ] Add imports from @total-typescript/shoehorn
  • [ ] Run type check to verify

More skills from mattpocock/skills

  • Aask-mattAsk which skill or flow fits your situation. A router over the skills in this repo.
  • Achief-of-staffPursue a long-running goal in a single session by co-ordinating subagents.
  • Aclaude-handoffHand the current conversation off to a fresh background agent that picks up the work immediately.
  • Acode-reviewReview the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\".
  • Acodebase-designShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
  • Adiagnosing-bugsDiagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.
  • Adomain-modelingBuild and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
  • Agit-guardrails-claude-codeSet up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
  • Agrill-meA relentless interview to sharpen a plan or design.
  • Agrill-with-docsA relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
  • AgrillingGrill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
  • AhandoffCompact the current conversation into a handoff document for another agent to pick up.

All agent skills → · MCP servers