[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AV0YYHB9RMVPBR2XDEPAX1":3,"skill-same:01M7AV0YYHB9RMVPBR2XDEPAX1":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7AV0YYHB9RMVPBR2XDEPAX1","migrate-to-shoehorn",null,"把测试文件从 `as` 类型断言迁移到 @total-typescript\u002Fshoehorn。当用户提到 shoehorn、想替换测试中的 `as`，或需要部分测试数据时使用。","muscaestar\u002Fskills","muscaestar","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F34506351?v=4","01M7ATZNAAQJBTZZXCPKAWJQTH","Musca","01M7ATZNBG6JAV06HKBCBPM152",0,"MIT","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fmigrate-to-shoehorn\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: migrate-to-shoehorn\ndescription: 把测试文件从 `as` 类型断言迁移到 @total-typescript\u002Fshoehorn。当用户提到 shoehorn、想替换测试中的 `as`，或需要部分测试数据时使用。\ncommit_version: 62f43a18177be6ec82da242e59ffbc490a4c22ea\n---\n\n# 迁移到 Shoehorn\n\n## 为什么用 shoehorn？\n\n`shoehorn` 让你在测试中传入部分数据的同时让 TypeScript 满意。它用类型安全的替代品替换 `as` 断言。\n\n**仅限测试代码。** 永远不要在生产代码中使用 shoehorn。\n\n测试中使用 `as` 的问题：\n\n- 我们被训练成不要用它\n- 必须手动指定目标类型\n- 故意传错数据时需要双重断言（`as unknown as Type`）\n\n## 安装\n\n```bash\nnpm i @total-typescript\u002Fshoehorn\n```\n\n## 迁移模式\n\n### 只需要少数属性的大对象\n\n之前：\n\n```ts\ntype Request = {\n  body: { id: string };\n  headers: Record\u003Cstring, string>;\n  cookies: Record\u003Cstring, string>;\n  \u002F\u002F ...20 more properties\n};\n\nit(\"gets user by id\", () => {\n  \u002F\u002F Only care about body.id but must fake entire Request\n  getUser({\n    body: { id: \"123\" },\n    headers: {},\n    cookies: {},\n    \u002F\u002F ...fake all 20 properties\n  });\n});\n```\n\n之后：\n\n```ts\nimport { fromPartial } from \"@total-typescript\u002Fshoehorn\";\n\nit(\"gets user by id\", () => {\n  getUser(\n    fromPartial({\n      body: { id: \"123\" },\n    }),\n  );\n});\n```\n\n### `as Type` → `fromPartial()`\n\n之前：\n\n```ts\ngetUser({ body: { id: \"123\" } } as Request);\n```\n\n之后：\n\n```ts\nimport { fromPartial } from \"@total-typescript\u002Fshoehorn\";\n\ngetUser(fromPartial({ body: { id: \"123\" } }));\n```\n\n### `as unknown as Type` → `fromAny()`\n\n之前：\n\n```ts\ngetUser({ body: { id: 123 } } as unknown as Request); \u002F\u002F wrong type on purpose\n```\n\n之后：\n\n```ts\nimport { fromAny } from \"@total-typescript\u002Fshoehorn\";\n\ngetUser(fromAny({ body: { id: 123 } }));\n```\n\n## 什么时候用哪个\n\n| 函数            | 使用场景                                     |\n| --------------- | -------------------------------------------- |\n| `fromPartial()` | 传入仍能通过类型检查的部分数据               |\n| `fromAny()`     | 传入故意错误的数据（保留自动补全）           |\n| `fromExact()`   | 强制完整对象（之后可与 fromPartial 互换）    |\n\n## 工作流程\n\n1. **收集需求**——问用户：\n   - 哪些测试文件有造成问题的 `as` 断言？\n   - 他们是否在处理只有部分属性重要的大对象？\n   - 他们是否需要为错误测试传入故意错误的数据？\n\n2. **安装并迁移**：\n   - [ ] 安装：`npm i @total-typescript\u002Fshoehorn`\n   - [ ] 找出带 `as` 断言的测试文件：`grep -r \" as [A-Z]\" --include=\"*.test.ts\" --include=\"*.spec.ts\"`\n   - [ ] 把 `as Type` 替换为 `fromPartial()`\n   - [ ] 把 `as unknown as Type` 替换为 `fromAny()`\n   - [ ] 添加来自 `@total-typescript\u002Fshoehorn` 的 import\n   - [ ] 运行类型检查验证\n","# 迁移到 Shoehorn\n\n## 为什么用 shoehorn？\n\n`shoehorn` 让你在测试中传入部分数据的同时让 TypeScript 满意。它用类型安全的替代品替换 `as` 断言。\n\n**仅限测试代码。** 永远不要在生产代码中使用 shoehorn。\n\n测试中使用 `as` 的问题：\n\n- 我们被训练成不要用它\n- 必须手动指定目标类型\n- 故意传错数据时需要双重断言（`as unknown as Type`）\n\n## 安装\n\n```bash\nnpm i @total-typescript\u002Fshoehorn\n```\n\n## 迁移模式\n\n### 只需要少数属性的大对象\n\n之前：\n\n```ts\ntype Request = {\n  body: { id: string };\n  headers: Record\u003Cstring, string>;\n  cookies: Record\u003Cstring, string>;\n  \u002F\u002F ...20 more properties\n};\n\nit(\"gets user by id\", () => {\n  \u002F\u002F Only care about body.id but must fake entire Request\n  getUser({\n    body: { id: \"123\" },\n    headers: {},\n    cookies: {},\n    \u002F\u002F ...fake all 20 properties\n  });\n});\n```\n\n之后：\n\n```ts\nimport { fromPartial } from \"@total-typescript\u002Fshoehorn\";\n\nit(\"gets user by id\", () => {\n  getUser(\n    fromPartial({\n      body: { id: \"123\" },\n    }),\n  );\n});\n```\n\n### `as Type` → `fromPartial()`\n\n之前：\n\n```ts\ngetUser({ body: { id: \"123\" } } as Request);\n```\n\n之后：\n\n```ts\nimport { fromPartial } from \"@total-typescript\u002Fshoehorn\";\n\ngetUser(fromPartial({ body: { id: \"123\" } }));\n```\n\n### `as unknown as Type` → `fromAny()`\n\n之前：\n\n```ts\ngetUser({ body: { id: 123 } } as unknown as Request); \u002F\u002F wrong type on purpose\n```\n\n之后：\n\n```ts\nimport { fromAny } from \"@total-typescript\u002Fshoehorn\";\n\ngetUser(fromAny({ body: { id: 123 } }));\n```\n\n## 什么时候用哪个\n\n| 函数            | 使用场景                                     |\n| --------------- | -------------------------------------------- |\n| `fromPartial()` | 传入仍能通过类型检查的部分数据               |\n| `fromAny()`     | 传入故意错误的数据（保留自动补全）           |\n| `fromExact()`   | 强制完整对象（之后可与 fromPartial 互换）    |\n\n## 工作流程\n\n1. **收集需求**——问用户：\n   - 哪些测试文件有造成问题的 `as` 断言？\n   - 他们是否在处理只有部分属性重要的大对象？\n   - 他们是否需要为错误测试传入故意错误的数据？\n\n2. **安装并迁移**：\n   - [ ] 安装：`npm i @total-typescript\u002Fshoehorn`\n   - [ ] 找出带 `as` 断言的测试文件：`grep -r \" as [A-Z]\" --include=\"*.test.ts\" --include=\"*.spec.ts\"`\n   - [ ] 把 `as Type` 替换为 `fromPartial()`\n   - [ ] 把 `as unknown as Type` 替换为 `fromAny()`\n   - [ ] 添加来自 `@total-typescript\u002Fshoehorn` 的 import\n   - [ ] 运行类型检查验证\n",{"name":5,"description":7,"commit_version":24},"62f43a18177be6ec82da242e59ffbc490a4c22ea","main","d198f74688d91ee205dcb8e96649a988a256ea4d","matt\u002Fmigrate-to-shoehorn","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills","https:\u002F\u002Fgithub.com\u002Fmuscaestar","muscaestar.xyz","2026-10-19 17:04:10",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add muscaestar\u002Fskills --skill migrate-to-shoehorn",{"tool":38,"command":39},"bunx","bunx skills add muscaestar\u002Fskills --skill migrate-to-shoehorn",{"tool":41,"command":42},"pnpm","pnpm dlx skills add muscaestar\u002Fskills --skill migrate-to-shoehorn","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fmigrate-to-shoehorn\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"agents\u002Fopenai.yaml","REFERENCE","参考文档",104,"https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fmigrate-to-shoehorn\u002Fagents\u002Fopenai.yaml",[53,60,67,74,81,88],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7AV2CSM2X530JCZZZMB9G25","skills-link","管理 muscaestar\u002Fskills 仓库的 skill 安装。当用户想安装\u002F卸载某个 skill、查看已装清单、把 skill 装到全局或某个项目、或问\"这个 skill 装了没有\"时使用。也用于向用户解释三层结构与全局\u002F项目双范围安装策略。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fown\u002Fskills-link\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7AV2B8WFCKB3B8KVBYPVA3N","writing-shape","写作之 exploit：把原始素材塑形成一篇文章，逐段进行。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fwriting-shape\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7AV2A090EYE2BY7G33GW05X","writing-fragments","写作之 explore：开采原始碎片，还没有结构。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fwriting-fragments\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7AV281H5H6TDYGPFNH3ZM29","writing-for-agents","为 agents 编写文档。在创建或编辑技能，或修改 AGENTS.md 或 CLAUDE.md 时使用。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fwriting-for-agents\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7AV24MDVDQV8C67Y65DA9KC","writing-beats","写作之 exploit；把原始素材组装成一段由节拍（beat）构成的旅程，在每个节拍倚赖某个术语之前先把它落地。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fwriting-beats\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7AV22KNP7VXV3XHPX8JF0KB","wizard","生成一个交互式 bash 向导，引导人类完成只有他们才能执行的步骤。当需要配置基础设施、设置凭据或 CI secret、摸索不熟悉的第三方仪表盘，或执行一次性的迁移或切换时使用。不要为 agent 自己能执行的步骤调用本技能。","https:\u002F\u002Fgithub.com\u002Fmuscaestar\u002Fskills\u002Fblob\u002Fmain\u002Fmatt\u002Fwizard\u002FSKILL.md",[],[]]