重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
code-antipatterns by laurigates/claude-plugins
npx skills add https://github.com/laurigates/claude-plugins --skill code-antipatterns包含 Shell 命令
此技能包含可能执行系统命令的 shell 命令指令(!command``)。安装前请仔细审查。
$1(如果未指定,默认为当前目录)find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.jsx" -o -name "*.tsx" \)find . -name "*.vue"find . -name "*.py"使用 ast-grep 和并行代理委派执行全面的反模式分析。
根据检测到的语言,分析以下类别:
JavaScript/TypeScript 反模式
异步/Promise 模式
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
框架特定(如果检测到)
TypeScript 质量(如果存在 .ts 文件)
any 类型、非空断言、类型安全问题代码复杂度
安全问题
内存与性能
Python 反模式(如果检测到)
关键:为提升效率,使用并行代理委派。
同时启动多个专业代理:
## 代理 1:语言检测与设置 (Explore - quick)
检测项目技术栈,识别文件模式,建立分析范围
## 代理 2:JavaScript/TypeScript 分析 (code-analysis)
- 使用 ast-grep 进行结构模式匹配
- 关注:空的 catch 块、魔法值、var 使用、已弃用的模式
## 代理 3:异步/Promise 分析 (code-analysis)
- 未处理的 Promise、嵌套回调、悬空的 Promise
- Promise 构造函数反模式
## 代理 4:框架特定分析 (code-analysis)
- Vue:props 突变、响应性问题
- React:hooks 依赖项、内联函数
## 代理 5:安全分析 (security-audit)
- eval、innerHTML、硬编码的密钥、注入风险
- 使用 OWASP 上下文
## 代理 6:复杂度分析 (code-analysis)
- 函数长度、嵌套深度、参数数量
- 圈复杂度指标
在分析中使用以下模式:
# 空的 catch 块
ast-grep -p 'try { $$$ } catch ($E) { }' --lang js
# 魔法数字
ast-grep -p 'if ($VAR > 100)' --lang js
# Console 语句
ast-grep -p 'console.log($$$)' --lang js
# var 使用
ast-grep -p 'var $VAR = $$$' --lang js
# TypeScript any
ast-grep -p ': any' --lang ts
ast-grep -p 'as any' --lang ts
# Vue props 突变
ast-grep -p 'props.$PROP = $VALUE' --lang js
# 安全:eval
ast-grep -p 'eval($$$)' --lang js
# 安全:innerHTML
ast-grep -p '$ELEM.innerHTML = $$$' --lang js
# Python:可变默认值
ast-grep -p 'def $FUNC($ARG=[])' --lang py
将发现的问题整合到以下结构中:
## 反模式分析报告
### 摘要
- 总问题数:X
- 关键:X | 高:X | 中:X | 低:X
- 问题最多的类别:[列表]
### 关键问题(立即修复)
| 文件 | 行号 | 问题 | 类别 |
|------|------|-------|----------|
| ... | ... | ... | ... |
### 高优先级问题
| 文件 | 行号 | 问题 | 类别 |
|------|------|-------|----------|
| ... | ... | ... | ... |
### 中优先级问题
[类似表格]
### 低优先级 / 风格问题
[类似表格或汇总计数]
### 建议
1. [优先修复建议]
2. [...]
### 类别细分
- **安全**:X 个问题(详情)
- **异步/Promises**:X 个问题(详情)
- **代码复杂度**:X 个问题(详情)
- [...]
--focus <category>:专注于特定类别(security, async, complexity, framework)--severity <level>:报告的最低严重性等级(critical, high, medium, low)--fix:在安全的情况下尝试自动修复整合发现的问题后:
code-antipatterns-analysis - 模式库和详细指南ast-grep-search - ast-grep 使用参考/code:review - 全面的代码审查security-audit - 深度安全分析code-refactoring - 自动化重构每周安装次数
50
仓库
GitHub 星标数
18
首次出现
2026年2月9日
安全审计
安装于
cline50
github-copilot50
codex50
kimi-cli50
gemini-cli50
cursor50
Contains Shell Commands
This skill contains shell command directives (!command``) that may execute system commands. Review carefully before installing.
$1 (defaults to current directory if not specified)find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.jsx" -o -name "*.tsx" \)find . -name "*.vue"find . -name "*.py"Perform comprehensive anti-pattern analysis using ast-grep and parallel agent delegation.
Based on the detected languages, analyze for these categories:
JavaScript/TypeScript Anti-patterns
Async/Promise Patterns
Framework-Specific (if detected)
TypeScript Quality (if .ts files present)
any types, non-null assertions, type safety issuesCode Complexity
Security Concerns
Memory & Performance
Python Anti-patterns (if detected)
CRITICAL: Use parallel agent delegation for efficiency.
Launch multiple specialized agents simultaneously:
## Agent 1: Language Detection & Setup (Explore - quick)
Detect project stack, identify file patterns, establish analysis scope
## Agent 2: JavaScript/TypeScript Analysis (code-analysis)
- Use ast-grep for structural pattern matching
- Focus on: empty catch, magic values, var usage, deprecated patterns
## Agent 3: Async/Promise Analysis (code-analysis)
- Unhandled promises, nested callbacks, floating promises
- Promise constructor anti-pattern
## Agent 4: Framework-Specific Analysis (code-analysis)
- Vue: props mutation, reactivity issues
- React: hooks dependencies, inline functions
## Agent 5: Security Analysis (security-audit)
- eval, innerHTML, hardcoded secrets, injection risks
- Use OWASP context
## Agent 6: Complexity Analysis (code-analysis)
- Function length, nesting depth, parameter counts
- Cyclomatic complexity indicators
Use these patterns during analysis:
# Empty catch blocks
ast-grep -p 'try { $$$ } catch ($E) { }' --lang js
# Magic numbers
ast-grep -p 'if ($VAR > 100)' --lang js
# Console statements
ast-grep -p 'console.log($$$)' --lang js
# var usage
ast-grep -p 'var $VAR = $$$' --lang js
# TypeScript any
ast-grep -p ': any' --lang ts
ast-grep -p 'as any' --lang ts
# Vue props mutation
ast-grep -p 'props.$PROP = $VALUE' --lang js
# Security: eval
ast-grep -p 'eval($$$)' --lang js
# Security: innerHTML
ast-grep -p '$ELEM.innerHTML = $$$' --lang js
# Python: mutable defaults
ast-grep -p 'def $FUNC($ARG=[])' --lang py
Consolidate findings into this structure:
## Anti-pattern Analysis Report
### Summary
- Total issues: X
- Critical: X | High: X | Medium: X | Low: X
- Categories with most issues: [list]
### Critical Issues (Fix Immediately)
| File | Line | Issue | Category |
|------|------|-------|----------|
| ... | ... | ... | ... |
### High Priority Issues
| File | Line | Issue | Category |
|------|------|-------|----------|
| ... | ... | ... | ... |
### Medium Priority Issues
[Similar table]
### Low Priority / Style Issues
[Similar table or summary count]
### Recommendations
1. [Prioritized fix recommendations]
2. [...]
### Category Breakdown
- **Security**: X issues (details)
- **Async/Promises**: X issues (details)
- **Code Complexity**: X issues (details)
- [...]
--focus <category>: Focus on specific category (security, async, complexity, framework)--severity <level>: Minimum severity to report (critical, high, medium, low)--fix: Attempt automated fixes where safeAfter consolidating findings:
code-antipatterns-analysis - Pattern library and detailed guidanceast-grep-search - ast-grep usage reference/code:review - Comprehensive code reviewsecurity-audit - Deep security analysiscode-refactoring - Automated refactoringWeekly Installs
50
Repository
GitHub Stars
18
First Seen
Feb 9, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
cline50
github-copilot50
codex50
kimi-cli50
gemini-cli50
cursor50
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
125,600 周安装