# Tasks Work in order. Finish a task's check before starting the next. 1. **Set up the project.** Pick the stack, add the database from the `database` input, a migration tool and a test runner. Check: an empty test run passes and the service answers on a health route. 2. **Create the schema.** Add the tables in `design.md` and seed the first meter from the `meter_name` input. Check: migrations run from empty, and a test proves a second invoice for the same subscription and period is rejected by the database. 3. **Money arithmetic.** Write the rating function on its own, with no database. Check: every row of the worked examples in `design.md` passes, with `included_usage` both on and off. 4. **Usage events (R1).** Build the ingest endpoint. Check: the R1 acceptance test passes. 5. **Plans and subscriptions (R2).** Check: the R2 acceptance test passes. 6. **Invoice run (R3, R4).** Build the daily job and a way to run it by hand for a given period. Check: the R4 acceptance test passes and invoice numbers have no gaps. 7. **Collection (R5).** Build the method in the `collection` input. For `payment_provider`, read the provider's current documentation first. Check: the R5 acceptance test passes against a fake provider. 8. **Payment reminders (R6).** Only if `payment_reminders` is on. Check: the R6 acceptance test passes with emails captured in memory. 9. **Operator pages (R7).** Check: the R7 acceptance test passes. 10. **Finish.** Write the README and run the whole test suite. Check: every item under "Definition of done" in `spec.md` is true.