返回顶部
a

anti-pattern-czar反模式检测

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

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
605
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

anti-pattern-czar

反模式沙皇

自动识别并修复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运行检测器,保存状态
审查, 修复, 帮我修复
REVIEW | 交互式修复会话 |
| 自动, 全部修复, 自主 | AUTO | 带防护栏的批量修复 |
| 恢复, 继续 | RESUME | 加载状态,继续执行 |
| 报告, 状态, 进度 | REPORT | 显示当前状态 |

状态文件

始终检查项目根目录下的.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。摘要:

  • - SCAN:运行检测器 → 解析问题 → 分类严重程度 → 保存状态 → 显示摘要
  • REVIEW:加载状态 → 按关键路径+严重程度排序 → 读取代码上下文 → 解释问题 → 提出修复选项 → 应用批准的修复 → 更新状态
  • AUTO:与用户确认 → 使用模板自动修复非关键路径问题 → 对关键路径命中切换到REVIEW模式 → 显示摘要
  • RESUME:加载.anti-pattern-state.json → 从第一个pending问题继续
  • REPORT:显示会话统计、严重程度表、最近修复、下一步操作

已批准覆盖

仅在以下所有条件成立时建议APPROVED_OVERRIDE:

  1. 1. 错误是预期且频繁的
  2. 日志记录会产生过多噪音
  3. 存在明确的恢复/回退逻辑
  4. 原因是具体且技术性的

绝不在没有特殊用户确认的情况下批准关键路径上的覆盖。

格式:
typescript
} catch {
// [APPROVED_OVERRIDE] <具体技术原因>
// Fallback: <替代方案>
}

修复模板

完整模式列表(含严重程度、自动修复资格和代码模板)请参见patterns.md

进度输出格式

每次修复后:

✅ 已修复:src/services/example.ts:42
模式:NOLOGGINGIN_CATCH
解决方案:添加了带上下文的logger.error()

进度:剩余4/28个问题 ━━━━━━━ 14%

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 anti-pattern-czar-1776419942 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 anti-pattern-czar-1776419942 技能

通过命令行安装

skillhub install anti-pattern-czar-1776419942

下载

⬇ 下载 anti-pattern-czar v1.0.0(免费)

文件大小: 5.94 KB | 发布时间: 2026-4-17 19:52

v1.0.0 最新 2026-4-17 19:52
Initial release: autonomous TypeScript error handling anti-pattern detector and fixer with state persistence, 5 operation modes, approval workflows, and 10 pattern types.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部