Absolutely. Writing documentation and unit tests is good advice, but I'd suggest instead you find something you're particularly interested in, perhaps a piece of open source software you already use, and add a feature that you yourself want to use. It'll be more difficult, but it'll actually keep your interest and get you real world experience. Worst case your patch won't be accepted, but if it's a decent project they'll tell you why and what you need to do to make it acceptable.
Or, pick a small problem you want to see solved, and write an open source solution for it. The key is actually be interested in the problem you're solving.
Open source software is not magically high quality code; in fact it's not unusual to find sloppy code and practices. Don't be intimidated, jump in and give it a try. My first piece of open source still has a few users over 10 years later, but the code quality makes me cringe everytime I look at it.