WD-40 (Water Displacement formula 40) is okay for some applications, but as a penetrant, it does have an effect on ammo.
Carb Cleaners will remove most of the crud left on by the factory. Don't use brake cleaner!
Then lube with a quality oil. Some people use a "grease" on the slide, but I have found that grease collects gunpowder. Then you have to go back to the carb cleaner.
"A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed."
Life Member NRA
Life Member NAHC
Former President of the ECPT (Eifel Combat Pistol Team)