I don’t know what level of knowledge you’re starting out from, so I’ll start at the beginning:
This is the documentation page. Scroll down far enough and it will give you a beginner’s list of what packages you need for which functionality (e.g., a networking qube, etc.)
Minimal templates | Qubes OS (qubes-os.org)
This was Sven’s thread that got me started:
Automate debian-minimal based template creation - Community Guides - Qubes OS Forum (qubes-os.org)
His method is to start with debian-11-minimal (use 12 now), clone it, and then install really basic stuff (whatever you need to keep you sane in a terminal window). Then clone that and create sys-net, clone the original again and create sys-firewall, etc.
Basically it’s a lot of clone (done on dom0) and install (done on the new template) cycles. I’ve since moved over to using salt, but it has this nasty habit of cloning, then immediately doing the next clone (not waiting for the installs to complete). So I have a hybrid salt/bash way of doing things.
Because of the way this turns out to be an inheritance tree, if I clone my “root” template and run that clone, and it lights up as needing an update, I know every one of my templates needs to be updated. If something further down the tree lights up, I only have to do that part of the tree.
I hope that’s enough to get you started, if not by all means ask!