Test type fixer
Point it at your tests. Get unsafe type casts swapped for shoehorn so test data stays typed.
Test type fixer is a free AI skill for the job "Test and fix code". Give the instructions to an AI assistant that supports the required files and tools, then review its output.
Free · No account · MIT licence · Made by Matt Pocock · Level: advanced · Thinking: low
Made by Matt Pocock. See the original on GitHub; we copied it as it is, with its licence.
What it does
Test files full of "as" casts hide type mistakes and force you to fake every field of a big object. This skill swaps those casts for the shoehorn library, so your tests pass only the data they care about and TypeScript still checks it. It installs the package, then works through the test files one pattern at a time. A large object with two needed fields becomes a partial. Data that is wrong on purpose, like a missing field you want to test, gets its own helper instead of a double cast. It touches test code only and never edits production files. Afterward it runs the type check to confirm nothing broke.
You give it
- Your test files or folder
- Your TypeScript project
- Permission to install one package
You get
- Test files with casts replaced
- Partial test data that still type checks
- A passing type check
- A note on any case left as is
Use it when
- Your tests are littered with "as unknown as" casts and you want them gone.
- You fake a 20-field request object just to test one field.
- You want test data that stays checked by TypeScript.
- A code review asked you to remove type assertions from tests.
How to use it
- Add it to your AI once: download it and add the folder to Claude, ChatGPT or Codex as a skill.
- Ask for the job in your own words. Your AI opens the skill when it fits.
- It works best when your AI can run code and read your project files.