A general scheme for first order approximations in optimization