一键导入
migrate-to-shoehorn
将测试文件从 `as` 类型断言迁移到 @total-typescript/shoehorn. 当用户提到 shoehorn, "迁移到 shoehorn", 想要替换测试中的 `as` 或需要部分测试数据时使用.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
将测试文件从 `as` 类型断言迁移到 @total-typescript/shoehorn. 当用户提到 shoehorn, "迁移到 shoehorn", 想要替换测试中的 `as` 或需要部分测试数据时使用.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | migrate-to-shoehorn |
| description | 将测试文件从 `as` 类型断言迁移到 @total-typescript/shoehorn. 当用户提到 shoehorn, "迁移到 shoehorn", 想要替换测试中的 `as` 或需要部分测试数据时使用. |
shoehorn 允许你在测试中传递部分数据, 同时保持 TypeScript 满意. 它用类型安全的替代方案替换 as 断言.
*仅用于测试代码. * 永远不要在生产代码中使用 shoehorn.
测试中使用 as 的问题:
as unknown as Type)npm i @total-typescript/shoehorn
之前:
type Request = {
body: { id: string };
headers: Record<string, string>;
cookies: Record<string, string>;
// ...20 个更多属性
};
it("gets user by id", () => {
// 只关心 body.id 但必须伪造整个 Request
getUser({
body: { id: "123" },
headers: {},
cookies: {},
// ...伪造所有 20 个属性
});
});
之后:
import { fromPartial } from "@total-typescript/shoehorn";
it("gets user by id", () => {
getUser(
fromPartial({
body: { id: "123" },
}),
);
});
as Type → fromPartial()之前:
getUser({ body: { id: "123" } } as Request);
之后:
import { fromPartial } from "@total-typescript/shoehorn";
getUser(fromPartial({ body: { id: "123" } }));
as unknown as Type → fromAny()之前:
getUser({ body: { id: 123 } } as unknown as Request); // 故意错误的类型
之后:
import { fromAny } from "@total-typescript/shoehorn";
getUser(fromAny({ body: { id: 123 } }));
| 函数 | 用例 |
|---|---|
fromPartial() | 传递仍然类型检查的部分数据 |
fromAny() | 传递故意错误的数据(保留自动完成) |
fromExact() | 强制完整对象(稍后与 fromPartial 交换) |
1.** 收集需求** - 询问用户:
as 断言导致问题?2.** 安装和迁移**:
npm i @total-typescript/shoehornas 断言的测试文件: grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts"as Type 替换为 fromPartial()as unknown as Type 替换为 fromAny()@total-typescript/shoehorn 添加导入Convert EPUB books into clean, narration-friendly plain text for local VibeVoice audiobook generation, with optional chunking for stable long-form TTS. Use when the user has an .epub and wants text cleanup, chunk prep, or a local audiobook workflow for VibeVoice.
Convert technical book chapters, papers, tutorials, or lecture notes into precise but listenable audiobook narration scripts, especially when the source contains LaTeX formulas and code in Lisp, C, Java, C#, or similar languages. Use this skill for math/code narration, SSML scripts, audiobook production plans, synchronized transcripts, and compact-vs-precise reading policies.
Help build, debug, refactor, test, and review ClojureDart applications that target Flutter, native mobile/desktop, web, or plain Dart. Use when the user asks about ClojureDart, .cljd files, cljd.build, deps.edn :cljd/opts, cljd.flutter, Dart package interop from Clojure syntax, Flutter widget construction in ClojureDart, hot reload, REPL, or ClojureDart testing.
使用捆绑的 Babashka 脚本修复 Emacs Lisp、Scheme、Common Lisp 等 Lisp 文件的括号/分隔符错误。 当用户提到 Lisp 括号错配、Paren Edit Death Loop、`.el/.lisp/.scm` 文件修复,或想在 Claude Code、Codex、Gemini 中批量修复非 Clojure Lisp 文件时使用。
从当前对话中提取 DDD 风格的通用语言术语表, 标记歧义并提出规范术语. 保存到 UBIQUITOUS_LANGUAGE.md. 当用户想要定义领域术语, 构建术语表, 强化术语, 创建通用语言, 提到 "通用语言", "术语表", "domain model" 或 "DDD" 时使用.
在 Clojure 项目中组合使用 `clj-nrepl-eval`、`clj-paren-repair-claude-hook` 和 `clj-paren-repair` 来完成 nREPL 求值与分隔符修复. 当用户提到 Clojure、nREPL、括号/分隔符错误、Paren Edit Death Loop、Claude hooks,或想在 Claude Code、Codex、Gemini 中验证和修复 `.clj/.cljs/.cljc/.bb` 文件时使用.