anucodes-01

Invoice Agent — Development skill for Claude Code

Development community

Invoice extraction tool: upload PDFs, scans or Excel files, and Claude pulls out structured fields.

How to install Invoice Agent

This entry records only its repository, not the path inside it, so there is no exact command to give. Open anucodes-01/invoice-agent and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Invoice Agent does

Invoice extraction tool: upload PDFs, scans or Excel files, and Claude pulls out structured fields. Validation, retries and arithmetic checks flag uncertain results for human review. Node/Express/TypeScript, Supabase Postgres, React/Tailwind.

Alternatives in Development

  • Learn From Materials — Turn PDFs, books and papers into interactive learning webpages|将复杂材料转化为可追溯、可测验、可做笔记的学习网页 225 ★
  • Ecpay Invoice — 串接綠界電子發票(B2C / B2B / 離線) 169 ★
  • Content OS — A self-improving daily content system — pulls from high-quality sources every morning and drafts posts in your 103 ★

README

Messy Invoice Extraction

Upload a vendor invoice (PDF, scanned PDF/image, or Excel) → Claude extracts structured fields → a human reviews and corrects anything the system flagged.

**Stack:** Node + Express + TypeScript · Postgres (Supabase) · Claude API · React + TypeScript + Tailwind (Vite).

Setup

# 1. Database: run server/schema.sql in the Supabase SQL editor (or any Postgres)
# 2. API
cd server && cp .env.example .env     # add ANTHROPIC_API_KEY and DATABASE_URL
npm install && npm run dev            # http://localhost:3001
# 3. Web
cd ../web && npm install && npm run dev  # http://localhost:5173 (proxies /api)
# Sample files: python3 samples/generate.py   |   Sample outputs: cd server && npm run samples

Architecture

React ──POST /api/invoices──▶ Express ──▶ saves file + row (status=processing) ──▶ 202 {id}
                                          └─ background: extract() ─▶ Claude ─▶ Zod validate ─▶ checks ─▶ DB
React polls GET /api/invoices every 1.5s while any row is processing
PUT /api/invoices/:id = human correction → status=reviewed
Endpoint Purpose
POST /api/invoices upload (multipart), starts extraction
GET /api/invoices / :id list / detail with line items, flags, confidence
GET /api/invoices/:id/file original file, for side-by-side checking
PUT /api/invoices/:id save human corrections

**Input handling.** PDFs and images go to Claude natively (no separate OCR step, so a scanned PDF takes the same path as a text PDF). Excel is flattened to CSV text per sheet; it never touches vision, which is cheaper and exact.

How unreliable model output is handled

  1. Strict schema (Zod). Output must parse as JSON and match the schema. Fences/prose around the JSON are stripped.
  2. Repair loop. On parse/validation failure the model is shown its own bad output plus the error and asked to fix it (max 3 attempts). If still invalid, the record is saved as failed with a flag and emp