Borrowing it
Nothing to install: this file belongs to shenjingnan/home-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/shenjingnan/home-mcp/main/.claude/commands/fix-type-fail.mdgit clone --depth 1 https://github.com/shenjingnan/home-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/shenjingnan/home-mcp/fix-type-fail)<a href="https://agentmods.dev/commands/shenjingnan/home-mcp/fix-type-fail"><img src="https://agentmods.dev/badge/commands/shenjingnan/home-mcp/fix-type-fail/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/shenjingnan/home-mcp/fix-type-fail"><img src="https://agentmods.dev/badge/commands/shenjingnan/home-mcp/fix-type-fail.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00005 | $0.01078 |
| Opus 5 | $0.00003 | $0.00539 |
| Sonnet 5 | $0.00001 | $0.00216 |
| Haiku 4.5 | $0.00001 | $0.00108 |
Grade A, and why
fix-type-fail scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
我在目录 <path>$1</path> 执行命令 nr type:check
发现有很多类型错误,如下
$2
请按照以下步骤系统性地分析和修复所有类型错误:
1. 错误分类和初步分析
1.1 解析错误日志
- 统计错误总数和涉及的文件数量
- 识别错误类型分布(TS2339、TS2345、TS2352、TS7006等)
- 按文件分组错误,优先处理错误数量最多的文件
1.2 常见错误类型识别
- TS2339:属性不存在错误 → 检查接口定义和类型导入
- TS2345:参数类型不匹配 → 检查函数签名和参数类型
- TS2352:类型转换错误 → 避免使用
as any,使用类型守卫 - TS7006:隐式 any 类型 → 添加显式类型注解
- TS2307:模块找不到 → 检查导入路径和模块导出
2. 制定修复策略
2.1 优先级排序
- 高优先级:影响编译的核心类型错误(接口缺失、函数签名错误)
- 中优先级:类型注解缺失、可选参数处理
- 低优先级:类型推断优化、非空断言优化
2.2 修复方法选择
- 接口扩展:为缺失的属性添加接口定义
- 类型守卫:使用
is函数进行类型保护 - 泛型优化:使用泛型提高类型安全性
- 工具类型:合理使用
Partial<T>、Required<T>等工具类型
3. 实施修复
3.1 文件修复顺序
- 先修复类型定义文件(
*.d.ts、types.ts) - 再修复核心业务逻辑文件
- 最后修复测试文件
3.2 具体修复步骤
- 读取错误文件:逐一分析每个出错的 TypeScript 文件
- 理解代码意图:分析代码的业务逻辑和预期行为
- 添加类型定义:为缺失的类型创建或扩展接口
- 修复类型错误:按照优先级逐个修复错误
- 保持向后兼容:确保修复不破坏现有功能
3.3 特殊情况处理
- 测试文件:使用测试工具函数避免类型断言,参考项目的
test-types.ts - 第三方库:检查是否需要安装类型定义包(
@types/*) - 遗留代码:渐进式添加类型,避免大规模重构
4. 验证和测试
4.1 编译验证
- 运行
nr type:check确保所有类型错误已修复 - 运行
nr build确保代码能够正常编译 - 检查生成的类型声明文件(
*.d.ts)
4.2 功能测试
- 运行相关测试用例:
nr test <相关测试文件> - 确保修复后的代码功能正常
- 执行回归测试避免引入新问题
4.3 代码质量检查
- 执行
pnpm check:fix进行代码规范检查和自动修复 - 确保代码符合项目的类型安全要求(如禁用
any类型) - 验证导入导出语句的正确性
5. 文档和预防
5.1 修复记录
- 记录修复的错误类型和数量
- 说明采用的主要修复策略
- 标记需要注意的特殊情况
5.2 预防措施
- 建议启用更严格的 TypeScript 配置
- 推荐 ESLint 规则来预防常见类型错误
- 提供类型安全的最佳实践建议
6. 报告要求
请提供以下详细信息:
- 错误统计:按类型和文件分布的错误统计
- 修复过程:主要修复策略和关键决策点
- 代码变更:重要的类型定义修改和接口扩展
- 测试结果:所有验证步骤的执行结果
- 质量检查:代码规范检查的发现和修复
- 建议改进:避免类似错误再次发生的建议
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 9d ago First seen · 96 lines · 5 tokens per session scan A e1f6a1555217
fix-type-fail is a command published in the GitHub repository shenjingnan/home-mcp (21 stars, last pushed 7mo ago), licensed MIT. It adds 5 tokens to every session and 1,078 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other commands, from other repositories
types
Debug and fix TypeScript type errors with systematic analysis and expert guidance.
performance
Diagnose or fix Bun/TypeScript performance. Loads the performance skill, then works the task through its workflow.
typescript-fix
Run the project's TypeScript checker, diagnose root causes, apply minimal type-safe fixes, and verify with the same command.
build-fix
Fix build and TypeScript errors with minimal changes.
build-fix
A command that incrementally fixes TypeScript and build errors by running the project build, grouping and explaining errors, applying fixes, and checking the result again.
types
Hostile audit of the static type layer: assume every any, every suppression, and every unchecked cast is hiding a real type error until proven otherwise. The type checker is only as strong as the escape hatches punched through it — this command finds every hole.