  We present a local construction of H(curl)-conforming piecewise polynomials
satisfying a prescribed curl constraint. We start from a piecewise polynomial
not contained in the H(curl) space but satisfying a suitable orthogonality
property. The procedure employs minimizations in vertex patches and the outcome
is, up to a generic constant independent of the underlying polynomial degree,
as accurate as the best-approximations over the entire local versions of
H(curl). This allows to design guaranteed, fully computable, constant-free, and
polynomial-degree-robust a posteriori error estimates of Prager-Synge type for
N\'ed\'elec finite element approximations of the curl-curl problem. A
divergence-free decomposition of a divergence-free H(div)-conforming piecewise
polynomial, relying on over-constrained minimizations in Raviart-Thomas spaces,
is the key ingredient. Numerical results illustrate the theoretical
developments.
