Painting bolt heads

What's the trick to not scratching the paint off bolt heads after they're painted?
Or is there one?
I've never had any good luck with that. ....