This topic always gets asked every once in a while.
For starters, always play on 3 stock, 8 minute timer with stages set to random, with the stages selected to match your area's typical stage list. Probably pretty obvious.
(Assuming you have played for a decent length of time) Start off with a lv 8. Once you think you are comfortable with moving your character around and have started implementing many different techs for your character without much difficulty (such as mortar slide with snake, or edgehogging when you should, or controlling sonic's spindashes, etc.), move onto the lv 9 cpu.
The level 9 CPU will read inputs from your controller and seem difficult to hit as you keep trying to attack it either by hitting you out of attacks, power shielding attacks, or getting out of the way with dodges. This is a great way to test yourself to see if you are becoming very aggressive or not spacing your attacks properly.
A quick example, trying to hit the CPU when they are falling from the sky will usually not work because they airdodge it or move out of the way. Being aggressive and acting hastily in this case is a bad idea. You want to position yourself in a way that you can cover the options they have. Jump near your opponent and wait for them to do something, once you see what they have done (like airdodge), then attack. You spaced yourself by jumping near them, but without being in danger of being hit and waited until they did something and punished it. There are other situations, but this should give a general idea about playing defensively.
However, you will eventually need the human element in your matches. Get on wifi, try to teach your friend, or simply got involved with the smash community if you can (best way). Otherwise, there is not much you can improve solely on CPU alone.