Example 10 (2003 Beijing Competition Problem) Let $\min \{a, b, c\}$ be the minimum of $a, b, c$. If $x, y$ are any positive real numbers, then the maximum value of $M=\min \left\{x,-\frac{1}{y}, y+\frac{1}{x}\right\}$ is $\qquad$ .
Solve: Fill in $\sqrt{2}$. Reason: From the given conditions, we have $x \geqslant M, \frac{1}{y} \geqslant M, y+\frac{1}{x} \geqslant M$, then
$$
y \leqslant \frac{1}{M}, \frac{1}{x} \leqslant \frac{1}{M}, M \leqslant y+\frac{1}{x} \leqslant \frac{2}{M} \text {. }
$$

Thus, $M^{2} \leqslant 2, M \leqslant \sqrt{2}$.
When $x=\sqrt{2}, y=\frac{1}{\sqrt{2}}$, we have $\frac{1}{y}=\sqrt{2}, y+\frac{1}{x}=\frac{1}{\sqrt{2}}+\frac{1}{\sqrt{2}}=\sqrt{2}$. At this point, $M=\sqrt{2}$, so the maximum value of $M$ is $\sqrt{2}$.