Change circuit while sketch is running on arduino
As another general rule: First program your microcontroller, then connect the circuit. 

Imagine this situation: 


Your previous sketch had all outputs actively driven high by default;
Your new circuit connects various inputs to ground by default;


The current drawn due to this situation may easily exceed the absolute maximum ratings of your microcontroller and (by far most) Arduino's have no protection at all.

One precaution I usually take when experimenting, is to connect series resistors to all Arduino pins unless absolutely sure that a series resistor will corrupt the signal. Anything between 5V/20mA=250Ω and 4kΩ7 will be a good start to protect most circuits from bad wiring.