> Markdown version of [/videos/100149-practical-tips-for-keeping-your-c-code-base-clean?t=208](https://www.wearedevelopers.com/videos/100149-practical-tips-for-keeping-your-c-code-base-clean?t=208). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Practical tips for keeping your C# code base clean Is your C# codebase slowly turning into a tangled, distributed monolith? Discover pragmatic habits and architectural tweaks to shed unnecessary complexity and reclaim your code's maintainability. - **Speakers:** [Dennis Doomen](https://www.wearedevelopers.com/@dennis-doomen) - **Event:** World Congress 2026 Europe - **Published:** July 9, 2026 - **Duration:** 22:48 - **URL:** https://www.wearedevelopers.com/videos/100149-practical-tips-for-keeping-your-c-code-base-clean ## Summary As C# codebases scale, development teams often struggle to maintain consistency and preserve the original architecture. To prevent distributed monoliths and technical debt, teams must adopt pragmatic habits starting with explicit guidelines around source control hygiene, HTTP configurations, and error handling. AI assistants like Claude and GitHub Copilot serve as powerful workflow accelerators for refactoring logic and managing fixup commits, but the human developer must always own the code's maintainability. Achieving a clean architecture means shedding unnecessary complexity, such as reverting overgrown microservice setups into modular monoliths when context boundaries blur. Grouping files by functional folder structures—the screaming architecture pattern—aligns repositories visually with their business domain rather than technical layers. Additionally, making C# classes internal by default instead of public clearly exposes unreferenced logic, allowing teams to confidently delete unused code. Instead of aggressively eliminating duplication, developers should wait for a clear rule of three pattern before extracting shared helper projects. Furthermore, teams can embed static analysis and strict formatters like SonarQube, Roslyn analyzers, and EditorConfig directly into their build pipelines to automatically catch architectural smells early. During code review, keeping test names concise and fact-based allows reviewers to parse intent immediately. To streamline repository history, teams should embrace interactive rebasing rather than messy merge commits. Finally, applying the Boy Scout rule to leave code incrementally cleaner alongside using simple visual cues—like emojis in pull request comments to distinguish between blocking issues, suggestions, and nitpicks—dramatically improves engineering culture and long-term code quality. **Keywords:** c# codebase maintenance, modular monolith architecture, screaming architecture pattern, ai-assisted code refactoring, github copilot automation, static code analysis tools, roslyn analyzers configuration, sonarqube integration, editorconfig formatting, c-sharp internal by default, git interactive rebase workflow, pull request code reviews, interface segregation principle, dependency injection management, rule of three refactoring ## Chapters 1. **Establishing project guidelines and HTTP logging standards** (00:32) — Documenting source control decisions and defining strict HTTP endpoint behaviors prevents future troubleshooting pain in production environments. 1. **Improving and maintaining AI prompts for code generation** (03:28) — Treating AI prompts as reusable skills and continuously refining them based on manual feedback ensures generated code remains human-maintainable. 1. **Evaluating microservices and managing package dependencies** (04:40) — Merging overly distributed microservices into a modular monolith and structuring packages to minimize ripple effects solves common diamond dependency problems. 1. **Simplifying solution structures and splitting shared projects** (06:29) — Consolidating projects that deploy together and splitting overly generic shared modules reduces unnecessary coupling in large codebases. 1. **Adopting functional folder structures for screaming architecture** (08:49) — Organizing folder structures by functional features rather than technical layers allows developers to instantly grasp the underlying domain architecture. 1. **Making classes internal by default to safely delete code** (09:33) — Restricting access modifiers to internal allows modern IDEs and AI tools to easily identify and confidently remove unused code. 1. **Writing contextual documentation for self-explanatory code limits** (11:11) — Adding functional comments that explain the reasoning and context behind complex logic prevents confusion for future maintainers. 1. **Structuring and shortening test names for readability** (12:24) — Grouping unit tests with nested classes and using concise, fact-based names makes pull requests and expected behavior easier to review. 1. **Localizing dependency injection registrations in functional modules** (14:37) — Grouping dependency injection registrations into extension methods within their respective functional folders prevents the root application container from becoming unmanageable. 1. **Applying the scouting rule and splitting pull requests** (16:11) — Breaking large refactoring efforts into separate commits or pull requests ensures functional changes remain easy to review and approve. 1. **Adopting standard branching strategies and utilizing repository forks** (18:07) — Moving feature branches to personal forks and adhering to established workflows like GitHub Flow keeps the main repository clean and understandable. 1. **Maintaining clean git histories with rebasing and fixup commits** (19:27) — Using interactive rebases and fixup commits avoids cluttered merge histories and enables efficient bug tracking through version control. 1. **Clarifying code review expectations with emoji indicators** (21:25) — Prefixing code review comments with specific emojis clarifies whether feedback is a strict requirement, a suggestion, or a minor nitpick. ## Related Moments - [Introduction to keeping test code clean](https://www.wearedevelopers.com/videos/515-dirty-tests-and-how-to-clean-them) (from "Dirty Tests And How To Clean Them") - [Defining the core principles of clean code](https://www.wearedevelopers.com/videos/515-dirty-tests-and-how-to-clean-them) (from "Dirty Tests And How To Clean Them") - [Evaluating generated code syntax and maintaining quality control](https://www.wearedevelopers.com/videos/1906-rag-s-not-dead-you-re-just-using-it-wrong-phil-nash) (from "RAG's Not Dead, You're Just Using It Wrong! - Phil Nash") - [Tackling code smells during routine peer code reviews](https://www.wearedevelopers.com/videos/1047-identifying-code-smells) (from "Identifying code smells") - [Combining refactoring techniques with best programming practices](https://www.wearedevelopers.com/videos/660-i-will-have-to-refactor-and-now-refactoring-techniques-in-java) (from "I will have to refactor ! And now ? Refactoring Techniques in Java") - [Balancing technical debt and clean code practices](https://www.wearedevelopers.com/videos/100360-developing-the-backend-with-stefan-lingler-cto-at-shpock) (from "Developing the Backend with Stefan Lingler, CTO at Shpock") ## Related Articles - [How to Avoid Over-Engineering](https://www.wearedevelopers.com/magazine/546-how-to-avoid-over-engineering) - [Liuba Gonta and Yuliya Khadasevic - GitHub Copilot Beyond the Basics - 10 Ways to Elevate Your Coding](https://www.wearedevelopers.com/magazine/490-liuba-gonta-and-yuliya-khadasevic-github-copilot-beyond-the-basics-10-ways-to-elevate-your-coding) - [Visual Studio Code Shortcuts for Cleaning Up Your Code](https://www.wearedevelopers.com/magazine/410-visual-studio-code-shortcuts-for-cleaning-up-your-code) - [The real reason we document our code](https://www.wearedevelopers.com/magazine/518-the-real-reason-we-document-our-code) ## Related Jobs - [Senior Software Engineer, Enterprise Products](https://www.wearedevelopers.com/jobs/ext/1841248-senior-software-engineer-enterprise-products) at **GitHub** - [Senior Software Engineer](https://www.wearedevelopers.com/jobs/ext/15942-senior-software-engineer) at **GitHub** - [Senior Software Engineer, Client Apps Platform](https://www.wearedevelopers.com/jobs/ext/1773893-senior-software-engineer-client-apps-platform) at **GitHub** - [Senior Software Engineer](https://www.wearedevelopers.com/jobs/ext/159190-senior-software-engineer) at **GitHub** - [Staff Software Engineer, Copilot Experiences](https://www.wearedevelopers.com/jobs/ext/164361-staff-software-engineer-copilot-experiences) at **GitHub** - [Principal Software Engineer, Enterprise AI Platform](https://www.wearedevelopers.com/jobs/ext/1467292-principal-software-engineer-enterprise-ai-platform) at **GitHub**