While you can start form
ltxdoc and 'roll your own', the recommended approach is to use
l3doc, which is the class used the the LaTeX team for
expl3 itself. This is currently a rather large collection of hacks, but does deal correctly with things like
_ in names, and also provides a richer set of documentation environments than
l3doc is lacking really comprehensive documentation: as I say, it's not exactly perfect internally! You can typeset
l3doc.dtx to at least get some information, however.
Perhaps the best way to get the hang of things is to take a look at some of the LaTeX3 sources. I'd recommend avoiding
l3doc.dtx itself and probably
l3basics.dtx as they are atypical: something like
l3clist.dtx is probably a rather better place to look. (As well as the use of
l3doc, the sources show the 'house style' the team have standardised on. We are keen to encourage that as a more general '
expl3 code style': while you might not totally agree with every decision, in the long term it would be good if most
expl3 code looks the same irrespective of author, as this will aid with maintenance.)