The present invention provides heteroaryl substituted pyrrolo[2,3-b]pyridines (I) and heteroaryl substituted pyrrolo[2,3-b]pyrimidines that modulate the activity of Janus kinases and are useful in the treatment of diseases related to activity of Janus kinases including, for example, immune-related diseases, skin disorders, myeloid proliferative disorders, cancer, and other diseases.本發明係提供經雜芳基取代之吡咯并[2,3-b]吡啶類與經雜芳基取代之吡咯并[2,3-b]嘧啶類,其會調制傑納斯(Janus)激酶之活性,且可用於治療與傑納斯激酶之活性有關聯之疾病,包括例如免疫相關疾病、皮膚病症、髓樣增生病症、癌症及其他疾病。