migrate-to-shoehorn
Migrate test files from `as` type assertions to @total-typescript/shoehorn
Install / Use
npx skills add mattpocock/skills --skill migrate-to-shoehornInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Tags
Our assessment of migrate-to-shoehorn
migrate-to-shoehorn scores 87/100 on our quality scale, 367th of 1,751 Development & Engineering skills we index (top 21%).
Its SKILL.md is 2.7 KB long, well organised into 9 sections with 7 code examples: a solid amount of guidance for an agent.
With 268,790 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated yesterday, so migrate-to-shoehorn is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
migrate-to-shoehorn compared with similar skills
All 4 of these similar skills score higher than migrate-to-shoehorn; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| migrate-to-shoehorn (this skill)by mattpocock | 87 | 268.8k | 1d ago | SKILL.md |
| headroomby headroomlabs-ai | 100 | 73.8k | today | CLAUDE.md |
| rufloby ruvnet | 100 | 73.2k | today | CLAUDE.md |
| ai-job-searchby MadsLorentzen | 100 | 43.9k | 4d ago | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 41.7k | 5d ago | CLAUDE.md |
Frequently asked questions
- How do I install migrate-to-shoehorn?
- Run
npx skills add mattpocock/skills --skill migrate-to-shoehorn. The install tabs above show the steps for each supported agent. - Which AI agents does migrate-to-shoehorn work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is migrate-to-shoehorn safe to use?
- It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is migrate-to-shoehorn still maintained?
- The repository was last updated yesterday, so migrate-to-shoehorn is actively maintained.
Skill content
View source on GitHubname: migrate-to-shoehorn
description: Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.
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 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 } }));
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
-
Gather requirements - ask user:
- What test files have
asassertions causing problems? - Are they dealing with large objects where only some properties matter?
- Do they need to pass intentionally wrong data for error testing?
- What test files have
-
Install and migrate:
- [ ] Install:
npm i @total-typescript/shoehorn - [ ] Find test files with
asassertions:grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts" - [ ] Replace
as TypewithfromPartial() - [ ] Replace
as unknown as TypewithfromAny() - [ ] Add imports from
@total-typescript/shoehorn - [ ] Run type check to verify
- [ ] Install:
Related Skills
headroom
73.8kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
ruflo
73.2k🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
ai-job-search
43.9kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
41.7kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
