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.
On the other hand, there are articles such as this one that claim that musicians are less likely to have it.
so I want to take the best measures
Use an ergonomic keyboard. Don't use Emacs (with its native keybindings).