Peterson and Proctor obtained a formula which expresses the multivariate generating function for P-partitions on a d-complete poset P as a product in terms of hooks in P. In this paper, we give a skew generalization of Peterson–Proctor’s hook formula, i.e. a formula for the generating function of (P∖F)-partitions for a d-complete poset P and an order filter F of P, by using the notion of excited diagrams. Our proof uses the Billey-type formula and the Chevalley-type formula in the equivariant K-theory of Kac–Moody partial flag varieties. This generalization provides an alternate proof of Peterson–Proctor’s hook formula. As the equivariant cohomology version, we derive a skew generalization of a combinatorial reformulation of Nakada’s colored hook formula for roots.