$npx -y skills add Dicklesworthstone/agent_flywheel_clawdbot_skills_and_integrations --skill ubsUltimate Bug Scanner - Pre-commit static analysis for AI coding workflows. 18 detection categories, 8 languages, 4-layer analysis engine. The AI agent's quality gate.
| 1 | # UBS - Ultimate Bug Scanner |
| 2 | |
| 3 | Static analysis tool built for AI coding workflows. Catches bugs that AI agents commonly introduce: null safety, async/await issues, security holes, memory leaks. Scans JS/TS, Python, Go, Rust, Java, C++, Ruby, Swift in 3-5 seconds. |
| 4 | |
| 5 | ## Why This Exists |
| 6 | |
| 7 | AI agents move fast. Bugs move faster. You're shipping features in minutes, but: |
| 8 | - Null pointer crashes slip through |
| 9 | - Missing `await` causes silent failures |
| 10 | - XSS vulnerabilities reach production |
| 11 | - Memory leaks accumulate |
| 12 | |
| 13 | UBS is the quality gate: scan before commit, fix before merge. |
| 14 | |
| 15 | ## Golden Rule |
| 16 | |
| 17 | ```bash |
| 18 | ubs <changed-files> --fail-on-warning |
| 19 | ``` |
| 20 | |
| 21 | **Exit 0 = safe to commit. Exit 1 = fix and re-run.** |
| 22 | |
| 23 | ## Essential Commands |
| 24 | |
| 25 | ### Quick Scans (Use These) |
| 26 | |
| 27 | ```bash |
| 28 | ubs file.ts file2.py # Specific files (< 1s) |
| 29 | ubs $(git diff --name-only --cached) # Staged files |
| 30 | ubs --staged # Same, cleaner syntax |
| 31 | ubs --diff # Working tree vs HEAD |
| 32 | ``` |
| 33 | |
| 34 | ### Full Project Scans |
| 35 | |
| 36 | ```bash |
| 37 | ubs . # Current directory |
| 38 | ubs /path/to/project # Specific path |
| 39 | ubs --only=js,python src/ # Language filter (faster) |
| 40 | ``` |
| 41 | |
| 42 | ### CI/CD Mode |
| 43 | |
| 44 | ```bash |
| 45 | ubs --ci --fail-on-warning . # Strict mode for CI |
| 46 | ubs --format=json . # Machine-readable |
| 47 | ubs --format=sarif . # GitHub code scanning |
| 48 | ``` |
| 49 | |
| 50 | ## Output Format |
| 51 | |
| 52 | ``` |
| 53 | ⚠️ Category (N errors) |
| 54 | file.ts:42:5 – Issue description |
| 55 | 💡 Suggested fix |
| 56 | Exit code: 1 |
| 57 | ``` |
| 58 | |
| 59 | Parse: `file:line:col` → location | `💡` → how to fix | Exit 0/1 → pass/fail |
| 60 | |
| 61 | ## The 18 Detection Categories |
| 62 | |
| 63 | ### Critical (Always Fix) |
| 64 | |
| 65 | | Category | What It Catches | |
| 66 | |----------|-----------------| |
| 67 | | **Null Safety** | Unguarded property access, missing null checks | |
| 68 | | **Security** | XSS, injection, prototype pollution, hardcoded secrets | |
| 69 | | **Async/Await** | Missing await, unhandled rejections, race conditions | |
| 70 | | **Memory Leaks** | Event listeners without cleanup, timer leaks | |
| 71 | | **Type Coercion** | `==` vs `===`, `parseInt` without radix, NaN comparison | |
| 72 | |
| 73 | ### Important (Production Risk) |
| 74 | |
| 75 | | Category | What It Catches | |
| 76 | |----------|-----------------| |
| 77 | | **Division Safety** | Division without zero check | |
| 78 | | **Resource Lifecycle** | Unclosed files, connections, context managers | |
| 79 | | **Error Handling** | Empty catch blocks, swallowed errors | |
| 80 | | **Promise Chains** | `.then()` without `.catch()` | |
| 81 | | **Array Mutations** | Mutating during iteration | |
| 82 | |
| 83 | ### Code Quality (Contextual) |
| 84 | |
| 85 | | Category | What It Catches | |
| 86 | |----------|-----------------| |
| 87 | | **Debug Code** | `console.log`, `debugger`, `print()` statements | |
| 88 | | **TODO Markers** | `TODO`, `FIXME`, `HACK` comments | |
| 89 | | **Type Safety** | TypeScript `any` usage | |
| 90 | | **Readability** | Complex ternaries, deep nesting | |
| 91 | |
| 92 | ## Language-Specific Detection |
| 93 | |
| 94 | | Language | Key Patterns | |
| 95 | |----------|-------------| |
| 96 | | **JavaScript/TypeScript** | innerHTML XSS, eval(), missing await, React hooks deps | |
| 97 | | **Python** | eval(), open() without with, missing encoding=, None checks | |
| 98 | | **Go** | Nil pointer, goroutine leaks, defer symmetry, context cancel | |
| 99 | | **Rust** | `.unwrap()` panics, `unsafe` blocks, Option handling | |
| 100 | | **Java** | Resource leaks (try-with-resources), null checks, JDBC | |
| 101 | | **C/C++** | Buffer overflows, strcpy(), memory leaks, use-after-free | |
| 102 | | **Ruby** | eval(), send(), instance_variable_set | |
| 103 | | **Swift** | Force unwrap (!), ObjC bridging issues | |
| 104 | |
| 105 | ## Profiles |
| 106 | |
| 107 | ```bash |
| 108 | ubs --profile=strict . # Fail on warnings, enforce high standards |
| 109 | ubs --profile=loose . # Skip TODO/debug nits when prototyping |
| 110 | ``` |
| 111 | |
| 112 | ## Category Packs (Focused Scans) |
| 113 | |
| 114 | ```bash |
| 115 | ubs --category=resource-lifecycle . # Python/Go/Java resource hygiene |
| 116 | ``` |
| 117 | |
| 118 | Narrows scan to relevant languages and suppresses unrelated categories. |
| 119 | |
| 120 | ## Comparison Mode (Regression Detection) |
| 121 | |
| 122 | ```bash |
| 123 | # Capture baseline |
| 124 | ubs --ci --report-json .ubs/baseline.json . |
| 125 | |
| 126 | # Compare against baseline |
| 127 | ubs --ci --comparison .ubs/baseline.json --report-json .ubs/latest.json . |
| 128 | ``` |
| 129 | |
| 130 | Useful for CI to detect regressions vs. main branch. |
| 131 | |
| 132 | ## Output Formats |
| 133 | |
| 134 | | Format | Flag | Use Case | |
| 135 | |--------|------|----------| |
| 136 | | **text** | (default) | Human-readable terminal output | |
| 137 | | **json** | `--format=json` | Machine parsing, scripting | |
| 138 | | **jsonl** | `--format=jsonl` | Line-delimited, streaming | |
| 139 | | **sarif** | `--format=sarif` | GitHub code scanning | |
| 140 | | **html** | `--html-report=file.html` | PR attachments, dashboards | |
| 141 | |
| 142 | ## Inline Suppression |
| 143 | |
| 144 | When a finding is intentional: |
| 145 | |
| 146 | ```javascript |
| 147 | eval(trustedCode); // ubs:ignore |
| 148 | |
| 149 | // ubs:ignore-next-line |
| 150 | dangerousOperation(); |
| 151 | ``` |
| 152 | |
| 153 | ## Exit Codes |
| 154 | |
| 155 | | Code | Meaning | |
| 156 | |------|---------| |
| 157 | | `0` | No critical issues (safe to commit) | |
| 158 | | `1` | Critical issues or warnings (with `--fail-on |