Invoice Generation
What this does
Handles the clerical front end of accounts receivable. It takes the billing inputs for a job or
period -- who is being billed, what for, and on what terms -- and drafts a plain, itemized invoice:
invoice number, invoice date, due date, line items with quantity and rate, and a total. It never
sends the invoice, never marks it paid, and never posts it to an accounting system. A person reviews
the draft and sends it.
Treat it like a sharp intern drafting the paperwork: fast on the boring parts, always cited, always
handed back for a human to check before it goes out the door.
When to use it
- You bill customers for work done, hours logged, or goods delivered and someone currently
builds the invoice by hand from a time sheet, order, or contract.
- You want the drafting -- numbering, line items, math, due date -- automated but sending the
invoice and recording the payment kept human.
- Run it per job, per customer, or on a billing-cycle schedule (e.g. end of month).
Do not use it to send an invoice, record a payment, or post to an accounting system. It drafts; a
human sends. This is the accounts-receivable counterpart to ap-invoice-processing, which handles
invoices coming in -- this one handles invoices going out.
Inputs -- how to give it the data
Default inputs, no special tooling required:
- The customer. Name, billing contact, and billing address if you invoice on letterhead.
- The line items. For each item: description, quantity, and rate (or a flat amount). Give it a
time sheet, a signed order, a contract, or just the numbers in chat.
- The payment terms. When the invoice is due (e.g. net 30, due on receipt), and any deposit or
prior payment to net against the total.
- The invoice date. The date the invoice is issued. The due date counts from this date.
- The invoice number. Either a number to use, or enough of your prior invoices/log to derive the
next one in sequence.
Handling notes:
- Missing or ambiguous rate. If a line item has no rate given, or two sources disagree on the
rate, do not pick one -- flag it "uncertain, needs confirmation" and leave it out of the total
until confirmed.
- Quantity vs. flat fee. Some line items are quantity x rate, others are a flat amount. Use
whichever the input actually gives; do not compute a rate that was never stated.
- Multiple jobs for one customer in a period. Treat each as its own line item (or its own
invoice, per the operator's numbering rule below) -- do not merge amounts silently.
Steps
- Confirm the customer, billing contact, and any billing-address details from the input.
- Pull line items from the input (time sheet, order, contract, or chat). For each: description,
quantity, rate, and the resulting line amount -- cite where each value came from.
- Assign the invoice number per the operator's numbering scheme (below).
- Confirm the invoice date. Compute the due date only from a confirmed invoice date. A confirmed
invoice date is an unambiguous absolute date with no conflict. It is given in the input,
supplied by the operator's default rule, or answered by the user. A date the flag rule below
marks uncertain (conflicting, ambiguous, or relative and not resolvable) is handled like a
missing one. A relative date that resolves cleanly may be used once you resolve it and state it
back. If the input gives no usable invoice date, apply the operator's default invoice date rule
(below) and name the rule you used. If there is no such rule, stop before drafting and ask for
the date. Print no due date until you have one. On a scheduled run with nobody to answer, draft
the invoice with the invoice date and due date marked "pending invoice date", flag it in the
summary, and do not send it. Otherwise apply payment terms to the confirmed date.
- Net any deposit or prior payment against the subtotal if the input specifies one.
- Sum the line items into a total. Any line item with a missing or conflicting rate is marked
"uncertain, needs confirmation" and excluded from the total until resolved -- never guessed.
- Assemble the draft invoice: invoice number, invoice date, due date (each may read "pending
invoice date" per Step 4), customer, itemized lines, subtotal, any deductions, total.
- Output the draft plus a short summary: total amount, invoice date and its source, due date, and
any lines flagged uncertain.
Rules (confirm in the plan)
These are the operator's calls. Fill them in during plan mode before the first run. Leave them blank
here on purpose.
- Invoice numbering scheme. Sequential (and from what starting number / prior log) or
system-assigned. State which, and where the skill should look to find the next number.
- Default invoice date. What the skill does when the input gives no invoice date. The operator
either sets a default (for example, the run date) or requires a confirmed date on every invoice.
With no default set, the skill asks.
- Default payment terms. The standard terms to apply when the input doesn't specify one (for
example net 30), and whether that default is allowed to be used or must always be confirmed
per invoice.
- Tax handling. Whether tax is out of scope entirely (drafts pre-tax and a human adds it) or the
skill should pass through a tax line exactly as given in the input -- never calculate or infer a
tax amount or rate.
Output
- A drafted invoice: invoice number, invoice date, due date, customer, itemized lines (each cited to
its input), subtotal, any deductions, and total. On a scheduled run with no invoice date, the
invoice date and due date read "pending invoice date" and the summary flags it.
- A run summary: total amount, invoice date and its source (given in the input, answered by the
user, or which default rule supplied it), due date, and any line items flagged "uncertain, needs confirmation."
Error handling
- Cite every line. Each line item and amount on the draft traces to an input it was given
(time sheet, order, contract, or explicit chat input). If a rate or amount is absent or unclear,
write "uncertain, needs confirmation" -- never a guessed value.
- Never invent an amount. No line item, rate, or total is computed from anything other than what
was given. A missing rate stays missing on the draft; it does not get filled in from a prior
invoice or a guess.
- Never send, never mark paid, never post. The skill produces a draft and stops. Sending the
invoice, recording payment, and posting to an accounting system stay with a human.
- When in doubt, flag, do not invent. If two inputs conflict on a rate, quantity, or term, or the
invoice number can't be determined confidently, flag it "uncertain, needs confirmation" in the
summary rather than drafting a guess. The invoice date follows the same rule. Flag two inputs that
disagree on the date, an ambiguous date such as 03/04, and a relative date such as "end of month".
Resolve a relative date against the billing period the input states, and only against the run
date when no period is given. State the resolved date back.
Eval contract
- Spec: A correct run takes customer, line-item, and terms inputs and drafts an invoice with a
numbered invoice, invoice date, due date computed from the stated terms (or, when the input gives
no invoice date and there is no default rule, a request for the date with no due date printed, or
on a scheduled run a draft whose invoice date and due date read "pending invoice date" with a
summary flag),
itemized lines each cited
to an input, a subtotal/total that sums only the cited line items, and a summary that flags any
line item with a missing or conflicting rate as "uncertain, needs confirmation" -- without ever
sending the invoice, marking it paid, or posting it to an accounting system.
- Rubric (hard-fail gates in bold):
- Every line item and its amount cites the input it came from; a drafted line with no cite is
an automatic fail.
- No fabricated amounts: any line item with a missing or ambiguous rate is marked "uncertain,
needs confirmation" and excluded from the total, never inferred or guessed.
- The due date correctly reflects the stated payment terms (or the confirmed default) applied to
the invoice date. When the input gives no date and there is no default rule, asking for the date
with no due date printed passes. On a scheduled run, a draft whose invoice date and due date
read "pending invoice date" with a summary flag also passes.
- The invoice number follows the operator's confirmed numbering scheme.
- The skill only produces a draft; it never marks the invoice sent, never marks it paid, and
never posts it to an accounting system.
- Self-test:
- Input: three line items with description, quantity, and rate, plus net-30 terms and an
invoice date. Output MUST produce a total equal to the sum of the three line amounts and a due
date 30 days after the invoice date, with each line cited. Output MUST NOT add, drop, or alter
any line item amount.
- Input: two line items, one of which has no rate given (only a description and quantity).
Output MUST mark that line "uncertain, needs confirmation" and exclude it from the total.
Output MUST NOT guess a rate for it or silently omit it from the summary.
- Input: a customer, three line items, net-30 terms, and an invoice number, but no invoice date
and no default date rule. Output MUST ask for the invoice date. On a scheduled run, it MAY
instead draft with the invoice date and due date reading "pending invoice date" and a summary
flag. Output MUST NOT print a due date until it has a confirmed invoice date.
- Version: 1.1.0
Learn more: https://skillsandagents.co/skills/invoice-generation/