Scrubby

Conventions

Scrubby learns the coding patterns your team actually follows and uses them to review code consistently.

Conventions are the unwritten rules of your codebase — the patterns your team has settled into without ever writing down. Scrubby extracts them from real code and uses them to review changes against your team’s actual practices, not a generic style guide.

How conventions are learned

During indexing, Scrubby samples code from each segment (a cluster of related files) and extracts the patterns it finds. The sampling is bounded so analysis stays fast even on large repos.

Each convention gets a confidence score from 0 to 1. Higher scores mean the pattern is more consistent across the segment. Conventions with confidence above 0.7 are considered high-confidence and are prioritized in reviews; lower-confidence patterns are still tracked but only surfaced when the evidence is strong.

Convention types

Scrubby detects eight categories of conventions:

  • Naming — snake_case vs camelCase, class naming, file naming patterns.
  • Imports — absolute vs relative, barrel files, autoloading patterns.
  • Structure — file and method length, public/private separation, module organization.
  • Error handling — specific vs generic rescue, custom error classes, error reporting patterns.
  • Testing — test framework, factory usage, mocking style, assertion patterns.
  • Documentation — comment density, docstring style, inline comment patterns.
  • State management — how state is stored and accessed across the codebase.
  • API design — endpoint patterns, parameter handling, response formatting.

How conventions are used

Conventions power two key flows.

File reviews

When your AI editor calls scrubby_review on a file, the response includes the conventions that apply to that file’s segment. Your editor uses those to write code that matches your team’s style on the first pass.

PR reviews

During automated PR review, Scrubby checks each changed file against the conventions for its segment. Violations are flagged with inline GitHub suggestions that show the expected pattern, ready to commit directly from the PR.

Viewing conventions

Use scrubby_get_segments to see all segments and their extracted conventions. Each convention includes the pattern description, category, and confidence score.

When conventions feel wrong

If Scrubby flags a convention violation that you disagree with:

  • The convention may be stale. The team has moved on but enough old code still uses the pattern that confidence is high. Update the relevant files (or just keep going with the new pattern) and the next index will adjust the score.
  • The segment may be misclustered. Conventions live at the segment level, so two distinct subsystems being lumped into one segment can produce conflicting patterns. Re-indexing after significant directory restructures usually fixes this.
  • The finding may genuinely be a false positive. Dismiss it from the PR; that signal flows back into Scrubby’s learning loop.

For more on the feedback loop, see Findings & the Learning Loop.

Last updated