Rules help Firebender understand how to write high quality code. Add rules to the rules array in firebender.json to specify guidelines.

Rules apply to all features of Firebender such as autocomplete, chat, and inline AI changes

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:

firebender.json
{
  "rules": [
    "Project is a food delivery app (Doordash)",
    "Never use runBlocking",
    "Don't hardcode dpi",
    "Use `@SerializedName` for data/retrofit classes because code gets obfuscated",
    "Follow Material Design 3 guidelines and components",
    "Use Kotlin coroutines and Flow for asynchronous operations",
  ]
}

In this example, the final rules used by AI when modifying any file will be:

Editing ProfileViewModel.kt
- Project is a food delivery app (Doordash)
- Never use runBlocking
- Don't hardcode dpi
- Use `@SerializedName` for data/retrofit classes because code gets obfuscated
- Follow Material Design 3 guidelines and components
- Use Kotlin coroutines and Flow for asynchronous operations

Situational Rules Example: Kotest files

firebender.json
{
  "rules": [
    "Project is a food delivery app (Doordash)",
    {
      "filePathMatches": "*Kotest.kt",
      "rules": [
        "Use Kotest framework/BDD for tests"
      ]
    }
  ]
}

In this example, are being used on a file ending in Kotest.kt, Firebender will add the nested rules array and append to the general rules. Modifying a ProfileViewModelKotest.kt file would result in rules:

Editing ProfileViewModelKotest.kt
- Project is a food delivery app (Doordash)
- Use Kotest framework/BDD for tests

This is because ProfileViewModelKotest.kt matches the filePathMatches pattern. filePathMatches follows the same regex notation as typical line in .gitignore.