Disclaimer: This is not a medical diagnosis. You should see a doctor. That said,
Am I in danger of injuring my hands?
Yes. Look into "repetitive strain injury" and "carpal tunnel syndrome". If you google "carpal tunnel syndrome guitar", you'll find many relevant articles, such as this one.
Musicians spend hours perfecting their trade, often leading to overuse injuries of the hand; of specific concern to musicians is carpal tunnel syndrome (CTS).
On the other hand, there are articles such as this one that claim that "surprisingly" musicians are less likely to have it. (It could be a selection bias though: people prone to carpal tunnel tend to not end up as professional musicians, I imagine)
so I want to take the best measures
Use an ergonomic keyboard. Don't use Emacs (with its awkward native keybindings) (1)
(1) It looks like a lot of people central to Emacs development injured their hands. It could be a giant coincidence, but I say, better safe than sorry.