AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Migrate To Shoehorn

skill-boom-vitt-skills-thai-migrate-to-shoehorn · by Boom-Vitt

ย้าย test file จาก type assertion แบบ `as` ไปใช้ @total-typescript/shoehorn ใช้เมื่อ user พูดถึง shoehorn อยากเลิกใช้ `as` ใน test หรือต้องการส่ง test data แบบ partial

No reviews yet
0 installs
10 views
0.0% view→install

Install

$ agentstack add skill-boom-vitt-skills-thai-migrate-to-shoehorn

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-boom-vitt-skills-thai-migrate-to-shoehorn)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Migrate To Shoehorn? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

ย้ายไปใช้ Shoehorn

ทำไมต้อง shoehorn?

shoehorn ช่วยให้ส่ง data แบบ partial ใน test ได้โดยที่ TypeScript ยังแฮปปี้ มันมาแทน assertion แบบ as ด้วยทางเลือกที่ type-safe

ใช้ใน test code เท่านั้น ห้ามใช้ shoehorn ใน production code เด็ดขาด

ปัญหาของ as ใน test:

  • โมเดลถูก train มาไม่ให้ใช้มัน
  • ต้องระบุ type ปลายทางเองทุกครั้ง
  • ต้องใช้ double-as (as unknown as Type) เวลาตั้งใจส่ง data ผิด type

ติดตั้ง

npm i @total-typescript/shoehorn

รูปแบบการ migrate

object ใหญ่แต่ใช้จริงแค่ไม่กี่ property

ก่อน:

type Request = {
  body: { id: string };
  headers: Record;
  cookies: Record;
  // ...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
  });
});

หลัง:

import { fromPartial } from "@total-typescript/shoehorn";

it("gets user by id", () => {
  getUser(
    fromPartial({
      body: { id: "123" },
    }),
  );
});

as TypefromPartial()

ก่อน:

getUser({ body: { id: "123" } } as Request);

หลัง:

import { fromPartial } from "@total-typescript/shoehorn";

getUser(fromPartial({ body: { id: "123" } }));

as unknown as TypefromAny()

ก่อน:

getUser({ body: { id: 123 } } as unknown as Request); // wrong type on purpose

หลัง:

import { fromAny } from "@total-typescript/shoehorn";

getUser(fromAny({ body: { id: 123 } }));

เลือกใช้ตัวไหนเมื่อไหร่

| ฟังก์ชัน | กรณีใช้งาน | | --------------- | -------------------------------------------------- | | fromPartial() | ส่ง data แบบ partial ที่ยังผ่าน type check | | fromAny() | ส่ง data ที่ตั้งใจให้ผิด type (ยังได้ autocomplete) | | fromExact() | บังคับ object แบบเต็ม (ค่อยสลับเป็น fromPartial ทีหลัง) |

ขั้นตอนการทำงาน

  1. เก็บ requirement - ถาม user:
  • test file ไหนบ้างที่มี assertion แบบ as แล้วสร้างปัญหา?
  • กำลังเจอ object ใหญ่ ๆ ที่สนใจจริงแค่บาง property หรือเปล่า?
  • ต้องส่ง data ที่ตั้งใจให้ผิด type สำหรับ test เคส error ไหม?
  1. ติดตั้งแล้ว migrate:
  • [ ] ติดตั้ง: npm i @total-typescript/shoehorn
  • [ ] หา test file ที่มี assertion แบบ as: grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts"
  • [ ] แทนที่ as Type ด้วย fromPartial()
  • [ ] แทนที่ as unknown as Type ด้วย fromAny()
  • [ ] เพิ่ม import จาก @total-typescript/shoehorn
  • [ ] รัน type check เพื่อยืนยันว่าผ่าน

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.