It's not rocket science. You just need to pay attention to a few things. Here are my recommendations in brief.
1. Put new strings on your guitar/bass! This probably needs no further comment.
2. Check that the guitar is in tune throughout the range and not making unwanted sounds. If you don't dare to adjust the guitar yourself, get a guitar technician to help you.
3. Use a DI box! Personally, I've found the active Radial J48 to be a great tool to use in my studio. It doesn't matter if you use active or passive pickups. This model can handle it.
3. Use quality A/D converters! For example, the SSL 2/2+ audio interface is a great option for reasonable money! Forget Focusrite Scarlett. It's dung compared to SSL, trust me.
These are 4 simple steps to achieve a professional DI sound at home. And remember - it's mostly in your hands!