I use \DeclarePairedDelimiter from the mathtools package a lot, and I almost always want the delimiters to be automatically resized. Therefore, I switch the definitions of the star and non-star versions of the command as described in this question. The problem is that doing that completely destroys the optional size parameter:
Here's a MWE:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\makeatletter
\let\oldabs\abs
\def\abs{@ifstar{\oldabs}{\oldabs*}}
\makeatother
\begin{document}
[ \abs{\frac{1}{x}} \quad \abs*{\frac{1}{x}} \quad \abs[\Bigg]{\frac{1}{x}} ]
\end{document}
Is there a way to swap the star and non-star definitions without breaking the size parameter?

\abs*[\Bigg]{\frac{1}{x}}. – Tom Jan 28 '24 at 18:57