  Inspired by a result of Colding, the present paper studies the Green function
$G$ on a non-parabolic $\mathrm{RCD}(0,N)$ space $(X, \mathsf{d},
\mathfrak{m})$ for some finite $N>2$. Defining $\mathsf{b}_x=G(x,
\cdot)^{\frac{1}{2-N}}$ for a point $x \in X$, which plays a role of a smoothed
distance function from $x$, we prove that the gradient $|\nabla \mathsf{b}_x|$
has the canonical pointwise representative with the sharp upper bound in terms
of the $N$-volume density $\nu_x=\lim_{r\to 0^+}\frac{\mathfrak{m}
(B_r(x))}{r^N}$ of $\mathfrak{m}$ at $x$;
  \begin{equation*}
  |\nabla \mathsf{b}_x|(y) \le \left(N(N-2)\nu_x\right)^{\frac{1}{N-2}}, \quad
\text{for any $y \in X \setminus \{x\}$}.
  \end{equation*} Moreover the rigidity is obtained, namely, the upper bound is
attained at a point $y \in X \setminus \{x\}$ if and only if the space is
isomorphic to the $N$-metric measure cone over an $\mathrm{RCD}(N-2, N-1)$
space. In the case when $x$ is an $N$-regular point, the rigidity states an
isomorphism to the $N$-dimensional Euclidean space $\mathbb{R}^N$, thus, this
extends the result of Colding to $\mathrm{RCD}(0,N)$ spaces. It is emphasized
that the almost rigidities are also proved, which are new even in the smooth
framework.
