migrate-to-shoehorn

migrate-to-shoehorn is a skill for Claude Code from MatthewYe/opencode-toolbox. It costs 48 tokens per session (724 once invoked), scanned A, a copy of migrate-to-shoehorn, MIT.

A TypeScript test-code migration from `as` type assertions to Shoehorn, a helper for supplying partial test data while satisfying TypeScript.

In plain words
What is it for?
Use it to update tests that pass incomplete objects, especially when only a few properties matter to the scenario.
Why use it?
It avoids filling in irrelevant fields or using unchecked type casts when building test fixtures.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the mattpocock-skills plugin — 29 skills shipped together

Good fit Use it to update tests that pass incomplete objects, especially when only a few properties matter to the scenario.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/matthewye/opencode-toolbox/migrate-to-shoehorn
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add MatthewYe/opencode-toolbox --skill migrate-to-shoehorn
Clone the repo
git clone --depth 1 https://github.com/MatthewYe/opencode-toolbox

Made for: Claude Code.

Or install mattpocock-skills, the plugin that ships this one along with the rest of its 29 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for migrate-to-shoehorn

README.md
[![agentmods](https://agentmods.dev/badge/skills/matthewye/opencode-toolbox/migrate-to-shoehorn/github.svg)](https://agentmods.dev/skills/matthewye/opencode-toolbox/migrate-to-shoehorn)
Your own site
<a href="https://agentmods.dev/skills/matthewye/opencode-toolbox/migrate-to-shoehorn"><img src="https://agentmods.dev/badge/skills/matthewye/opencode-toolbox/migrate-to-shoehorn/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for migrate-to-shoehorn

Your own site · 80×15
<a href="https://agentmods.dev/skills/matthewye/opencode-toolbox/migrate-to-shoehorn"><img src="https://agentmods.dev/badge/skills/matthewye/opencode-toolbox/migrate-to-shoehorn.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 724 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.00724
Opus 5 $0.00024 $0.00362
Sonnet 5 $0.00010 $0.00145
Haiku 4.5 $0.00005 $0.00072

Measured 5d ago against content hash de4da4c11d92, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

migrate-to-shoehorn scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to migrate-to-shoehorn — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

upstream/skills/misc/migrate-to-shoehorn/SKILL.md · 119 lines

How it starts

The opening of the file, as written. The whole thing — 119 lines — stays where its author put it; the contents beside it link to each section 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 TypefromPartial()

Before:

getUser({ body: { id: "123" } } as Request);

After:

import { fromPartial } from "@total-typescript/shoehorn";

getUser(fromPartial({ body: { id: "123" } }));

as unknown as TypefromAny()

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

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)

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?

Read the full file on GitHub · 119 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 119 lines · 48 tokens per session scan A de4da4c11d92

Subscribe to this mod's changes

migrate-to-shoehorn is a skill published in the GitHub repository MatthewYe/opencode-toolbox (5 stars, last pushed 2mo ago), licensed MIT. It adds 48 tokens to every session and 724 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to migrate-to-shoehorn, differing in 0 lines, and is treated as a copy.