Coding Guide Spotlight: Rego Style Guide

2 min readJun 17, 2022

Styra, the founders of Open Policy Agent (OPA), have recently released a new style guide for Rego.

As Anders Eknert, Developer Advocate at Styra wrote:‍

Hey everyone! Since several people have asked for a style guide for Rego, I decided to write one.

The Styra team took lessons from hundreds of thousands of lines of Rego code as well as interviews with leading Rego community members to build this guide.

The purpose of this style guide is to provide a collection of recommendations and best practices.

It will be actively maintained, so check the changelogs for updates.

It already has 108 stars. Well done.

What we like

  • Clearly organized
  • Big picture context provided
  • Not only General Advice but also Rules, Variables, and more‍

Sample: Use opa fmt

Want to learn more?

Want to help?

  • Share your thoughts and ideas by raising an issue in the GitHub project. As Anders wrote: “First iteration, so feedback is much appreciated!”
  • If you like it, don’t forget to give the project a ⭐️
  • Share it with anyone who might be interested :)

Using this Guide in Code Reviews

Sema has built a free code review assistant and developer portfolio tool for GitHub. You can easily access this Style Guide while you do code reviews.

Sign up for free at

Originally published at