It is generally practiced to apply foundation before contour to create a plain base. However, lately many makeup influencers applied contour first and only after that filed in makeup free areas with foundation and concealer. This alternative method works great for blending everything in smoothly and achieving a more natural look. So there are no strict rules on which goes first: foundation or contour.