Since nobody else ever posted an answer, I thought I should put one up, just in case somebody stumbles across this question. This answer deals only with packages since that is what I needed. I don't know about writing classes.
Firstly, I would say: Do you really need to create a new package? Is there definitely no pre-existing package you can use? Do you only have a few lines of custom commands, such that it isn't worth the effort?
If you just want to write up a few commands, then checking the Overleaf advice, LaTeX2e for Class and Package Writers and the LaTeX Wikibook's pages on it are probably the best starting place, and perhaps all you will need. If you can access a copy of it, it would be worth also taking a look at The LaTeX Companion (2nd ed), specifically Chapter 14 and Appendix A (it's available in O'Reilly's online learning system, if you use that).
If, on the other hand, you are wanting to create a full-blown package with supporting documentation, especially if you want to contribute it to CTAN, then your best bet is probably to use the
.dtx approach, which is arguably a de facto standard these days. This essentially involves creating a special file which includes both the commands themselves, and also the documentation to support them. The use of
dtx files is much too big a topic to describe in this post, so instead, I will include a bunch of links that may be of help:
- The dtx tutorial.
- A brief dtx FAQ.
- A blog post about an example dtx file.
- The documentation for the
doc LaTeX class, the backing class for this system.
- The documentation for
DocStrip, which is the part that pulls your commands out of the
dtx file and puts them into a
makedtx, Perl scripts to extract what you have out of a
sty file and make it a proper
- The dtx Gallery, which contains a handful of sample dtx files - though they're all quite old now.
- These questions about preparing packages for upload to CTAN (I found them well after I posted this question).
Almost certainly, there are other good resources out there, but these were the ones I found and which helped me with my task.
In the end, I completely abandoned the idea of using LaTeX3 for now, since I couldn't find anything that provided a nice introduction to it, instead of appearing to be reference material for those who are already knowledgeable about it. I imagine there are good resources out there, but I didn't locate them.