Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计通过

code-antipatterns代码反模式

Agent Skill

code-antipatterns 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,420

周安装

58

GitHub Stars

28

下载量

459
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:code-antipatterns(代码反模式)
来源仓库:https://github.com/laurigates/claude-plugins
仓库路径:skills/code-antipatterns
安装命令:
npx skills add https://github.com/laurigates/claude-plugins --skill code-antipatterns
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/laurigates/claude-plugins --skill code-antipatterns

简介

code-antipatterns 用于系统性检测代码反模式和代码异味。

  • 基于 ast-grep 和并行代理机制,覆盖 JavaScript/TypeScript、Python 等语言。
  • 自动识别回调地狱、异步问题、重复代码等常见设计缺陷。
  • 安装时需注意其包含 shell 命令,可能执行系统操作,需谨慎授权。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Context

  • Analysis path: $1 (defaults to current directory if not specified)
  • JS/TS files:!find. -type f \(-name "*.js" -o -name "*.ts" -o -name "*.jsx" -o -name "*.tsx" \)
  • Vue files:!find. -name "*.vue"
  • Python files:!find. -name "*.py"

Your Task

Perform comprehensive anti-pattern analysis using ast-grep and parallel agent delegation.

Analysis Categories

Based on the detected languages, analyze for these categories:

  1. JavaScript/TypeScript Anti-patterns

- Callbacks, magic values, console.logs - var usage, deprecated patterns - Error swallowing (empty catch, floating promises) → delegate to /code:error-swallowing

  1. Async/Promise Patterns

- Nested callbacks, Promise constructor anti-pattern - Error-handling coverage (unhandled/floating promises) → delegate to /code:error-swallowing

  1. Framework-Specific (if detected)

- Vue 3: Props mutation, reactivity issues, Options vs Composition API mixing - React: Missing deps in hooks, inline functions, prop drilling

  1. TypeScript Quality (if.ts files present)

- Excessive any types, non-null assertions, type safety issues

  1. Code Complexity

- Long functions (>50 lines), deep nesting (>4 levels), large parameter lists

  1. Security Concerns

- eval usage, innerHTML XSS, hardcoded secrets, injection risks

  1. Memory & Performance

- Event listeners without cleanup, setInterval leaks, inefficient patterns

  1. Python Anti-patterns (if detected)

- Mutable default arguments, global variables - Bare except and suppression patterns → delegate to /code:error-swallowing

Delegated Category: Error Swallowing

Do NOT re-implement empty-catch / bare-except / floating-promise detection here. Invoke /code:error-swallowing via the SlashCommand tool with the same PATH and severity filter, then fold its findings into the consolidated report under a dedicated Error Swallowing section.

Rationale: a single source of truth prevents drift between severity models, app-context surfacing recommendations, and privacy redaction policies. See code-quality-plugin/skills/code-error-swallowing/SKILL.md.

Execution Strategy

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: magic values, var usage, deprecated patterns
- Error swallowing handled separately via `/code:error-swallowing`

## Agent 3: Async/Promise Analysis (code-analysis)
- Nested callbacks, Promise constructor anti-pattern
- Floating promises / unhandled rejections handled via `/code:error-swallowing`

## 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

ast-grep Pattern Examples

Use these patterns during analysis:

# 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

Output Format

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)
- [...]

Optional Flags

  • --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 safe

Post-Analysis

After consolidating findings:

  1. Prioritize issues by impact and effort
  2. Suggest which issues can be auto-fixed with ast-grep
  3. Identify patterns that indicate systemic problems
  4. Recommend process improvements (linting rules, pre-commit hooks)

See Also

  • Skill: code-antipatterns-analysis - Pattern library and detailed guidance
  • Skill: ast-grep-search - ast-grep usage reference
  • Command: /code:review - Comprehensive code review
  • Agent: security-audit - Deep security analysis
  • Agent: code-refactoring - Automated refactoring

Related Configure Skills

  • If linting not configured → /configure:linting for automated enforcement
  • If security scanning not set up → /configure:security for CI integration

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.29%
按下载量换算162

Claude

30.98%
按下载量换算142

Cursor

18.59%
按下载量换算85

Gemini CLI

9.31%
按下载量换算43

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/laurigates/claude-plugins --skill code-antipatterns 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills