| created | "2025-12-16T00:00:00.000Z" |
| modified | "2026-07-06T00:00:00.000Z" |
| reviewed | "2026-07-06T00:00:00.000Z" |
| description | 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. |
| allowed-tools | Read, Bash(ast-grep *), Bash(sg *), Bash(rg *), Glob, Grep, TodoWrite, Task, SlashCommand |
| args | [PATH] [--focus <category>] [--severity <level>] |
| argument-hint | [PATH] [--focus <category>] [--severity <level>] |
| name | code-antipatterns |
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, , , /,
/, / annotations, magic-number timers, Vue
props mutation, Python mutable defaults, bare , , and
.