Also take a look here: 8. Extending Plone with add-on packages – Mastering Plone 6 development — Plone Training 2024 documentation and following chapters of the Mastering Plone Development training
You would probably use a package like GitHub - plone/plonecli: Plone Command Line Client - for creating and working with custom add-ons and themes in combination with GitHub - plone/bobtemplates.plone: Python Code Templates for Plone Projects with mr.bob and GitHub - collective/mr.bob: Mister Bob (the builder) is filesystem template renderer to set up your scaffolding.
Edit/add see also this comment for a practical approach: Testing an addon in a pip instance - #7 by 1letter
Last but not least Maik's blog: Plone command line interface - plonecli