

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Feedback Loops
incomplete
2: Static Typing
incomplete
3: Automatic Formatting
incomplete
4: Tests
incomplete
5: AI and Test Economics
incomplete
This lesson's interactive features are locked, please to keep using them
Without a strict formatter, your agent will spend tokens worrying about indentation, trailing commas, and line length. Not only will it waste tokens, but it will also (like any human) be inconsistent.
So, just like when working with humans, always add a code formatter to your workflow and put the problem to rest. For example:
It's just one less thing for your agent to worry about.
I prompt my agent to make formatting changes only as a last step, after all the logic changes are done. If I don't, I've found it can really slow things down.
I think the models are pretty good now at realizing that they're approaching the end of their work, and they'll call things like type checking and formatting on their own. If they don't, steer them in AGENTS.md.
Make formatting part of OpenCode's normal workflow, then try it out by adding some new unit tests for joining strings. This SlopLang code should print what's shown in the comments:
hallucinate(“” + “slop”)✨
— slop
hallucinate(“slop” + “”)✨
— slop
hallucinate(“café” + “✨”)✨
— café✨
Notably, adding empty strings doesn't change the original string, and adding a string with an emoji works as expected.
Tell OpenCode to run and submit the CLI tests from the project root.