Solution (source code)

= Solution

Apply <Stokes theorem> to $\mathbf F=\psi\mathbf B$, with $\mathbf B$ an arbitrary constant vector. The <curl product rule for a scalar field> reduces to $\nabla\times(\psi\mathbf B)=\nabla\psi\times\mathbf B$. Using the <scalar triple product>,
$$
\mathbf B\cdot\oint_C\psi\,d\mathbf r=\iint_S\hat{\mathbf n}\cdot(\nabla\psi\times\mathbf B)\,dS=\mathbf B\cdot\iint_S(\hat{\mathbf n}\times\nabla\psi)\,dS.
$$
Since these scalar products agree for every $\mathbf B$, the vectors agree. This proves the <vector-valued Stokes identity>
$$
\boxed{\oint_C\psi\,d\mathbf r=\iint_S(\hat{\mathbf n}\times\nabla\psi)\,dS.}
$$
In particular, the ordering of the <cross product> is normal crossed with gradient; reversing it would change the sign.