Example 15 If $x=\frac{\sqrt{5}-1}{2}$, then $x^{4}+x^{2}+2 x-$
$1=$ $\qquad$
(Sixth National Partial Provinces and Cities Junior High School Mathematics Competition)
Given $x=\frac{\sqrt{5}-1}{2}$, we know $x(x+1)=1$. We can express $x^{4}+x^{2}+2 x-1$ in terms of the powers of $x^{2}+x$. Let
$$
\begin{aligned}
x^{4} & +x^{2}+2 x-1 \\
= & A\left(x^{2}+x\right)^{2}+(B x+C)\left(x^{2}+x\right) \\
& +D x+E . \\
= & A x^{4}+(2 A+B) x^{3}+(A+B+C) x^{2} \\
& +(C+D) x+E .
\end{aligned}
$$

By comparing the coefficients of corresponding terms on both sides, we get
$$
\left\{\begin{array}{l}
A=1, \\
2 A+B=0, \\
A+B+C=1, \\
C+D=2, \\
E=-1 .
\end{array}\right.
$$

Solving these, we find $A=1, B=-2, C=2, D=0, E=-1$.
$$
\begin{aligned}
\therefore & x^{4}+x^{2}+2 x-1 \\
& =\left(x^{2}+x\right)^{2}+(-2 x+2)\left(x^{2}+x\right)-1 \\
& =1^{2}+(-2 x+2) \times 1-1 \\
& =2-2 x=3-\sqrt{5} .
\end{aligned}
$$