How to Make Your AI Agent Program PHP and Laravel with Grace and Style
At Spatie, we've been developing large applications for years now. During those years we learned how to structure Laravel apps and that optimizing for readability really pays off in the long run.
With the rise of AI agents like Claude Code, we see that more and more code at Spatie is written by AI. Rest assured, all code still gets reviewed and polished by humans. Finding the right balance is the subject of a future blog post.
When using an AI agent without any configuration, we saw that it - understandably - doesn't use our coding style at all. That's why we made an effort to convert our guidelines to be understood by an AI.
We added a page to our site titled "Using our guidelines with AI", that contains instructions on how to make Claude Code understand our guidelines. With this setup Claude Code will generate more readable code out of the box. And if you've adopted our guidelines already and use Claude Code, you'll spend less time correcting Claude's generated code.
Here's a video from Povilas that demostrates the installation and usage of our AI guidelines.
Going forward, we'll likely adapt some of the rules to make Claude and similar agents behave even better.