\secdef is a utility command; if a definition is in the form
\def\foo{<tokens>\secdef\fooA\fooB}
a call of \foo will do
<tokens>\fooA
while calling \foo* will do
<tokens>\fooB
This is because the definition of \secdef is
\def\secdef#1#2{\@ifstar{#2}{\@dblarg{#1}}}
Therefore, leaving aside the <tokens> that may precede the execution of \secdef, we get
\@ifstar{\fooB}{\@dblarg{\fooA}}
If \foo* is called, \fooB is executed, otherwise TeX does
\@dblarg{\fooA}
and so \fooA must be defined in a special way:
\def\fooA[#1]#2{...}
like \@chapter is. The \@dblarg trick basically examines the next token; if it is [, then we are in a situation such as
\foo[X]{Y}
and LaTeX will do
\fooA[X]{Y}
Otherwise we have
\foo{Y}
and \@dblarg will arrange things in such a way that TeX will eventually see
\fooA[Y]{Y}
Change \foo into \chapter, \fooA into \@chapter and \fooB into \@schapter to better understand the idea.