Once you've scraped off all the loose paint, go ahead and sand the remaining paint and surrounding area with a fine-grit sandpaper. Then, spackle over the 'edges' of the remaining sanded paint only. In other words, one edge of your 6" knife is 'over' the paint and the other edge is over the 'plain, sanded wall'. This way, once you're finished spackling, the dried spackle will be 'feathered' onto the edge of the paint. If you do to much sanding and ruin the job, just add more spackle and sand again. If you want a good look at your 'work', close the curtains or wait 'till dark and hold a flashlight parallel to (and up against) the wall. This will 'exaggerate' any imprefections. Remember, it's hard to get the perfect job but at least you'll see how well you've feathered the spackle.
My best to ya and hope this helps.
Jay J -MOderator
PS: Use a HIGH quality Primer/Sealer on the sanded and spackled areas. 2 coats is best. IF there's any gloss or high gloss paint, sand and prime them too ...