8. Let the sequence $\left\{a_{n}\right\}$ have the sum of the first $n$ terms $S_{n}$ satisfying
$$
S_{n}+a_{n-1}=\frac{n^{2}-2}{(n+1)!}(n=2,3, \cdots) \text {, }
$$

and $a_{1}=-\frac{1}{2}$.
Then the general term formula $a_{n}=$ $\qquad$
8. $\frac{1}{\sqrt{5}}\left[\left(\frac{-1-\sqrt{5}}{2}\right)^{n}-\left(\frac{-1+\sqrt{5}}{2}\right)^{n}\right]+\frac{n}{(n+1)!}$.

From $S_{n}+a_{n-1}=\frac{n^{2}-2}{(n+1)!}$, we know
$$
\begin{array}{l}
S_{n}+S_{n-1}-S_{n-2} \\
=\frac{n^{2}-2}{(n+1)!}=-\frac{1}{(n+1)!}-\frac{1}{n!}+\frac{1}{(n-1)!} .
\end{array}
$$

Let $T_{n}=S_{n}+\frac{1}{(n+1)!}$. Then
$$
T_{n}+T_{n-1}-T_{n-2}=0 \text {. }
$$

The characteristic equation is $\lambda^{2}+\lambda-1=0$.
Solving, we get $\lambda_{1,2}=\frac{-1 \pm \sqrt{5}}{2}$.
Thus, $T_{n}=A\left(\frac{-1+\sqrt{5}}{2}\right)^{n}+B\left(\frac{-1-\sqrt{5}}{2}\right)^{n}$,

where $A$ and $B$ are to be determined.
Let $S_{0}=0$. Then $T_{0}=1, T_{1}=0$, substituting into equation (1) we get
$$
A=\frac{\sqrt{5}+1}{2 \sqrt{5}}, B=\frac{\sqrt{5}-1}{2 \sqrt{5}} .
$$

Thus, $T_{n}=\frac{1}{\sqrt{5}}\left[\left(\frac{-1+\sqrt{5}}{2}\right)^{n-1}-\left(\frac{-1-\sqrt{5}}{2}\right)^{n-1}\right]$.
Therefore, $S_{n}=\frac{1}{\sqrt{5}}\left[\left(\frac{-1+\sqrt{5}}{2}\right)^{n-1}-\left(\frac{-1-\sqrt{5}}{2}\right)^{n-1}\right]-$
$$
\frac{1}{(n+1)!} \text {. }
$$

So, $a_{n}=S_{n}-S_{n-1}$
$$
=\frac{1}{\sqrt{5}}\left[\left(\frac{-1-\sqrt{5}}{2}\right)^{n}-\left(\frac{-1+\sqrt{5}}{2}\right)^{n}\right]+\frac{n}{(n+1)!} .
$$