Finishers use joint compound to seal the joints between boards of drywall, but you also can use compound to repair and improve painted walls and ceilings. For example, if an area is rough, apply a layer of joint compound over it, allow it to dry and sand it smooth. To hide a ridge, build up the surfaces on each side of the prominent portion to mask the ridge's appearance.
Generally, you don't need to apply primer before joint compound on painted surfaces. Joint compound adheres well to many textures, so primer isn't necessary for adhesion. Apply the compound as smoothly as possible using wide drywall knives, which decreases the number of wiping lines and marks you make. Let the compound dry for 24 hours or so, then sand the repair area smooth. 100-grit sandpaper works well for heavy sanding, and 150-grit is suitable for final sanding before painting.
Painted surfaces that are extremely glossy are the only exception. For example, a surface finish similar to an automotive paint job might be too slick for the compound to take hold. But these types of glossy surfaces are rare in building interiors. Conventional interior glossy paints, such as those sold in retail hardware stores, will not pose a problem for joint compound.
If you're concerned about proper adhesion, apply joint compound to a small area and let it dry for 24 hours. Tap the dried compound lightly with a hammer. If the compound chips off, you'll know to use primer before applying joint compound elsewhere. If the compound dents, you won't need to use primer.
Don't apply joint compound over painted metal surfaces. Temperature shifts may cause the metal to flex, which will crack the dried compound. Applying primer before the joint compound won't change this. You can apply joint compound to wood surfaces, however, provided they don't have glossy finishes. The rougher the wood, the better the adhesion will be, so consider roughening up smooth wood surfaces with some 80-grit sandpaper before applying the compound.