Build an invoice generator
Fill in the fields, hit print, get a clean PDF, with totals right to the cent.
A rented invoicing tool costs about twelve dollars a month to turn a form into a PDF, and keeps your client list on someone else's server. An invoice is a form and some arithmetic. You can build it tonight as one HTML file that keeps your data on your machine and prints with your browser's own PDF button.
Invoices are where "close enough" gets expensive. This plan steers your agent away from totals off by a cent, a PDF library nobody needed and a printout covered in buttons.
The spec and the cuts
- One HTML file. A form for sender, client and line items, a live invoice and a print button.
- The math is the product. Quantity times rate, a subtotal, an optional tax line and a total, correct to the cent every time.
- Cut: login (it's your machine), emailing (attach the PDF yourself), payments (Stripe belongs in another app) and a database (localStorage remembers your details and clients).
The prompts
Tick what you want and the prompts below change to match. Paste them into Claude Code (or Cursor, or any agent) one at a time, in order. Prompt 2 checks the money math and the layout, fixes what it finds and adds no features.
The copy buttons grab the current version.
1 · Build it
2 · The money-math + polish pass
3 · Wire up print-to-PDF
4 · Get human eyes on it before you send it
Where agents go wrong
- Floating-point money.
0.1 + 0.2doesn't equal0.3, and on an invoice that's a client emailing you about rounding. Do all the math in integer cents and format only for display. - A PDF library. Agents npm-install jsPDF or pdfmake and redo the layout in canvas coordinates. "Save as PDF" plus a print stylesheet gives a cleaner PDF with selectable text and no dependencies.
- No print stylesheet. Without
@media print, the form, buttons and background land on the paper. The print rule hides everything except the invoice. - Numbers and dates that reset. A hardcoded or random invoice number means two invoices with one ID. Keep a counter in localStorage and format the date explicitly, since locale strings differ between machines.
Why prompt 4 is in the plan
This goes to someone about to pay you, and the typo in your IBAN or the wrong tax rate usually turns up after you hit send. Prompt 4 connects your agent to my MCP server, which shares the live invoice. Send the link to a co-founder or bookkeeper first. They pin notes on the numbers from their phone without logging in, and your agent fixes what they flagged.