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.
npx skills add devcxl/mattpocock-skills-zh --skill migrate-to-shoehorngit clone --depth 1 https://github.com/devcxl/mattpocock-skills-zhWrote 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.
[](https://agentmods.dev/skills/devcxl/mattpocock-skills-zh/migrate-to-shoehorn)<a href="https://agentmods.dev/skills/devcxl/mattpocock-skills-zh/migrate-to-shoehorn"><img src="https://agentmods.dev/badge/skills/devcxl/mattpocock-skills-zh/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.
<a href="https://agentmods.dev/skills/devcxl/mattpocock-skills-zh/migrate-to-shoehorn"><img src="https://agentmods.dev/badge/skills/devcxl/mattpocock-skills-zh/migrate-to-shoehorn.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00053 | $0.00831 |
| Opus 5.5 | $0.00021 | $0.00332 |
| Sonnet 5.5 | $0.00011 | $0.00166 |
| Haiku 4.5 | $0.00005 | $0.00083 |
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 1mo 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.
What it actually says
迁移到 Shoehorn
为什么使用 shoehorn?
shoehorn 让你在测试中传递部分数据,同时保持 TypeScript 类型正确。它用类型安全的替代方案取代了 as 断言。
仅限测试代码。 切勿在生产代码中使用 shoehorn。
as 在测试中的问题:
- 习惯上被训练不要使用它
- 必须手动指定目标类型
- 双重
as(as unknown as Type)用于传递故意错误的数据
安装
npm i @total-typescript/shoehorn
迁移模式
大型对象,只用到少数属性
迁移前:
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 个属性
});
});
迁移后:
import { fromPartial } from "@total-typescript/shoehorn";
it("gets user by id", () => {
getUser(
fromPartial({
body: { id: "123" },
}),
);
});
as Type → fromPartial()
迁移前:
getUser({ body: { id: "123" } } as Request);
迁移后:
import { fromPartial } from "@total-typescript/shoehorn";
getUser(fromPartial({ body: { id: "123" } }));
as unknown as Type → fromAny()
迁移前:
getUser({ body: { id: 123 } } as unknown as Request); // 故意传错类型
迁移后:
import { fromAny } from "@total-typescript/shoehorn";
getUser(fromAny({ body: { id: 123 } }));
各函数的适用场景
| 函数 | 使用场景 |
|---|---|
fromPartial() |
传递部分数据,仍能通过类型检查 |
fromAny() |
传递故意错误的数据(保留自动补全) |
fromExact() |
强制传入完整对象(后续可替换为 fromPartial) |
工作流程
-
收集需求 — 询问用户:
- 哪些测试文件中的
as断言造成了问题? - 是否涉及大型对象,只有部分属性是重要的?
- 是否需要传递故意错误的数据用于错误测试?
- 哪些测试文件中的
-
安装并迁移:
- 安装:
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 - 运行类型检查以验证
- 安装:
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.
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.
- 1mo ago First seen · 119 lines · 53 tokens per session scan A f62fd103c644
migrate-to-shoehorn is a skill published in the GitHub repository devcxl/mattpocock-skills-zh (512 stars, last pushed 4d ago), licensed MIT. It adds 53 tokens to every session and 831 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.
Other skills, from other repositories
migrate-to-shoehorn
A testing guide for Shoehorn, a TypeScript library that lets tests provide only the fields they need from a larger data type.
tdd
A reference for Test-Driven Development (TDD), a method where you write a failing test, make it pass, and then improve the code. It covers how to write durable tests, where to place them, and which patterns to avoid.
ai-prompt-regression-testing
Prompt engineering regression test matrix register: baseline outputs, semantic drift thresholds, judge evaluations, and golden dataset.
verification-before-completion
A checklist for verifying work before claiming that it is finished, fixed, built, tested, or ready to submit. It requires fresh command output and evidence for each claim.
wayfinder
A planning method that maps a large, uncertain project into linked decision tickets in a repository's issue tracker. An issue tracker is a system for recording and organizing project work.
codebase-design
A shared vocabulary and design guide for shaping code modules: small interfaces hide substantial behavior, with clear seams where behavior can be changed or tested.