I have the momentum operators $\hat{S}_z = S_z^{(1)}+S_z^{(2)}$ and $\mathbf{\hat{S}}^2 = \mathbf{S}_1^2+ \mathbf{S}_2^2 + 2\mathbf{S}_1 \cdot \mathbf{S}_2$, now represented, wrt the following basis $\mathcal{B} = \{|++\rangle, |+-\rangle, |-+\rangle, |--\rangle\}$, by the following $ {4\times4}$ matrices:
$$ S^2 = \hbar^2\begin{bmatrix}
2 & 0 & 0 \\
0 & \mathbb{J}_2 & 0 \\
0 & 0 & 2 \\
\end{bmatrix};S_z = \hbar\begin{bmatrix}
1 & 0 & 0 \\
0 & [0]_2 & 0 \\
0 & 0 & 1 \\
\end{bmatrix}
$$
where $J_i$ is a all-ones matrix and $[0]$ the null matrix