# Workflow: scale-to-zero cost optimization for dev environments

## TL;DR

Dev/staging databases that cost near zero when idle and wake without errors when used. Console shows dev computes Idle most of the day; first-query wake succeeds; the bill's compute line drops.

Use this when you run into the situation in the title.

**When not to use this skill:** unrelated tasks. It covers only the procedure above.

## Steps

1. For each dev/staging compute, confirm scale to zero is enabled with the default 5-minute idle timeout (or set it explicitly).

2. Set autoscaling min to the smallest size (0.25 CU) so even active dev usage is cheap.

   Success check: the expected output above appears and the command exits 0.

3. Align client pools with the idle timeout: SQLAlchemy `pool_recycle` at or below the timeout with `pool_pre_ping=True`; Django `CONN_MAX_AGE=0` or `CONN_HEALTH_CHECKS`.

4. Use schema-only or anonymized branches for dev data so a dev database contains no production PII worth protecting at rest beyond the defaults.

   Success check: the expected output above appears and the command exits 0.

5. Review the bill after one cycle: compute hours for dev branches should collapse.

## Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

## Details

# Workflow: scale-to-zero cost optimization for dev

## Goal

## Ordering constraints

- Set pool recycling before relying on wake behavior, or the first query after idle fails on a dead pooled connection and the "optimization" looks like an outage.
- Anonymize before handing the branch to developers, not after.

## Traps

- Do not apply this to latency-sensitive production; the cold start is the price of the savings.
- Cron jobs that run every 10 minutes keep the compute warm all day; either accept the cost or batch the jobs.
- Each branch's compute bills separately; ten dev branches each with a warm compute is not "dev is cheap".

## Verify
