Clarity is a double-edged sword for devs in Stacks. On the one hand, it’s a language perfectly designed for the realities of smart contracts. It’s human-readable, open source code for every contract is available on the blockchain, and the language is decidable. In other words, Clarity is transparent and secure, just like you want a smart contract to be.
But on the other hand, you have to learn this language, which can be a point of friction in the beginning of your development journey on Stacks. With a new Clarity formatter in Clarinet, development just got a whole lot easier.
Cleaner, More Readable Code
With a new Clarity formatter in Clarinet, any code you generate will be auto-formatted, instantly making your code clean, readable, and easier to maintain.
Here’s an example of what unformatted code looks like:

And here’s what that same sample looks like afterwards:
.png)
No more fussing with your code’s formatting or wondering how to format it in the first place. Instead you can focus on what matters: writing the code that powers your application. Clarinet will handle the rest.
Note: this feature is currently in beta and only available in the CLI. We will be adding formatting support to the VSCode integration soon.
If you have any feedback about the formatter, please add your thoughts to this GitHub issue or reach out to us on the #clarinet channel under the Hiro Developer Tool section on the Stacks Discord.
We plan on incorporating your feedback into how the formatter works in future releases. In the meantime, if you’re unhappy with the formatting it produces you can also ignore the formatter for blocks of code with <code-rich-text>;;@format-ignore<code-rich-text>.
Happy coding!