Posts

AI agents changed my opinion on vertical slices.

A post about why vertical slices make feature ownership, reviews, tests, and coordination clearer when working with multiple AI agents.

AI agents changed my opinion on vertical slices.

The old preference

For years, I preferred a traditional layered architecture.

Controllers/
Services/
Repositories/
DTOs/
Models/

It makes navigation straightforward. If I need a repository, I know exactly where to look.

The optimization target changed

Then I started working with multiple AI agents, and suddenly the optimization target changed. Imagine one agent implementing Shipping while another implements Billing.

With a layered architecture, they both end up touching controllers, services, repositories, tests, and dependency injection, even though they are working on different features. The implementation of a single feature becomes scattered across the entire project. So does the code review.

Vertical slices fit agent ownership

The model that worked better was organizing the code around features instead of layers. Shipping and Billing stop being scattered concepts that have to be reconstructed from several folders. They become visible parts of the project structure.

Features/
├── Shipping/
│   ├── Controllers/
│   ├── Services/
│   ├── Repositories/
│   └── DTOs/
│
└── Billing/
    ├── Controllers/
    ├── Services/
    ├── Repositories/
    └── DTOs/

Now each agent owns an entire feature, not just a few files spread across the solution. Reviewing changes becomes opening Features/Shipping instead of searching through controllers, services, repositories, DTOs, dependency injection, and tests in different places.

Tests by feature

The same ownership boundary applies to verification. If the implementation belongs to a feature, the tests that prove it works should be organized by that feature too. Otherwise the review still requires jumping between multiple layers within the test project aswell.

Features/
├── Shipping/
│   ├── HTTP/
│   ├── Repository/
│   └── Unit/
│
└── Billing/
    ├── HTTP/
    ├── Repository/
    └── Unit/

Each agent only owns the implementation and everything required to verify it. That keeps the task boundary clear: the agent changes the feature, updates the relevant tests, and leaves the rest of the system alone. Nothing more.

Observable ownership

In a previous post, I argued that event-driven architectures work well with AI because they make behavior observable. I think this is the architectural equivalent.

Vertical slices make ownership immediately observable. You immediately know which agent owns a feature, where to review its changes, and where its tests live.

The existing workflow pays off again

The interesting part is that vertical slices were not designed for AI. They were designed to improve cohesion. Agentic development simply exposes the same problems again: Agents need to coordinate with each other just like humans do.

The less coordination your architecture requires, the better it works for humans and AI alike.