Solution (source code)

= Solution

The <cross product> of the direction <vectors> is $\boldsymbol n_1\times\boldsymbol n_2=(1,-1,0)$. It is nonzero, so a common perpendicular direction exists. Projecting $\boldsymbol a_2-\boldsymbol a_1=(-1,0,1)$ onto its unit <vector> gives the <distance between skew lines>:
$$
s=\frac{|(\boldsymbol a_2-\boldsymbol a_1)\cdot(\boldsymbol n_1\times\boldsymbol n_2)|}
{\|\boldsymbol n_1\times\boldsymbol n_2\|}
=\frac{|-1|}{\sqrt2}.
$$
Thus
$$
\boxed{s=\frac1{\sqrt2}.}
$$
The numerator is a <scalar triple product>; movement along either line does not change this perpendicular projection.