← All agent skills

Skills-compatible agents / TypeScript testing

Replace Test Fixture Casts With Shoehorn

Reworks TypeScript test fixtures to distinguish partial valid data from intentionally invalid inputs using Shoehorn helpers.

318,785 repository stars · checked 2026-11-09. Count applies to mattpocock/skills, not this individual skill.

Guide by IDAKIM Digital. Source review: . Original explanation based on the linked publisher sources.

What it does

The source targets test code only. fromPartial replaces a cast around an object containing the relevant subset of fields. fromAny expresses deliberately malformed inputs, while fromExact can require a complete object. The workflow begins by locating troublesome assertions and clarifying whether the tests need partial objects or invalid data. It then adds the dependency and imports before checking types. The useful distinction is test intent; replacing every occurrence of as without understanding its purpose would be a poor migration.

When to use it

  • Reduce irrelevant fields in a large request fixture.
  • Make a deliberately wrong input obvious in a validation test.
  • Replace double casts in a bounded set of TypeScript tests.

Step-by-step workflow

  1. Identify the test files and explain why their assertions exist.
  2. Separate partial valid fixtures from deliberately invalid inputs.
  3. Review the project’s dependency policy and select the corresponding helper.
  4. Migrate only the agreed tests and add explicit imports.
  5. Run type checking and the affected behavior tests, inspecting the final diff.

Example request

Review our importer tests with migrate-to-shoehorn. List casts that only fill irrelevant Request fields separately from casts used to test a numeric invoice ID. Propose fromPartial for the former and fromAny for the latter. Keep runtime input validation intact. Do not touch production code or add the package until the dependency change is authorized. Preserve each test’s original assertion.

Worked example

A getUser test might only read body.id even though the Request type has many other fields. A partial helper can make that intent clear. A test passing an integer where a string is required needs a different helper because the wrong type is the point. Neither helper should leak into the production request handler, where external input still needs validation. After migration, the test must continue failing if the implementation stops rejecting the invalid identifier.

What you get

Focused test-fixture edits with the chosen helper for each intent and recorded type-check and test outcomes.

How to evaluate the result

  • Confirm all edited files are tests.
  • Check invalid-input cases still exercise a real runtime rejection.
  • Verify partial fixtures include every property the tested path reads.

What you need

A TypeScript test suite, knowledge of the code paths exercised and permission for any dependency change. The upstream package is @total-typescript/shoehorn.

Setup and activation

The publisher documents plugin setup for Claude Code, Codex and Copilot, and manual Agent Skills setup for Gemini CLI and other clients. Choose one distribution method per client to avoid duplicate skills. The engineering collection expects project-specific tracker, triage-label and document-location settings from setup-matt-pocock-skills. Keep referenced companion skills and files available. This catalogue review does not install or run them; scan the exact source before any later installation. Client tools, permissions and subagent support still need separate validation.

Limits and considerations

This adds a dependency and relaxes fixture completeness deliberately. Missing fields that the implementation actually reads can still cause runtime failures. It is unsuitable for production data validation or blind conversion of unrelated type assertions.

Related workflows

  • Use tdd when changing the behavior a fixture exercises.
  • Use code-review to catch production imports and unrelated cast changes.

License and reuse

MIT at repository level (Copyright 2026 Matt Pocock). Preserve the copyright and permission notice when redistributing substantial source material; inspect any separately licensed dependencies or assets.

Further reading

Read the original source

Publisher: mattpocock/skills
Source reviewed: 2026-11-09

View SKILL.md on GitHub ↗

Source reviewed; not installed, executed or security-scanned for this directory. These example requests were written by IDAKIM Digital. Upstream content can change.