Discover, create, and manage custom rules across your repositories
Custom rules allow you to enforce your organization’s specific best practices across all pull requests.The rules library lets you discover proven rules from other successful teams, apply one rule to multiple repositories, and manage everything from a central dashboard.
The rules library enables teams to share and adopt best practices efficiently. Instead of creating the same rule for each repository, you can create a rule once and apply it to any number of repositories.Manage all your rules from the rules library
To create a new rule, navigate to the Rules library in cubic and click “Add rule”. You can also adopt existing rules from the community library with a single click.Each custom rule includes:
A Name
A concise title, like “Prevent N+1 Queries” or “Require Sentry Error Handling.”
A Description
A clear, natural-language instruction the AI will use, such as “Flag code that may cause multiple database calls inside loops.”
Be as clear and explicit as possible; the more specific you are, the better the results.
Optional Path Filters
Use Glob patterns to limit where the rule applies (or exclude certain paths). This is especially helpful for monorepos, where different directories often require different rules. For example:
Include: backend/** to apply the rule only to files under a backend folder.
Exclude: !tests/** to ignore test files and focus on production code.
Custom rules can be applied to multiple repositories from a single definition. You can enable
different combinations of rules for each repository while managing them all from one central
location.
If your team uses Cursor rules, you can easily import these into cubic by clicking the Sync Cursor Rules button on the AI review page.cubic will analyze your Cursor rule files, suggest suitable custom rules, and let you select which ones you’d like to enable.
Rule limit: Each repository can have a maximum of 5 enabled custom rules at a time. The rules library allows you to define more rules but only 5 can be active per repository.
Single check per PR: cubic currently performs rule checks only once when the pull request is first opened. Subsequent commits won’t trigger additional checks yet.
Potential false positives: Occasionally, the AI might incorrectly flag or overlook certain scenarios. Consider AI feedback as helpful guidance rather than definitive judgments.
Start with the library: Before creating a new rule, check if a similar one already exists in the community library. You can adopt and customize popular rules to fit your needs.
Combine related checks: With a limit of 5 active rules per repository, combine multiple related checks into a single rule where it makes sense. The multi-repository feature means you only need to define this once.
Leverage path filters in monorepos: When working with monorepos, use Glob patterns to target specific files or folders. The “glob wizard” and “glob testing” tools help ensure your patterns work correctly.
Use repository groups: Apply rules to logical groups of repositories (e.g., all frontend repos, all microservices) to maintain consistency across similar projects.
Learn from others: Browse popular rules in the library to see what other successful teams are checking for. This can inspire new rules or improvements to your existing ones.
Complement existing tools: Custom rules should focus on checks that standard tools like ESLint or Prettier might miss, such as business logic validations or team-specific conventions.