Automatically certify local development servers along with remote production servers

The certificate isn't enough for a development server to serve a website. You also need the private key, and you have two options: always reuse the same (don't) or move it across servers (unadvisable, so forget about the script being part of a mainstream distribution).

From what I can tell your issue is immediately solved by installing an acme client that uses dns-01 challenges on your development server. This way, your production server gets a certificate for example.com only, and your development server gets a certificate for local.example.com only.