Agent skill

Migrate To Shoehorn

by vinvcn in vinvcn/mattpocock-skills-zh-CN

将测试文件从 as 类型断言迁移到 @total-typescript/shoehorn。适用于用户提到 shoehorn、想替换测试中的 as,或需要局部测试数据时。

MITAuto-check passed

Install Migrate To Shoehorn

skills CLI
$ npx skills add vinvcn/mattpocock-skills-zh-CN --skill migrate-to-shoehorn -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install vinvcn/mattpocock-skills-zh-CN migrate-to-shoehorn --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/vinvcn/mattpocock-skills-zh-CN.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/misc/migrate-to-shoehorn .claude/skills/migrate-to-shoehorn && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
migrate-to-shoehorn
GitHub stars
4.7k
Token cost
~603 tokens
SKILL.md length
132 words
Files
2
Skills in repo
32
Repo updated
First seen
Licence
MIT

At a glance

将测试文件从 as 类型断言迁移到 @total-typescript/shoehorn。适用于用户提到 shoehorn、想替换测试中的 as,或需要局部测试数据时。

  • Works in 2 steps: Gather requirements - 询问用户 → Install and migrate
  • SKILL.md covers 为什么用 shoehorn?, 安装, 迁移模式 and 何时使用哪一个, plus 1 more section
  • Calls npm

What it does

Migrate To Shoehorn is an agent skill from vinvcn/mattpocock-skills-zh-CN. 将测试文件从 as 类型断言迁移到 @total-typescript/shoehorn。适用于用户提到 shoehorn、想替换测试中的 as,或需要局部测试数据时。

Its SKILL.md is about 600 tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `agents/openai.yaml`).

It works with TypeScript. The repository describes itself as: 这是 mattpocock/skills 的简体中文本地化版本。 The licence is MIT.

Example prompts

  • “/migrate-to-shoehorn”

Requirements

  • Node.js

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. Gather requirements - 询问用户
  2. Install and migrate

What it can do on your machine

Read from SKILL.md and the folder at commit bf98e53. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Migrate To Shoehorn loads about 603 tokens when it runs. Until then it costs about 27 tokens; SKILL.md has 132 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~27
When it runs · the whole SKILL.md, loaded when a task matches
~603

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from vinvcn/mattpocock-skills-zh-CN at commit bf98e53, republished under its MIT licence (© vinvcn). 132 words, ~603 tokens.

Download SKILL.mdSave it as .claude/skills/migrate-to-shoehorn/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
migrate-to-shoehorn
description
将测试文件从 `as` 类型断言迁移到 @total-typescript/shoehorn。适用于用户提到 shoehorn、想替换测试中的 `as`,或需要局部测试数据时。

迁移到 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)

安装

bash
npm i @total-typescript/shoehorn

迁移模式

只需要少数属性的大型 objects

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:

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

getUser(fromAny({ body: { id: 123 } }));

何时使用哪一个

FunctionUse 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 验证

© vinvcn, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in skills/misc/migrate-to-shoehorn of vinvcn/mattpocock-skills-zh-CN.

  • SKILL.md
  • agents/openai.yaml

Open the folder on GitHubat commit bf98e53

Compare with similar skills

Migrate To Shoehorn next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Migrate To Shoehorn compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Migrate To Shoehorn this skillvinvcn/mattpocock-skills-zh-CN4.7k—~603Automated safety check: PassMIT
MCP Server Builderanthropics/skills180k63 repos~2.3kAutomated safety check: PassApache-2.0
Web Artifacts Builderanthropics/skills180k40 repos~769Automated safety check: PassApache-2.0
Typescript Advanced Typesrolling-scopes/rsschool-app10k25 repos~4.2kAutomated safety check: PassMPL-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k4 repos~1.1kAutomated safety check: PassMIT
MCP Server BuildershareAI-lab/learn-claude-code78k4 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 63 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • Web Artifacts Builder

    anthropics/skills

    Official

    Builds multi-component claude.ai HTML artifacts as a small React, TypeScript and Tailwind project, then bundles it into one shareable HTML file.

    180k GitHub starsUsed in 40 repos~769 tokens
    Frontend & DesignAuto-check passed
  • Typescript Advanced Types

    rolling-scopes/rsschool-app

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.

    10k GitHub starsUsed in 25 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 4 repos~1.1k tokens
    DevelopmentAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 4 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • Nx Import

    nrwl/nx

    Import, merge, or combine repositories into an Nx workspace using nx import.

    29k GitHub starsUsed in 6 repos~3.5k tokens
    DevelopmentAuto-check passed

More from vinvcn/mattpocock-skills-zh-CN

All 32 skills in this repo
  • Git Guardrails Claude Code

    vinvcn/mattpocock-skills-zh-CN

    设置 Claude Code hooks,在危险 git commands(push、reset --hard、clean、branch -D 等)执行前阻止它们。适用于用户想防止破坏性 git 操作、添加 git safety hooks,或在 Claude Code 中阻止 git push/reset 时。

    4.7k GitHub stars~461 tokensUpdated 2 days ago
    Auto-check passed
  • Codebase Design

    vinvcn/mattpocock-skills-zh-CN

    用于设计深模块的共享词汇。适用于用户想设计或改进模块接口、寻找深化机会、决定 seam 放在哪里、让代码更容易测试或更适合 AI 导航,或其他技能需要深模块词汇时。

    4.7k GitHub stars~1.1k tokensUpdated 2 days ago
    Auto-check passed
  • Diagnosing Bugs

    vinvcn/mattpocock-skills-zh-CN

    面向棘手缺陷和性能回退的诊断循环。适用于用户说 “diagnose” / “debug this”,或报告某些东西 broken、throwing、failing、slow 时。

    4.7k GitHub stars~1.4k tokensUpdated 2 days ago
    Auto-check passed
  • Domain Modeling

    vinvcn/mattpocock-skills-zh-CN

    构建并打磨项目的领域模型。适用于讨论 codebase 术语、编写或编辑 GLOSSARY.md,或记录或编辑 ADR。

    4.7k GitHub stars~477 tokensUpdated 2 days ago
    Auto-check passed
  • PR

    vinvcn/mattpocock-skills-zh-CN

    用于撰写 PR 正文。适用于用户要求起草、改写或改进 PR 正文,或希望 PR 更便于审阅时. An agent skill from vinvcn/mattpocock-skills-zh-CN.

    4.7k GitHub stars~729 tokensUpdated 2 days ago
    Auto-check passed
  • Scaffold Exercises

    vinvcn/mattpocock-skills-zh-CN

    创建包含章节、题目、答案和讲解的练习目录结构,并确保通过 linting。适用于用户想 scaffold exercises、创建 exercise stubs,或设置新的课程章节时。

    4.7k GitHub stars~748 tokensUpdated 2 days ago
    Auto-check passed

Works with

Questions about Migrate To Shoehorn

What does Migrate To Shoehorn do?

将测试文件从 as 类型断言迁移到 @total-typescript/shoehorn。适用于用户提到 shoehorn、想替换测试中的 as,或需要局部测试数据时。. Migrate To Shoehorn is an agent skill from vinvcn/mattpocock-skills-zh-CN.

How do I install Migrate To Shoehorn in Claude Code?

Run `npx skills add vinvcn/mattpocock-skills-zh-CN --skill migrate-to-shoehorn -a claude-code`. Or copy the skill folder (skills/misc/migrate-to-shoehorn in vinvcn/mattpocock-skills-zh-CN) into .claude/skills/migrate-to-shoehorn in your project. Claude Code loads it when a task matches its description.

How do I install Migrate To Shoehorn in Codex?

Run `npx skills add vinvcn/mattpocock-skills-zh-CN --skill migrate-to-shoehorn -a codex`. Or copy the skill folder (skills/misc/migrate-to-shoehorn in vinvcn/mattpocock-skills-zh-CN) into .agents/skills/migrate-to-shoehorn in your project. Codex loads it when a task matches its description.

Can I use Migrate To Shoehorn in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add vinvcn/mattpocock-skills-zh-CN --skill migrate-to-shoehorn -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/migrate-to-shoehorn, .gemini/skills/migrate-to-shoehorn, .github/skills/migrate-to-shoehorn and .opencode/skills/migrate-to-shoehorn in your project.

What does Migrate To Shoehorn need to run?

Going by SKILL.md and its folder, Migrate To Shoehorn needs the command-line tools its instructions call (npm). Our summary lists: Node.js.

Does Migrate To Shoehorn access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Migrate To Shoehorn safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Migrate To Shoehorn use?

Migrate To Shoehorn is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Migrate To Shoehorn use?

About 603 tokens (SKILL.md is roughly 2.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Migrate To Shoehorn?

Skills that share tags, products or a category with Migrate To Shoehorn: MCP Server Builder (anthropics/skills, 180k stars), Web Artifacts Builder (anthropics/skills, 180k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and Code Review Checklist (shareAI-lab/learn-claude-code, 78k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Migrate To Shoehorn?

vinvcn (a GitHub user) maintains it in vinvcn/mattpocock-skills-zh-CN, which has 4,712 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 8, 2026.

Source: vinvcn/mattpocock-skills-zh-CN on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.