You might be thinking of "bang on the nail" perhaps? This refers to hitting a nail with a hammer and placing the hammer just right (so you don't hit your finger!)
There is also an expression "playing it by the book" which means doing something according to the rules, or in just the way it is supposed to be done.
Hope that helps!