I have a moteino that is powered by a 5V supply connected to VIN. Is it OK to plug in a USB for programming and debugging while power is connected to VIN?
Depends. My recommendation is to not do it since it's quite common that the GND coming through a USB is different than the GND from other sources. In the case of a battery it's a floating GND but I've personally seen it where I have 2 computers or a computer and a power supply and the GNDs are at different levels.
Whilst gigging in Holland, I had a PC connected to a camera via an SDI cable and the chassis ground of the server was at 18v and gave me a hell of a whack when I accidentally touched it with my leg, I was wearing shorts at the time.......
Woke me up, though.