For example, I define two commands. \mytesta with optional argument, \mytestb without optional argument. Now using \cs_meaning:N to show the command definition. The result is like this:
\documentclass{article}
\newcommand{\mytesta}[2][]{#2\quad#1}
\newcommand{\mytestb}[2]{#1\quad#2}
\setlength{\parindent}{0pt}
\ExplSyntaxOn
\cs_set_eq:NN \checkmeaning \cs_meaning:N
\ExplSyntaxOff
\begin{document}
\Large
\section{Testing}
\par\mytesta[default]{argument}
\par\mytestb{argument}{default}
\vskip 2em
\par\verb|\mytesta:|
{\par\ttfamily\checkmeaning \mytesta}
\par\verb|\mytestb:|
{\par\ttfamily\checkmeaning \mytestb}
\vskip 2em
\par\verb|Is possible to show:|
\par\verb|"[#1]#2->#2\quad #1" in \mytesta?|
\end{document}

\mytesta(you need to know some catcode manipulation to show that) – user202729 May 10 '22 at 00:36\ShowCommand\yourcommand. It will print the full definition in the terminal – Phelype Oleinik May 10 '22 at 00:51\newcommandand an optional argument, you can do\cs_new:Npn\checkmeaning#1{\cs_meaning:c{\token_to_str:N#1}}. I don't know... Maybe a\CommandMeaningwould be useful... – Phelype Oleinik May 10 '22 at 01:10