If we're focusing in productivity and productivity alone*, then the best thing you can do (maybe even the only one) is bringing the pain forward.
That is to say: whenever you're writing code and you find yourself doing something you don't like, do it more; eventually, you'll start looking for ways to avoid doing it and that's where you enter (or go deeper into) the field of automation and reusage.
That simple thing improves one's coding speed immensely.
* Quality of code, depth of understanding, width of your toolbelt, etc, are all entirely different matters (although some of them might improve as well).