The fundamental thing to hammer a nail without hitting your finger is to hold the hammer with both hands.