migrate-to-shoehorn

migrate-to-shoehorn is a skill for Claude Code, Codex from vinvcn/mattpocock-skills-zh-CN. It costs 53 tokens per session (778 once invoked), scanned A, original, MIT.

A testing guide for Shoehorn, a TypeScript library that lets tests provide only the fields they need from a larger data type.

In plain words
What is it for?
It is for replacing test-only type casts with `fromPartial()` and related Shoehorn patterns. It should not be used in production code.
Why use it?
It removes the need to build complete fake objects or use unsafe `as` type assertions in tests.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present.

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

Good fit It is for replacing test-only type casts with fromPartial() and related Shoehorn patterns. It should not be used in production code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vinvcn/mattpocock-skills-zh-cn/migrate-to-shoehorn
About the project

mattpocock-skills-zh-CN is a Simplified Chinese localization of a collection of reusable instructions for coding agents. Chinese-speaking developers use the translated skills to support engineering workflows while keeping their original commands, paths, identifiers, and behavior. The catalogue contains the localized skills, instructions, and plugin components.

vinvcn/mattpocock-skills-zh-CN · 5,317 stars · on GitHub · skills.sh

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 vinvcn/mattpocock-skills-zh-CN --skill migrate-to-shoehorn
Clone the repo
git clone --depth 1 https://github.com/vinvcn/mattpocock-skills-zh-CN

Made for: Claude Code, Codex.

Or install mattpocock-skills, the plugin that ships this one along with the rest of its 38 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/vinvcn/mattpocock-skills-zh-cn/migrate-to-shoehorn/github.svg)](https://agentmods.dev/skills/vinvcn/mattpocock-skills-zh-cn/migrate-to-shoehorn)
Your own site
<a href="https://agentmods.dev/skills/vinvcn/mattpocock-skills-zh-cn/migrate-to-shoehorn"><img src="https://agentmods.dev/badge/skills/vinvcn/mattpocock-skills-zh-cn/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/vinvcn/mattpocock-skills-zh-cn/migrate-to-shoehorn"><img src="https://agentmods.dev/badge/skills/vinvcn/mattpocock-skills-zh-cn/migrate-to-shoehorn.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 778 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. Third-party audits
  • Socket pass 14 Sept 2026
  • Snyk pass 14 Sept 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found 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.00053 $0.00778
Opus 5.5 $0.00021 $0.00311
Sonnet 5.5 $0.00011 $0.00156
Haiku 4.5 $0.00005 $0.00078

Measured 18d ago against content hash 8c0844abd552, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 18d 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.

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.

迁移到 Shoehorn

为什么用 shoehorn?

shoehorn 允许你在 tests 中传入 partial data,同时保持 TypeScript 满意。它用 type-safe alternatives 替换 as assertions。

只用于 test code。 永远不要在 production code 中使用 shoehorn。

Tests 中 as 的问题:

  • 经过训练,不去使用它
  • 必须手动指定 target type
  • 对故意错误的数据需要 double-as(as unknown as Type)

安装

npm i @total-typescript/shoehorn

迁移模式

只需要少数属性的大型 objects

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() 传入仍能 type-check 的 partial data
fromAny() 传入故意错误的数据(保留 autocomplete)
fromExact() 强制 full object(之后可换成 fromPartial)

工作流

  1. Gather requirements - 询问用户:

    • 哪些 test files 中的 as assertions 造成问题?
    • 是否在处理大型 objects,但只关心部分 properties?
    • 是否需要传入故意错误的数据来测试 error paths?
  2. Install and migrate:

    • Install: npm i @total-typescript/shoehorn
    • 查找 test files 中的 as assertions: grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts"
    • 用 fromPartial() 替换 as Type
    • 用 fromAny() 替换 as unknown as Type
    • 添加来自 @total-typescript/shoehorn 的 imports
    • 运行 type check 验证

Read the full file on GitHub · 119 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 18d ago Changed 8c0844abd552
  2. 1mo ago First seen · 119 lines · 53 tokens per session scan A 2034e5ae753f

Subscribe to this mod's changes

migrate-to-shoehorn is a skill published in the GitHub repository vinvcn/mattpocock-skills-zh-CN (5,317 stars, last pushed 7d ago), licensed MIT. It adds 53 tokens to every session and 778 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

migrate-to-shoehorn

A testing utility that replaces TypeScript's `as` type assertions with Shoehorn helpers for creating partial or intentionally invalid test data.

devcxl/mattpocock-skills-zh · 53 tokens

tdd

Guidance for test-driven development (TDD), a method where you write a failing test, make it pass with a small change, and then improve the code. It focuses on tests that check user-visible behavior through public interfaces.

devcxl/mattpocock-skills-zh · 39 tokens

claude-handoff

A handoff tool that prepares a summary of the current conversation for another coding agent and starts that agent in the background.

devcxl/mattpocock-skills-zh · 25 tokens

pair-programming

AI-assisted pair programming with multiple modes (driver/navigator/switch), real-time verification, quality monitoring, and comprehensive testing. Supports TDD, debugging, refactoring, and learning sessions. Features automatic role switching, continuous code review, security scanning, and performance optimization with…

frankxai/claude-skills-library · 85 tokens

visual-proof

Capture before/after screenshot evidence of a web page at real breakpoints (375, 768, 1440) in both light and dark themes, using Playwright against a local dev server or a deployed URL. Use before starting any visual change to capture the current state, and again after to prove the delta. Also use when asked to "show…

frankxai/claude-skills-library · 116 tokens

neutron-log

Measure whether a token-saving tool actually saves tokens and keeps answers correct. Use before adopting or recommending RTK, headroom, caveman or any compressor, after changing a hook or instruction file, and when someone quotes a savings percentage. Runs a same-task before and after protocol and records only…

frankxai/claude-skills-library · 65 tokens