Trim and most walls
Caulk, prime, paint
Caulk about 10 linear feet at a time and then wipe with a damp rag or sponge. The caulk practically disappears. Paint as usual. Wiping it smooth will leave a thin smear of caulk on the walls, paint after to make it disappear especially if you are using a wall color other than white.
Baths and showers and counters
prime, caulk, paint
Prime before you do the finish work like cabinets and counters and tile. Caulk where appropriate, wipe smooth. Paint over the caulk to make it disappear. Using clear caulk on counters.
To the earlier poster, If the caulk cracks, painted or unpainted, you have cracked caulk and it needs to be touched up anyways.
Dont use DAP, buy expensive caulk. Many previously good brand have turned to shit since the EPA made them go LOW VOC, and crack early.