← ClaudeAtlas

pattern-detectionlisted

Detect patterns, anomalies, and trends in code and data. Use when identifying code smells, finding security vulnerabilities, or discovering recurring patterns. Handles regex patterns, AST analysis, and statistical anomaly detection.
aiskillstore/marketplace · ★ 329 · Data & Documents · score 82
Install: claude install-skill aiskillstore/marketplace
# Pattern Detection ## When to use this skill - **Code review**: Proactively detect problematic patterns - **Security review**: Scan for vulnerability patterns - **Refactoring**: Identify duplicate code - **Monitoring**: Alert on anomalies ## Instructions ### Step 1: Detect code smell patterns **Detect long functions**: ```bash # Find functions with 50+ lines grep -n "function\|def\|func " **/*.{js,ts,py,go} | \ while read line; do file=$(echo $line | cut -d: -f1) linenum=$(echo $line | cut -d: -f2) # Function length calculation logic done ``` **Duplicate code patterns**: ```bash # Search for similar code blocks grep -rn "if.*==.*null" --include="*.ts" . grep -rn "try\s*{" --include="*.java" . | wc -l ``` **Magic numbers**: ```bash # Search for hard-coded numbers grep -rn "[^a-zA-Z][0-9]{2,}[^a-zA-Z]" --include="*.{js,ts}" . ``` ### Step 2: Security vulnerability patterns **SQL Injection risks**: ```bash # SQL query built via string concatenation grep -rn "query.*+.*\$\|execute.*%s\|query.*f\"" --include="*.py" . grep -rn "SELECT.*\+.*\|\|" --include="*.{js,ts}" . ``` **Hard-coded secrets**: ```bash # Password, API key patterns grep -riE "(password|secret|api_key|apikey)\s*=\s*['\"][^'\"]+['\"]" --include="*.{js,ts,py,java}" . # AWS key patterns grep -rE "AKIA[0-9A-Z]{16}" . ``` **Dangerous function usage**: ```bash # eval, exec usage grep -rn "eval\(.*\)\|exec\(.*\)" --include="*.{py,js}" . # innerHTML usage grep -rn "innerHTML\s*=" --include="*