Coding Guide Spotlight: Rego Style Guide

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

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!”

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



The blog of Sema.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store