- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Simple principles that make AI-assisted coding reliable in real codebases.
Vibe coding is now part of daily engineering work: describe intent, let an AI assistant generate code, iterate fast, ship faster.
We did that too. And it worked—at first.
Then we started noticing patterns repeating across changes. Each one looked small. Together, they quietly added tech debt at the speed of generation.
This post is a practical playbook for getting better results from vibe coding—without losing speed.
Starter kit (template + examples): https://github.com/saneroen/vibe-coding-starter-kit.git
The assistant would place code wherever it fit. The change worked, but the repo became harder to understand. Over time, the codebase lost its shape.
Handlers started doing validation, persistence, retries, error mapping, and domain decisions in one place. Changing a business rule meant editing route code, DB code, and vendor logic together.
One module used env vars directly. Another used a config dict. Another introduced a wrapper. Same story for database calls and error handling. Soon, refactoring felt risky because there was no “one way” to do things.
We saw "postgres", "pg", "postgresql" appear in the same codebase over time. It wasn’t malice—it’s what happens when speed wins and contracts don’t exist.
When business logic was tangled with infrastructure, tests required real databases, real network calls, and brittle setup. The result: fewer tests and slower releases.
At that point, vibe coding wasn’t making us faster anymore.
We didn’t over-engineer. We added guardrails that made the repo predictable—for humans and for AI.
The results were immediate:
Here are the principles.
Tech changes constantly: databases, SDKs, observability stacks, queues, identity providers, model providers.
If business logic depends directly on those choices, every change becomes a rewrite.
So we enforced one rule:
Business logic must not depend on infrastructure details.
Treat infrastructure as replaceable.
This single rule is the foundation for portability and long-term speed.
Most vibe-coding mistakes happen because the assistant doesn’t know where a change belongs.
Use a predictable layout with clear boundaries:
And enforce one rule:
Dependencies point inward.
Infrastructure depends on application/domain, not the other way around.
Once this shape exists, AI stops spraying logic everywhere and starts following the structure.
When you ask an assistant to “add persistence” or “integrate service X,” it often takes the shortest path:
Instead:
All external interactions should go through interfaces defined in the application layer.
Examples:
Now the assistant has a contract to implement. Your use cases remain clean. Your tests become simple.
Without enums, provider selection becomes string soup:
Enums force a finite, explicit set of choices:
This reduces config drift, improves code reviews, and makes AI output more reliable because the assistant can see valid options.
A practical pattern:
Clean structure helps humans.
agent.md helps AI assistants behave consistently inside your repo.
Without it, every assistant session becomes a fresh interpretation of your codebase. With it, you get predictable output:
If you adopt only one habit from this post, make it this:
Every repo should include agent.md.
Keep it short and opinionated:
A feature mostly touched:
Instead of inventing new patterns, it followed the repo shape:
Instead of rewriting business logic, we implemented a new adapter and updated config.
Unit tests mocked interfaces. Integration tests focused on adapters only.
That’s when vibe coding started making us faster again—because we weren’t creating tech debt with every iteration.
If you want a working baseline you can clone and use immediately:
https://github.com/saneroen/vibe-coding-starter-kit.git
It includes:
Vibe coding is not the problem. Unstructured vibe coding is.
A little structure goes a long way: clear boundaries, explicit contracts, safe configuration, and repo-local instructions (agent.md).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| Subject | Likes |
|---|---|
| 3 Likes | |
| 2 Likes | |
| 2 Likes | |
| 1 Like | |
| 1 Like |


