Agent skill

Migrate To Shoehorn

by devcxl in devcxl/mattpocock-skills-zh

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

MITAuto-check passedDevelopment

Install Migrate To Shoehorn

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

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

GitHub CLI
$ gh skill install devcxl/mattpocock-skills-zh 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/devcxl/mattpocock-skills-zh.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
449
Token cost
~522 tokens
SKILL.md length
88 words
Files
2
Skills in repo
18
Repo updated
First seen
Licence
MIT

At a glance

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

  • Works in 2 steps: 收集需求 — 询问用户 → 安装并迁移
  • Development work in your project
  • SKILL.md covers 为什么使用 shoehorn?, 安装, 迁移模式 and 各函数的适用场景, plus 1 more section
  • Calls npm

What it does

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

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

It sits in Development. It works with TypeScript. The repository describes itself as: Matt Pocock 技能集的中文翻译版 — 地道中文,原汁原味的技术术语。基于 mattpocock/skills 复刻。每日中午12点钟同步. The licence is MIT.

When your agent uses it

  • Development work in your project

Example prompts

  • “/migrate-to-shoehorn”

Requirements

  • Node.js

Workflow steps

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

  1. 收集需求 — 询问用户
  2. 安装并迁移

What it can do on your machine

Read from SKILL.md and the folder at commit 05f3ef5. 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 522 tokens when it runs. Until then it costs about 27 tokens; SKILL.md has 88 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
~522

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 devcxl/mattpocock-skills-zh at commit 05f3ef5, republished under its MIT licence (© devcxl). 88 words, ~522 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 让你在测试中传递部分数据,同时保持 TypeScript 类型正确。它用类型安全的替代方案取代了 as 断言。

仅限测试代码。 切勿在生产代码中使用 shoehorn。

as 在测试中的问题:

  • 习惯上被训练不要使用它
  • 必须手动指定目标类型
  • 双重 as(as unknown as Type)用于传递故意错误的数据

安装

bash
npm i @total-typescript/shoehorn

迁移模式

大型对象,只用到少数属性

迁移前:

ts
type Request = {
  body: { id: string };
  headers: Record<string, string>;
  cookies: Record<string, string>;
  // ...还有 20 个属性
};

it("gets user by id", () => {
  // 只关心 body.id,但必须伪造整个 Request
  getUser({
    body: { id: "123" },
    headers: {},
    cookies: {},
    // ...伪造所有 20 个属性
  });
});

迁移后:

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

it("gets user by id", () => {
  getUser(
    fromPartial({
      body: { id: "123" },
    }),
  );
});
as Type → fromPartial()

迁移前:

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

迁移后:

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

getUser(fromPartial({ body: { id: "123" } }));
as unknown as Type → fromAny()

迁移前:

ts
getUser({ body: { id: 123 } } as unknown as Request); // 故意传错类型

迁移后:

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

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

各函数的适用场景

函数使用场景
fromPartial()传递部分数据,仍能通过类型检查
fromAny()传递故意错误的数据(保留自动补全)
fromExact()强制传入完整对象(后续可替换为 fromPartial)

工作流程

  1. 收集需求 — 询问用户:

    • 哪些测试文件中的 as 断言造成了问题?
    • 是否涉及大型对象,只有部分属性是重要的?
    • 是否需要传递故意错误的数据用于错误测试?
  2. 安装并迁移:

    • 安装:npm i @total-typescript/shoehorn
    • 查找含有 as 断言的测试文件:grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts"
    • 将 as Type 替换为 fromPartial()
    • 将 as unknown as Type 替换为 fromAny()
    • 从 @total-typescript/shoehorn 添加 import
    • 运行类型检查以验证

© devcxl, 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 devcxl/mattpocock-skills-zh.

  • SKILL.md
  • agents/openai.yaml

Open the folder on GitHubat commit 05f3ef5

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 skilldevcxl/mattpocock-skills-zh449—~522Automated safety check: PassMIT
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
Nx Importnrwl/nx29k6 repos~3.5kAutomated safety check: PassMIT
Install Anti-Slop Oxlint Rulesdmmulroy/anti-slop5.4k—~2.2kAutomated safety check: PassMIT
OpenTUI Terminal Interfacescline/cline70k—~1.9kAutomated safety check: PassApache-2.0

Similar skills

  • 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
  • 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
  • Installs, updates or migrates the vendored anti-slop Oxlint plugin in a repository, keeping local rule changes and the plugin's license and provenance files.

    5.4k GitHub stars~2.2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Helps build terminal user interfaces with OpenTUI using its core imperative API or its React and Solid reconcilers, with references for layout, keyboard, animation and testing.

    70k GitHub stars~1.9k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Frontend Code Review

    langgenius/dify

    Reviews frontend changes under `web/` or `packages/dify-ui/` for concrete defects and broken project contracts, using routed rule packs and a severity scale for findings.

    158k GitHub stars~938 tokensUpdated today
    DevelopmentAuto-check passed

More from devcxl/mattpocock-skills-zh

All 18 skills in this repo
  • Git Guardrails Claude Code

    devcxl/mattpocock-skills-zh

    设置 Claude Code 钩子,在危险 Git 命令(push、reset --hard、clean、branch -D 等)执行前将其拦截。当用户想要防止破坏性 Git 操作、添加 Git 安全钩子或在 Claude Code 中阻止 git push/reset 时使用。

    449 GitHub stars~420 tokensUpdated yesterday
    Auto-check passed
  • Codebase Design

    devcxl/mattpocock-skills-zh

    设计深度模块的共享词汇。当用户想要设计或改进模块的接口、寻找深化机会、决定 seam 的位置、让代码更可测试或更易被 AI 导航,或者其他 skill 需要深度模块词汇时使用。

    449 GitHub stars~809 tokensUpdated yesterday
    Auto-check passed
  • Diagnosing Bugs

    devcxl/mattpocock-skills-zh

    针对棘手 bug 和性能回归的诊断循环。当用户说"诊断"/"调试这个",或报告某处崩溃/报错/不正常/缓慢时使用. An agent skill from devcxl/mattpocock-skills-zh.

    449 GitHub stars~973 tokensUpdated yesterday
    Auto-check passed
  • Domain Modeling

    devcxl/mattpocock-skills-zh

    构建和完善项目的领域模型。当讨论代码库术语、编写或编辑 GLOSSARY.md,或记录或编辑 ADR 时使用. An agent skill from devcxl/mattpocock-skills-zh.

    449 GitHub stars~412 tokensUpdated yesterday
    Auto-check passed
  • Scaffold Exercises

    devcxl/mattpocock-skills-zh

    创建包含 section、problem、solution 和 explainer 的练习目录结构,且能通过 lint 检查。当用户想要搭建练习框架、创建练习模板或设置新的课程章节时使用。

    449 GitHub stars~659 tokensUpdated yesterday
    Auto-check passed
  • Setup Matt Pocock Skills

    devcxl/mattpocock-skills-zh

    为本仓库配置工程技能——设置其 issue tracker、分诊标签词汇表和领域文档布局。首次使用其他工程技能前运行一次。

    449 GitHub stars~971 tokensUpdated yesterday
    Auto-check passed

Works with

Categories

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 devcxl/mattpocock-skills-zh.

When should I use Migrate To Shoehorn?

Migrate To Shoehorn fits situations like: development work in your project.

How do I install Migrate To Shoehorn in Claude Code?

Run `npx skills add devcxl/mattpocock-skills-zh --skill migrate-to-shoehorn -a claude-code`. Or copy the skill folder (skills/misc/migrate-to-shoehorn in devcxl/mattpocock-skills-zh) 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 devcxl/mattpocock-skills-zh --skill migrate-to-shoehorn -a codex`. Or copy the skill folder (skills/misc/migrate-to-shoehorn in devcxl/mattpocock-skills-zh) 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 devcxl/mattpocock-skills-zh --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 522 tokens (SKILL.md is roughly 2.1k 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: Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars), Code Review Checklist (shareAI-lab/learn-claude-code, 78k stars), Nx Import (nrwl/nx, 29k stars) and Install Anti-Slop Oxlint Rules (dmmulroy/anti-slop, 5.4k 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?

devcxl (a GitHub user) maintains it in devcxl/mattpocock-skills-zh, which has 449 GitHub stars. The repository holds 18 skills in this directory. The repository was last updated on October 9, 2026.

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