DocsTeach Anvil your rules
Docs/Guides

Teach Anvil your rules

Learnings are rules your team teaches Anvil. They're stored per repository and added to every later review of that repository, so you don't repeat the same feedback.

Add a learning #

With a command. Comment on any pull request:

@anvil learn Don't flag missing JSDoc in test files.
@anvil remember We use date-fns, never moment.

The bot replies with the rule it saved.

In conversation. When you reply to Anvil and state a lasting preference, it saves a learning on its own and says so in its answer:

@anvil we never throw from route handlers, errors go through createError(). Please stop suggesting try/catch there.

A learning saved this way can be limited to a path (for example server/api/**) when the rule only applies there.

Each learning records who taught it and links to the comment it came from.

How they're used #

Every review gets the repository's learnings (the newest 100) as rules to follow, alongside instructions and path_instructions from .anvil.yaml. They apply to all pull requests in that repository, including ones already open, from the next review on.

Use learnings for feedback that comes up in review ("don't flag X"). Use instructions in .anvil.yaml for rules you want versioned with the code.

See and remove learnings #

Code review → Learnings in Anvil lists every learning with its repository, path (if any), author and age. Click Forget to remove one; the next review no longer uses it.

Coming #

  • Learnings scoped to a single pull request.
  • A delay before a new learning applies, so someone can review it first.
  • Import and export as CSV.