When working on any electrical component on the vehicle, it is always a good idea to disconnect the negative (-) battery cable (some diesel-engine vehicles have two batteries, and therefore two cables which must be disconnected). This will prevent potential damage to many sensitive electrical components such as the Powertrain Control Module (PCM), radio, alternator, etc.
Before you disconnect the cable(s), first turn the ignition to the OFF position. This will prevent a draw on the battery, which could cause arcing (electricity trying to ground itself to the body of a vehicle, just like a spark plug jumping the gap) and, of course, damaging some components such as the alternator diodes.
When the battery cable(s) are reconnected (negative cable last), be sure to check that your lights, windshield wipers and other electrically operated safety components are all working correctly. If your vehicle contains an Electronically Tuned Radio (ETR), don't forget to also reset your radio stations. Ditto for the clock.
Anytime the battery cables have been disconnected and then reconnected, some abnormal drive symptoms could occur. This is due to the PCM losing the memory voltage and its learned adaptive strategy. The vehicle will need to be driven for 10 miles (16 km) or more until the PCM relearns its adaptive strategy, and acclimates the engine and transmission functions to your driving style.