Learning HubACFS Academy
Progress
0%
0 of 2020 remaining
  • 1
    Welcome & Overview5 min
  • 2
    Linux Navigation8 min
  • 3
    SSH & Persistence6 min
  • 4
    tmux Basics7 min
  • 5
    Git Essentials10 min
  • 6
    GitHub CLI8 min
  • 7
    Agent Commands10 min
  • 8
    NTM Command Center8 min
  • 9
    NTM Prompt Palette6 min
  • 10
    The Flywheel Loop10 min
  • 11
    Keeping Updated4 min
  • 12
    UBS: Code Quality Guardrails8 min
    NOW
  • 13
    Agent Mail Coordination10 min
  • 14
    CASS: Learning from History8 min
  • 15
    The Memory System8 min
  • 16
    Beads: Issue Tracking8 min
  • 17
    Safety Tools: SLB & CAAM6 min
  • 18
    The Art of Agent Direction12 min
  • 19
    Case Study: cass-memory15 min
  • 20
    Case Study: SLB12 min
Back to Home
Back
12/20
Lesson 12
8 min

UBS: Code Quality Guardrails

Catch bugs before they reach production

New to ACFS?

Complete the setup wizard first to get the most from these lessons.

Go to Choose Your OS
Goal

Learn to catch bugs before they reach production with UBS.

What Is UBS?

UBS (Ultimate Bug Scanner) is your safety net before every commit. It scans your code for common bugs, security issues, and anti-patterns that might slip through during development.

Think of it as a code review bot that catches issues in seconds, not hours.

Security Scanning

XSS, injection, and OWASP vulnerabilities

Bug Detection

Null safety, async/await, type issues

Fast Feedback

Scan a file in under 1 second

Multi-Language

TypeScript, Python, Rust, Go, and more

The Golden Rule

Run ubs before every commit.

Exit 0 = safe to commit. Exit >0 = fix issues first.

Essential Commands

Scan a specific file (fastest)
Scan a directory
Scan staged files before commit
Filter by language (3-5x faster)
Scan whole project (ignores node_modules)
Pro Tip
Always scope to changed files when possible. ubs file.ts runs in under 1 second, while ubs . may take 30+ seconds.

Understanding Output

UBS output follows a consistent format:

ubs output
⚠️ Null Safety (3 errors)
src/api/users.ts:42:5 – Possible null dereference
πŸ’‘ Use optional chaining: user?.profile
src/api/users.ts:87:12 – Unchecked array access
πŸ’‘ Add bounds check before accessing array[i]
⚠️ Security (1 error)
src/api/auth.ts:23:8 – SQL injection risk
πŸ’‘ Use parameterized queries instead of string concat
Exit code: 1
file:line:col→Exact location of the issue
πŸ’‘β†’Suggested fix
Exit code 0/1β†’Pass (safe) / Fail (needs fixes)

Bug Severity Guide

Critical

  • Null safety violations
  • XSS/Injection vulnerabilities
  • Async/await issues
  • Memory leaks

Always fix immediately

Important

  • Type narrowing issues
  • Division by zero risks
  • Resource leaks
  • Missing error handling

Fix before production

Contextual

  • TODO/FIXME comments
  • Console.log statements
  • Unused variables
  • Magic numbers

Use judgment

The Fix Workflow

1

Read finding

Understand the category and fix suggestion

2

Navigate to location

Go to file:line:col

3

Verify it's real

Not all findings are bugsβ€”some are false positives

4

Fix root cause

Don't just mask the symptom

5

Re-run UBS

Confirm the fix worked (exit 0)

6

Commit

Now you're safe to commit!

Pre-Commit Integration

For maximum safety, add UBS to your pre-commit workflow:

bash
1# In your workflow:
2$ git add .
3$ ubs $(git diff --name-only --cached)
4# If exit 0: proceed with commit
5# If exit 1: fix issues first
6
7$ git commit -m "feat: add user auth"
Note
ACFS agents are trained to run ubs automatically before committing. You get this protection by default!

Try It Now

bash
1# View session logs
2$ ubs sessions --entries 1
3
4# Scan your project
5$ ubs .
6
7# Get help
8$ ubs --help

Ready to level up?

Mark complete to track your learning progress.

Previous
Keeping Updated
Next
Agent Mail Coordination