Detect and fix TypeScript error handling anti-patterns with state persistence and approval workflows. Use when scanning a codebase for silent error failures, empty catches, promise swallowing, or unlogged errors. Supports five modes — scan (detect all issues), review (interactive fix session), auto (batch fix with guardrails), resume (continue from last session), report (show progress). Triggers on phrases like 'scan for anti-patterns', 'fix error handling', 'find empty catches', 'anti-pattern c
自动识别并修复TypeScript错误处理反模式的自主代理。
使用Bun运行(无需安装):
bash
bunx antipattern-czar
bunx antipattern-czar --src lib
bunx antipattern-czar --config my-config.json
通过.antipatternrc.json进行配置:
json
{
srcDir: src,
criticalPaths: [DatabaseService.ts, AuthHandler.ts],
skipDirectories: [node_modules, dist, .git]
}
解析用户意图以选择模式:
| 用户输入 | 模式 | 操作 |
|---|---|---|
| 扫描, 检测, 查找 | SCAN | 运行检测器,保存状态 |
| 审查, 修复, 帮我修复 |
始终检查项目根目录下的.anti-pattern-state.json。首次SCAN时,若该文件存在则询问是否恢复。
json
{
session_id:
started_at:
target_path:
issues: [],
history: []
}
问题模式:id、file、line、pattern、severity(严重/高/中)、iscriticalpath、status(待处理/已修复/已批准覆盖/已跳过)、code_snippet。
完整各模式工作流程请参见workflows.md。摘要:
仅在以下所有条件成立时建议APPROVED_OVERRIDE:
绝不在没有特殊用户确认的情况下批准关键路径上的覆盖。
格式:
typescript
} catch {
// [APPROVED_OVERRIDE] <具体技术原因>
// Fallback: <替代方案>
}
完整模式列表(含严重程度、自动修复资格和代码模板)请参见patterns.md。
每次修复后:
✅ 已修复:src/services/example.ts:42
模式:NOLOGGINGIN_CATCH
解决方案:添加了带上下文的logger.error()
进度:剩余4/28个问题 ━━━━━━━ 14%
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 anti-pattern-czar-1776419942 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 anti-pattern-czar-1776419942 技能
skillhub install anti-pattern-czar-1776419942
文件大小: 5.94 KB | 发布时间: 2026-4-17 19:52