# How do you draw module boundaries for AI coding agents? Small tasks duplicate code, big tasks break neighbors — retained record

> Retained reddit record from reddit:ClaudeAI.

Canonical: https://highsignal.app/data/records/497deaf03ac4ca08

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:ClaudeAI)  published 2026-09-27 03:52 ingested 2026-09-28 02:37

[original source ↗](https://www.reddit.com/r/ClaudeAI/comments/1wra1ca/how_do_you_draw_module_boundaries_for_ai_coding/)

## retained text



```
I'm building a multi-product SaaS mostly with AI coding agents, and I keep hitting the same tradeoff when splitting work.



If I keep each task very small and isolated, the agent does fine locally, but it can't see what already exists elsewhere. Over time I get duplicated helpers, types, and logic, and the codebase gets bloated.



If I give the agent a bigger chunk with tightly related modules, the design comes out cleaner and smaller. But while it focuses on one part, it sometimes changes behavior another module depends on without realizing it, and that module breaks.



What I'm trying now:

\- Modules talk only through explicit contracts (types, API schemas, event formats), backed by contract tests

\- A shared layer listed in [AGENTS.md](http://AGENTS.md), plus a rule to search it before writing new helpers

\- Two kinds of tasks: internal changes (small context, can run in parallel) and interface changes (done alone, with every caller in context)

\- Full-repo typecheck and tests on every change



Questions for people doing this seriously:

1. How do you decide task size? Is "the module itself plus its neighbors' interfaces, not their implementation" a good rule?

2. How do you prevent duplication without handing the agent the whole repo?

3. Do you run a planning step before splitting work, and does it actually catch cross-module impact?

4. What broke first when you scaled up agent-driven development?
```



document fetched 2026-09-28 00:24 · canonical https://reddit.com/r/ClaudeAI/comments/1wra1ca/how_do_you_draw_module_boundaries_for_ai_coding
