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. Also, if you can access a copy of it, it would be worth 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).
On the other hand, if 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 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.
EDIT: Months after I wrote this answer, Alan Xiang wrote an introductory tutorial to LaTeX3 and posted it on his blog. I haven't had a chance to go through it properly yet, but it looks like exactly the sort of thing I had been hoping to find when I first posted this question. Thanks, Alan!
I also have just come across these other TeX.SE questions (I have no idea why I didn't manage to find them before), which appear to have directly useful content: see here and here.