The purpose of a shaving cream, foam or gel is to create a protective barrier of lather over hair to make them soft before running a metal razor through them. They minimise friction on the face, so the blades glide smoothly without causing any nicks, cuts and bumps.