I've intermittently had the same problem. Some basic habits you can change to help:
Cmd-Tab (and Ctrl/Shift-Tab) should not be done with one hand! Hold down Cmd with your right hand and hit tab with your left. This one change probably helped my "tendonitis claw" more than anything else. Similarly, other keyboard shortcuts should involve holding down the opposite modifier key from the key being pressed.
Let your fingers float above the keyboard. A lot of people rest their wrists on the wrist-rest and try to type; this puts a lot of pressure on the carpal tunnel, and means you have to curl your fingers more.
Two-finger scroll with your wrist & upper arm, not your fingers. It should be a really subtle movement, too, just a few millimeters displacement.
Editor wars aside, vim is better than emacs (& TextMate etc, though emacs is the worst offender) for RSI. Modal editing doesn't require that you hold down modifiers.
Take thinking breaks. When your code is compiling or you have a tough problem, get up and walk around instead of cmd-tabbing to a blog.
Don't let yourself get mad or frustrated at your code. Get up and take a walk or talk to someone instead. This is actually pretty challenging, because I've found that intensive coding tends to shut down the emotional processing parts of my brain. But that's also why it's dangerous: when you aren't consciously processing emotions, they can often get "stuck" as muscle tension; your back and shoulder muscles might remember that you were mad, or your fingers that you were frustrated, even though consciously you don't. Relaxation or meditation exercises can help get muscles un-stuck, but ideally you should be relaxed whenever you're typing.
If all else fails, switch to Dvorak. It's somewhat better for finger-movement than Qwerty, although I'm not sure the benefit outweighs the switching cost unless your fingers are really bothering you.