Real Agent Cases

Sort and rename messy invoices for taxes with Claude Code

Posted
by Martin Merschroth (via Lenny's Newsletter)
Last checked
Method:
How we verify

Evidence: Article or interviewA newsletter, journalist or interview account of what happened.

Outcome

Claude Code reads each file in a messy invoice folder, renames it to 'YYYY-MM-DD Vendor - Invoice - ProductOrService.pdf' and files it in the right folder.

Agent

Claude Code

Prompt Recreated prompt

The source didn't share its exact prompt, so we wrote this from what it describes.

Here's a task I'd like your help with. Read it all the way through before you start.

Goal: Sort my messy invoice folder: rename each file clearly and move it into the right folder.

Check with me first: Which folder holds the invoices, and how do I want them grouped?

What I'll give you:
- The folder of invoices
- My folder structure (for example by year or vendor)

Rules:
- Read each file and rename it as 'YYYY-MM-DD Vendor - Invoice - ProductOrService.pdf'.
- Move each invoice into the right folder.
- If something is missing or unclear, ask me instead of guessing.
- Don't delete anything. Show me a few examples before doing the whole folder.

Output: A tidy, renamed folder plus a list of files you weren't sure about.

You'll know it worked when: every invoice has a clear name and sits in the right folder for tax time.

Try this in:

Sends the Recreated prompt shown above. ChatGPT and Grok open with it filled in, and ChatGPT may send it straight away. Gemini opens empty, so we copy the prompt for you to paste. Every button also copies it.

The source used Claude Code, which can take actions on your computer or in a browser. These are general chat tools, so results may differ, and a normal chat may only give you a plan.

Opens in a new tab. We don't see what you send.

These links are only a shortcut. We're not affiliated with OpenAI, Google or xAI, and your results may not match the source.

Optional stronger version

Our rewrite with extra checks. The poster didn't test it.

Here's a task I'd like your help with. Read it all the way through before you start.

Goal: Sort and rename my invoice files for taxes.

Quick check first: tell me if anything below is missing or unclear.

Inputs (fill in or confirm):
- Invoice folder
- Folder structure
- Naming format
- Tax year and whether I need personal vs business split

Rules:
- Read each invoice for date, vendor, amount.
- Rename each file in the naming format I give you, e.g. 'YYYY-MM-DD Vendor - Invoice - ProductOrService.pdf'.
- Move into the structure.
- Log changes.
- Use the invoice date, not the file's modified date.
- Keep the original file extension and never edit file contents.
- Flag duplicates (same vendor, date and amount) instead of deleting them.
- Write a CSV summary per year: vendor, date, amount, currency, new file path.

Checkpoint: Show the plan before moving.

If you get stuck: If unreadable, put in 'check'. If a login, CAPTCHA or two-step code appears, stop and ask me to handle it; never guess or store passwords.

Verify before you finish: Count files before and after. Check the CSV totals against a few invoices by hand.

Output: Rename log.

Done when: every invoice is renamed and filed.

Source

https://www.lennysnewsletter.com/p/everyone-should-be-using-claude-code

  • After the poster scanned almost 200 invoices, Claude Cowork split them out, renamed them, sorted them into folders and created a summary Excel file.

    Claude Cowork · Ops · Source date:

  • The poster says matching a spreadsheet of items for their accountant against a folder of receipts usually took 4–6 hours, and that with Claude Cowork it took about an hour.

    Poster says:4–6 hour job done in about an hour

    Claude Cowork · Ops · Source date:

  • Prepare an Indian income tax return (ITR-3) with Claude CodeRecreated promptEvidence: Described by poster

    Given tax documents and a year of bank statements, Claude Code reconciled the figures against the poster's AIS (annual information statement), caught 2 mistakes that could have triggered notices, and computed the tax; the poster then filed.

    Poster says:2 mistakes caught

    Claude Code · Ops · Source date: