code-antipatterns
БесплатноБез исполняемых скриптовНе проверенAnalyze a codebase for anti-patterns using ast-grep. Use when finding magic numbers, console.logs, var usage, excessive any, eval/innerHTML security issues…
от laurigates★ 61 звезда на GitHubОб этом скилле
When to Use This Skill
| Use this skill when... | Use something else instead when... |
|---|---|
| Running a parallel anti-pattern scan and producing a report | Looking up the full YAML rule catalog → see REFERENCE.md |
Specifically targeting empty catches, floating promises, or || true |
Use the dedicated scanner → code-hidden-failures --track errors |
| Finding success-on-empty / silent degradation patterns | Use the dedicated scanner → code-hidden-failures --track degradation |
| Broad code-quality review across security, perf, and architecture | Run the full review delegate → code-review |
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. The mechanical detection is one
deterministic ast-grep scan over a shipped rule project — you do not re-type
sg -p '…' patterns and do not fan out agents just to run them. Your job is
the judgment: severity triage, recommendations, and fix planning on top of the
scan's structured findings.
Step 1: Run the deterministic scan
The detection catalog lives as an ast-grep rule project in
rules/ (one *.yml per pattern under rules/lib/, each with a
valid/invalid test fixture in rules/tests/). Run the whole catalog in one pass:
ast-grep scan -c ${CLAUDE_SKILL_DIR}/rules/sgconfig.yml --json=compact <path>
Each JSON finding carries ruleId, file, range (line/column), message, and
the matched text. Parse this — it is the raw finding set for every category
below. The rules cover: empty catch, console.log, var, eval/new Function,
innerHTML/outerHTML, as any / : any annotations, magic-number timers, Vue
props mutation, Python mutable defaults, bare except, global, and
type() ==.
Graceful degradation — if ast-grep (packaged as ast-grep or sg) is not
installed, fall back to the per-pattern flow: read REFERENCE.md,
which links each rule to its source .yml, and run the individual
ast-grep -p '<pattern>' --lang <lang> commands by hand. The rule project is the
fast path; the reference is the fallback.
Step 2: Judgment (the agent's actual work)
The scan is mechanical and reproducible; triage, recommendation, and fix planning are the judgment work — do them yourself on the scan output rather than spawning agents to re-run patterns:
- Severity triage — promote/demote each finding using the context in the Category tables below and the app type (frontend/backend/CLI/library).
- Error-swallowing findings (empty catch, floating promises, bare except) →
delegate to
/code:hidden-failures --track errorsfor its severity model, surfacing recommendations, and privacy redaction. Do not re-classify them here. - Recommendations & fix planning — group systemic issues, note which findings
ast-grep can auto-
fix, and recommend process changes (lint rules, pre-commit).
Reserve any parallel Task fan-out for genuinely independent reasoning (e.g.
a deep security review or a framework-specific architecture pass) — never for
running the patterns, which Step 1 already did once, deterministically.
Analysis Categories
Based on the detected languages, analyze for these categories:
JavaScript/TypeScript Anti-patterns
- Callbacks, magic values, console.logs
- var usage, deprecated patterns
- Error swallowing (empty catch, floating promises) → delegate to
/code:hidden-failures --track errors
Async/Promise Patterns
- Nested callbacks, Promise constructor anti-pattern
- Error-handling coverage (unhandled/floating promises) → delegate to
/code:hidden-failures --track errors
Framework-Specific (if detected)
- Vue 3: Props mutation, reactivity issues, Options vs Composition API mixing
- React: Missing deps in hooks, inline functions, prop drilling
TypeScript Quality (if .ts files present)
- Excessive
anytypes, non-null assertions, type safety issues
- Excessive
Code Complexity
- Long functions (>50 lines), deep nesting (>4 levels), large parameter lists
Security Concerns
- eval usage, innerHTML XSS, hardcoded secrets, injection risks
Memory & Performance
- Event listeners without cleanup, setInterval leaks, inefficient patterns
Python Anti-patterns (if detected)
- Mutable default arguments, global variables
- Bare except and suppression patterns → delegate to
/code:hidden-failures --track errors
Delegated Category: Error Swallowing
Do NOT re-implement empty-catch / bare-except / floating-promise detection
here. Invoke /code:hidden-failures --track errors via the SlashCommand t
Установить code-antipatterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadBash(ast-grep *)Bash(sg *)Bash(rg *)GlobGrepTodoWriteTaskSlashCommandВложенные файлы
FAQ
Что делает скилл code-antipatterns?
Analyze a codebase for anti-patterns using ast-grep. Use when finding magic numbers, console.logs, var usage, excessive any, eval/innerHTML security issues, or deep nesting.
Как установить скилл code-antipatterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл code-antipatterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic