I'm looking for real-world codebases that are messy enough to provide useful refactoring practice. I've already worked through a few coding katas, including the Golden Rose and Tennis katas, and would like to try something closer to an actual project. Ideally, the codebase would be somewhere around 1,000–5,000 lines so it's substantial but still manageable. Are there any open-source projects, deliberately poorly designed examples, or other good sources you'd recommend?
4 Answers
A personal project can become excellent refactoring practice. Build something quickly, leave it alone for a few weeks, then return and try to extend it. You’ll usually discover unclear abstractions, duplicated logic, and design decisions that no longer fit. That gives you realistic practice because you have to improve the structure without breaking features you still need.
You don’t necessarily need a project specifically labeled as spaghetti code. Most active codebases contain a few areas that are awkward or overdue for cleanup. Choose a small open-source repository, identify one well-contained problem, and refactor it incrementally. A codebase of 1,000 lines may not be terribly tangled, while a smaller project can still have plenty of design problems.
Open-source projects are probably your best bet. Pick a small project in a language you know, get it running, and spend some time understanding the tests and behavior before changing anything. Then look for focused improvements such as extracting responsibilities, reducing duplication, improving naming, or simplifying conditionals. The exact line count matters less than whether you can run the code and verify that your changes preserve its behavior.
Another option is to have a code-generation tool create a small application from vague requirements, then treat the result as a refactoring exercise. It can produce inconsistent naming, duplicated functionality, oversized functions, and weak separation of concerns. Just make sure you understand the code first and add tests before making larger structural changes.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically