There is a suggested sequence for connecting and disconnecting from shore power and sound reasoning for it. When connecting to shore power, first make sure the main AC disconnect switch is in the “off” position and connect to the boat side inlet before connecting to the dockside receptacle. Once connected to the dockside receptacle, check the boat's AC panel for line power and ensure that the reverse polarity indicator is not illuminated. If all is good, turn the main AC disconnect switch to the "on" position. Ideally all the panel distribution circuits would be in the off position also allowing the circuits to be connected individually one at a time, to slowly bring the power demand up to normal usage levels. To disconnect from shore power, simply reverse the above procedure.
The reason for having the circuit breakers off prior to connecting to shore power is the same as turning breakers off before disconnecting; to avoid power spikes from arcing that can occur with connection and/or disconnection of circuits under load. Arcing, and the resulting power spikes, can harm personnel and equipment faster than protective hardware can react. Additionally, having the main breaker off before connecting allows a chance to check for dangerous reversed polarity. The reason to connect to the boat first is that if you initially connect to the dockside receptacle, you will be carrying a live circuit for the brief time before you connect to the boat inlet.
PYS Electrical Technician