As an addendum, I genuinely believe there's a sequence issue here. Of course one can't postpone extraction of natural resources indefinitely until institutions have been built, but there is a sense, and I think cases like Nigeria and other historical examples support that sense, that if the extractive economy grows very quickly without significant progress in building institutions to regulate that economy and use resources transparently in ways that foster stronger relationships between governments and citizens, then it's very difficult to catch up after the fact. Once the incentives have been distorted, once politics functions on the basis of access to rents, it becomes very difficult to turn that around after the fact.
So sequencing, which means working on these institutional questions aggressively and systemically early on, and not encouraging a rapid race to extract as much as can possibly be extracted quickly, seems to me to be a very important part of the answer to your question.
I think there is another set of issues, and then I'll stop. Many have made the observation that one of the problems with the rise of extractive industries in societies, such as the ones you're talking about, is that government's attention—because its income primarily comes from extractive industry—is oriented towards the extractive industry rather than the citizenry.
Working on initiatives that can strengthen the relationships between governments and citizens, whether it's through electoral support or transparency initiatives and such, seems to me to be also critical to try to avoid that distortion of government's orientation away from its citizenry and towards extractive industries, given that extractive industries are the primary source of income...even establishing tax-based systems. There's a strong argument to be made that tax and democracy go together.