Why Smaller Repositories Lead to Higher Code Quality
Monorepos, favored by giants, often compromise code quality. Learn how smaller repositories enhance code through stricter style, deeper tests, better reviews, faster releases, and easier open-sourcing.
You can cite this blog post using BibTeX as follows:
@misc{bugayenko2025blog1116,
author = {Bugayenko, Yegor},
title = {{Small Repo, High Quality}},
howpublished = {\url{https://www.yegor256.com/251116.html}},
year = {2025},
month = {nov},
note = {[Online; accessed 08-12-2025]}
}
I am not a proponent of monolithic repositories. These often consolidate multiple projects, potentially developed in different languages by various teams. While major tech companies like Google, Facebook, and Yandex favor them, citing reduced integration overhead, I contend that this benefit often comes at a significant cost to code quality. In my view, smaller, more focused repositories foster superior code development.
Morfiy (2008) by Aleksey Balabanov
Achieving higher quality in a smaller repository is possible for several key reasons:
- Stricter Style Enforcement: Maintaining consistent formatting across a thousand lines of code is considerably easier than across a million. With a compact codebase, you can configure linters like ESLint to their maximum strictness, enabling a comprehensive set of rules. This rigorous control over code stylistics directly results in cleaner, more maintainable code.
- Deeper and Faster Testing: Integration (or "deep") tests are inherently time-consuming. In a smaller repository, achieving robust integration test coverage does not necessarily lead to a slow build process. Conversely, in larger repositories, extensive integration tests invariably cause slow builds, often compelling teams to reduce coverage to mitigate delays.
- More Pedantic Code Reviews: In a sprawling repository, recalling every aspect of the design can be challenging. A pull request that impacts seemingly unrelated parts of the codebase can pose a significant challenge for a thorough review, even for the project architect. Smaller scopes inherently simplify detailed scrutiny and lead to more effective feedback.
- Comprehensive README Files: It's often observed that many large open-source projects feature brief, and sometimes incomplete, README files. Expanding these would transform them into lengthy manuals, frequently redirecting users to external documentation websites. This inability to clearly define the project's entire scope in a single file often contributes to scope creep and confusion among contributors, leading to issues such as code duplication.
- Frequent Releases: In a larger repository, frequent reintegration can be expensive, both in terms of time and financial resources. For a small repository, however, a build completing in a matter of seconds is not merely a programmer's aspiration but an achievable reality. Both Continuous Integration (CI) and Continuous Delivery (CD) become remarkably inexpensive. After virtually every minor change, a new release with its own distinct version can be published. Monorepos, in contrast, typically necessitate waiting for a substantial accumulation of changes before a release can occur.
- Effective AI Agent Utilization: It is widely acknowledged that modern Large Language Models (LLMs) operate with limited context windows. A codebase of a million lines, or even ten thousand, vastly exceeds the processing capacity of even the most powerful LLMs. By maintaining small repositories, we significantly enhance the effectiveness of our AI agents.
- Faster Onboarding: Larger codebases are generally older, more chaotic, and often laden with legacy code. Consequently, it takes considerably longer for new contributors to become productive and make meaningful contributions. Monorepos tend to attract long-term, office-based contributors who might prioritize job security over the intrinsic quality of the code.
- Clearer Responsibility: Within vast codebases, the very concept of clear code ownership is difficult to maintain. Programmers often find it challenging to feel personally responsible for code sections written or modified by others. Smaller repositories, however, foster a stronger emotional connection and a heightened sense of individual responsibility among developers for their specific code.
- Easier Open Sourcing: Regardless of how much your management champions open source, it is practically impossible to publish an entire enterprise monorepo on GitHub. Yet, extracting and open-sourcing a small, self-contained component is entirely feasible. Code that is openly visible, subject to public review, and critically scrutinized by a wider community is generally perceived to achieve a higher standard of quality.
In conclusion, I advocate for actively seeking opportunities to isolate and extract specific code functionalities into standalone packages. Once these components are independent, insist on making them open source, actively promote them within the developer community, and finally, consider exploring opportunities with organizations like Zerocracy.