migrate-to-shoehorn
by mattpocockmigrate-to-shoehorn helps you replace `as` casts in TypeScript tests with @total-typescript/shoehorn for safer partial fixtures. Use this migrate-to-shoehorn skill when you need to clean up cast-heavy test data, follow the migrate-to-shoehorn guide, or standardize migrate-to-shoehorn for Test Automation.
This skill scores 68/100, which means it is list-worthy but best framed as a focused test-migration utility rather than a broad workflow skill. Directory users should understand that it provides concrete, installable guidance for replacing `as`-based test assertions with Shoehorn helpers, but it is narrowly scoped and somewhat reliant on the repository content to explain the full pattern.
- Clear triggerability: the frontmatter says to use it when users mention Shoehorn, want to replace `as` in tests, or need partial test data.
- Operationally concrete: the SKILL.md includes before/after migration examples for `as Type` and `as unknown as Type`, plus an install command for `@total-typescript/shoehorn`.
- Good agent leverage for test-only refactors: it explicitly warns against production use and focuses on a specific type-safe alternative for partial test objects.
- Narrow scope: the skill is explicitly test-code only, so it is not useful for broader application refactoring or production patterns.
- Somewhat limited supporting structure: there are no scripts, references, or resources, so agents must rely mainly on the narrative examples in SKILL.md.
Overview of migrate-to-shoehorn skill
What the migrate-to-shoehorn skill does
The migrate-to-shoehorn skill helps you replace brittle as casts in test code with @total-typescript/shoehorn, so you can build partial test data without fighting TypeScript. It is a good fit when you have oversized fixtures, only care about a few nested fields, or are cleaning up as unknown as Type patterns in tests.
Who should use it
Use this migrate-to-shoehorn skill if you work in TypeScript test suites and want safer fixture construction with less boilerplate. It is especially useful for engineers updating existing tests, writing new integration-style tests, or standardizing a codebase that currently leans on cast-heavy mocks.
What makes it useful
The main value is not just syntax replacement; it is reducing test setup friction while keeping type intent visible. The skill pushes you toward fromPartial() for incomplete objects and fromAny() for cases where the test intentionally breaks type shape, which makes the tradeoff explicit instead of hidden inside casts.
How to Use migrate-to-shoehorn skill
Install the migrate-to-shoehorn skill
Install it with:
npx skills add mattpocock/skills --skill migrate-to-shoehorn
After install, read SKILL.md first, then inspect any linked repository files if they exist in your environment. For this repo, the skill content is concentrated in one file, so the practical guidance lives close to the implementation examples.
Turn a rough goal into a good prompt
The best migrate-to-shoehorn usage starts with a concrete test snippet, not a vague request. Good input looks like: “Convert this test from as Request to fromPartial() and preserve the existing assertion behavior,” or “Rewrite these as unknown as fixtures using fromAny() where the test intentionally passes invalid data.”
What the skill expects from you
Provide the object shape, the test framework context, and the exact cast pattern you want removed. If a fixture is deeply nested, mention the properties that actually matter, because the skill is most effective when it can preserve only the required fields and drop the rest of the fake structure.
Practical workflow and repo reading path
Start with SKILL.md to confirm the migration pattern, then look for places where the code currently uses as Type or as unknown as Type in tests. When applying the migrate-to-shoehorn guide, first decide whether the test wants valid partial data or deliberately invalid data; that choice determines whether fromPartial() or fromAny() is the right replacement.
migrate-to-shoehorn skill FAQ
Is migrate-to-shoehorn only for tests?
Yes. The skill is explicitly for test code, not production code. If you need runtime validation or production-safe coercion, migrate-to-shoehorn is the wrong tool.
When should I use fromPartial() vs fromAny()?
Use fromPartial() when the object is incomplete but still structurally aligned with the target type. Use fromAny() when the test intentionally supplies invalid or impossible values and you need to bypass type checking for that scenario.
Is the migrate-to-shoehorn skill better than a generic prompt?
Usually yes, because it gives a focused migration pattern instead of broad advice. A generic prompt may tell you to “avoid casts,” but the migrate-to-shoehorn skill tells you which replacement to use and how to treat large fixture objects, which reduces rewrite guesswork.
Is it beginner friendly?
Yes, if you already understand basic TypeScript tests. The main learning curve is recognizing whether your fixture is “partial but valid” or “intentionally unsafe,” since that decides the helper to use.
How to Improve migrate-to-shoehorn skill
Give the skill the real test intent
The strongest migrate-to-shoehorn input includes the behavior the test is proving, not just the object literal. For example, “this test only cares about body.id and headers.authorization” produces better output than “convert this fixture,” because the skill can trim the object to the minimum meaningful shape.
Avoid the two common failure modes
The first failure mode is preserving too much fixture noise, which defeats the point of using migrate-to-shoehorn. The second is using fromAny() everywhere, which weakens type signal; prefer the narrowest helper that matches the test’s intent.
Iterate after the first conversion
After the initial migrate-to-shoehorn pass, review whether the test still communicates the contract clearly. If the output still contains unnecessary properties, remove them; if the test needed an unsafe value, confirm that the fromAny() choice is deliberate and documented by the scenario itself.
Tune your prompt for repository-specific constraints
If your codebase has testing conventions, mention them up front: Jest or Vitest, factory helpers, shared request objects, or lint rules around imports. That context helps the migrate-to-shoehorn skill produce changes that fit your repo instead of merely translating syntax.
