The present invention provides a heterocyclic compound of formula (I), a pharmaceutically acceptable salt thereof, a prodrug thereof or a hydrate thereof, wherein A, A B, D, R1, R2 and R3 are as defined herein, a pharmaceutical composition comprising a compound of formula (I) as an active ingredient, methods of production, and methods of use thereof. Particularly, the present invention provides a compound of formula (I) useful for treating or preventing a disease, condition or disorder associated with protein kinases, preferably Janus Kinase family.