← work / index
Ø04

SKL Invoicing and Tax Agent

Construction invoicing that knows CIS and VAT, with an AI assistant grounded in HMRC guidance and forbidden to guess.

Ø1 Problem

Construction invoicing has rules that trip up generic tools. CIS deductions apply to labour but not materials. VAT can be zero, reduced, standard or a reverse charge depending on the job and the client. Every client wants a different breakdown. SKL, a small building firm, were spending evenings wrestling with it and phoning their accountant with the same questions.

Ø2 Solution

An invoicing app that knows the trade, with an AI layer added twice. The first pass let them create an invoice by describing the job in plain English, with a voice mode for use on site. The model gathers the client, whether CIS applies, what the work was and what it cost, and only creates the invoice when the ordinary validated business logic is satisfied. The second pass is the Tax Agent: a chat assistant that answers questions like "my customer is asking for 5% VAT, is that right?" using retrieval-augmented generation over a knowledge base built from HMRC's VAT and CIS guidance, the firm's own invoices, and its own past answers. The system prompt is blunt: answer only from the context, never invent a rate or a threshold, and say so when the context does not cover it.

Ø3 Delivery

PHP on Laravel with Blade and no front-end build step, so the firm can keep it running for years. Claude answers, Voyage embeds, and there is no vector database: embeddings live in ordinary database columns and cosine similarity is 33 lines of PHP. Before anything leaves the server, the company's name and every client name are scrubbed from the question, the history and the context. Every answer cites its sources and carries the line "guidance only, not formal tax advice". Invoices, credit notes and CSV exports come out of the same app.

Notes from the build

  • Privacy before the API call: business and client names are replaced with placeholders in everything transmitted. Storage and search use the originals.
  • Retrieval gated on intent. Invoice data is only pulled in when the question is about the firm's own jobs, which keeps client data out of prompts that do not need it.
  • Conversation memory as a fourth retrieval source: each exchange is embedded question and answer together, so later questions can find it.
  • Financial correctness over AI: stored totals are authoritative, exchange rates freeze at issue date, finalised documents are corrected by reversal, never by editing history.
  • 126 tests. The same engine now runs, config-driven, as the invoicing system for Hebble & Stone.
mattbedford.dev/skl-invoicing
The TaxBot panel open beside an invoice form, with the note 'Guidance only, not formal tax advice'
mattbedford.dev/skl-invoicing
The export screen: invoices and credit notes to CSV, by date range, with every column selectable
mattbedford.dev/skl-invoicing
On a phone: asking the TaxBot whether a customer's request for 5% VAT is correct
mattbedford.dev/skl-invoicing
The answer: 5% is only correct in specific situations, with the cases listed and a nudge to check
mattbedford.dev/skl-invoicing
A question outside the knowledge base: the assistant says so, gives the general rule, and points to the accountant