Rules for AI
Make Firebender follow your coding standards
Rules help Firebender understand how to write high quality code. Add rules to the rules
array in firebender.json
to specify guidelines.
Firebender supports both project-specific rules and personal rules that apply across all projects. See Configuration Files for details on setting up personal rules.
To setup rules, you need to create a json file at the project root firebender.json
.
General Rules Example: Food delivery app
In $projectRoot/firebender.json
:
Situational Rules Example: Test files
Here’s an example situational rule:
If you modify the file ProfileViewModelKotest.kt
, AI will follow the rule Use Kotest framework/BDD for tests
. If you modify MainActivity.kt
, AI will not be provided the irrelevant rule.
filePathMatches
follows the same regex notation as typical line in .gitignore
.Reading Errors
Rules will use the latest file saved immediately. If there are parsing errors it will tell you which fields were incorrect:
In this case, rules[0].filePathMatches
is supposed to be a string
and not an array
.
For a complete reference of the rules syntax including advanced patterns and configuration options, see the Rules Syntax Documentation.