Claude Code finance

Claude Code for Finance: How to Build and Edit Financial Models (2026)

Anthony Barbey

Anthony Barbey

· 10 min read

Share

Claude Code started as a tool for developers: an agent that lives in your terminal, reads your files, runs code and iterates on a project with you. A growing number of finance people have noticed that the same agent is unusually good at financial work. It reasons through a model, holds context across a long task, and edits real files instead of pasting snippets into a chat.

If you already use Claude on spreadsheets, Claude Code feels like a step up, and it is. But the wall that breaks chat plus Excel is still there, just further along. This guide covers where Claude Code helps with finance, where it breaks, what it should work on, and the four-step setup that makes the result defensible.


Why Are Finance People Using Claude Code?

Because it does the work instead of describing it. Most finance teams already use AI (AI in finance statistics). The first wave was chat: describe the business, get a model back. The second wave is agentic, and Claude Code is the clearest example.

What changes compared with a chat window:

  • It works on files, not messages. The work lives in a folder the agent reads and rewrites, not in a transcript you copy out of.
  • It holds a long task. Build the revenue lines, wire the cost structure, check the cash flow, without re-feeding context at every turn.
  • It runs code. It can compute, validate and test its own output instead of predicting digits.
  • It reads instructions from the folder. A CLAUDE.md file at the root is loaded at every session, so your rules apply without being repeated.

For a practitioner comfortable in a terminal, that is a real upgrade over juggling a chat and a workbook.


Where Does Claude Code Break on a Raw Spreadsheet?

On the 20% of the model that decides whether it is right. When Claude Code edits a raw Excel file, three failures come back.

It drifts. A spreadsheet stores results, not logic. "Revenue equals price times quantity" exists only as an arrangement of cells. When the agent rewrites cells for a new assumption, the dependency chain can break without any error. Independent benchmarks show the scale: the best model on FinSheet-Bench reaches 82.4% accuracy on financial spreadsheets, and around 20% on complex aggregation tasks (AI financial model risks). More on this in How to Build a Financial Model with AI That Doesn't Drift.

It forgets the logic. The files persist between sessions; the meaning does not. The structure, the conventions and the reasons behind each choice stay implicit in the cells, so each new session re-reads the grid and re-infers what the model means, slightly differently.

It burns tokens. A grid has no map. To change one thing reliably, the agent re-reads large parts of the file. On a real model, the context fills up and the loop slows down.

None of this is a prompt problem. The cause is structural: logic and data are fused in the same cells, and the agent works against a grid instead of a model.


What Should Claude Code Work On: a Spreadsheet or a Model?

A model whose logic is written down explicitly, separate from its data. That is the single change that makes Claude Code reliable on financial work.

In a spreadsheet, the model is implicit: you read the formulas cell by cell to understand it. In a structured model, the same logic is a set of named variables ("revenue", "headcount cost", "closing cash"), each with a formula, a timeline and explicit dependencies. The data (actuals, scenarios) sits alongside, not inside the logic. The idea is the one dbt brought to analytics: the transformation is code, the warehouse holds the data.

Three consequences matter for an agent:

PropertySpreadsheetStructured model
How the agent finds a lineScans cells, guesses the labelAddresses the variable by name
What happens on a changeRewritten cells, links may breakThe change propagates through the graph
What persists between sessionsValues and formulas, no intentStructure, conventions, history of changes

Two traps to avoid. Asking Claude Code to write the whole model as a Python script works for one analyst and fails the day someone else has to read it or the board wants a spreadsheet. And letting the agent compute figures itself, rather than an engine, brings back the arithmetic risk. The agent should edit the structure; an engine should compute the numbers.


How Do You Set Up Claude Code for Finance?

Four steps. The first two take ten minutes and help even if you stop there.

Step 1: write a CLAUDE.md with your finance rules

Claude Code reads CLAUDE.md at the start of every session. Put the rules that apply to every model in it, short:

# Finance rules
- Natural signs: revenue positive, costs and outflows negative.
- Never hardcode a value in a statement line: every line is a formula
  on an assumption or on imported actuals.
- Three statements that tie: net income feeds equity, closing cash
  equals cash on the balance sheet, a balance check equals 0.
- Before editing a model, read its FINANCE.md.
- Never report a figure you computed yourself: read it from the model.

Step 2: give each model a FINANCE.md

Conventions specific to one model (currency, units, fiscal year, EBITDA definition, glossary, how the statements are built) belong with that model, not in the session. FINANCE.md is an open standard for that file. Start with three lines (units, sign, fiscal year end) and add a definition each time a term gets misread.

Step 3: connect a model layer over MCP

MCP (Model Context Protocol) is how Claude Code calls external tools. Connected to a model layer, the agent works on named variables and a dependency graph instead of cells. With Layerz, one command adds the remote server, then /mcp in Claude Code opens the sign-in (OAuth, no key to paste):

claude mcp add --transport http layerz https://layerz.cc/mcp

From there, Claude Code can create a model, read its FINANCE.md, add assumptions and formulas, load actuals, build a scenario as a variant of the base case, and ask "what depends on this?" of the graph rather than scanning a sheet. Every change is versioned with a diff. Why a model layer matters in depth: Why Finance Agents Need a Model Layer.

Step 4: keep Excel as the export

Your board, your counterpart and your auditor open a standard .xlsx. Build in the structured layer, export to Excel on demand with formulas intact. The spreadsheet is the format on the way out, not the place the logic lives.


What Does a Session Look Like?

Naive version: open Claude Code on a folder with an Excel file, ask for a change, watch it edit cells, hit the context limit on a real file, and next week start a session that re-infers the structure from the grid.

Structured version:

  1. Claude Code loads CLAUDE.md, connects to the model, reads its FINANCE.md.
  2. You ask: "Raise the price assumption by 5% from Q2 and show me what moves."
  3. It edits one assumption; the change propagates; it lists the affected lines from the dependency graph.
  4. It runs the checks (balance sheet ties, closing cash matches) and reports them.
  5. You review the diff, keep or restore, export to Excel if the board needs a file.

Next week, a new session starts from the same model and its history, not from a re-reading of the grid. If you keep procedures and models in a repository, GitHub for Finance Teams shows how review and history carry over.


When Is Plain Claude Code Plus Excel Enough?

For one-shot work. "Read these ten values and write a summary", "explain what this formula does", "draft a sensitivity table on this file": Claude Code on a raw spreadsheet does it well, and you should use it.

The structured setup becomes necessary when four conditions meet: the agent modifies the model, it works across sessions, conventions must be honoured and not only formulas, and the output must be defensible to a board, an investor or a data room. For a budget, a deal model or unit economics you update every month, they usually all apply.


FAQ

Can Claude Code build a financial model? Yes. It can build the structure, write the formulas and check the result. The question is what it builds on: on a raw spreadsheet, it drifts on linked variables; on a model layer over MCP, it edits named variables and the engine computes.

Do I need to know how to code to use Claude Code for finance? No. You need to be comfortable in a terminal and to write instructions in plain English. The setup above has one command and two text files.

Is Claude Code better than Claude in Excel for financial modeling? They do different jobs. Claude in Excel helps inside a workbook you already have. Claude Code runs longer, multi-step tasks on files and tools. For a model updated every month, what matters more is where the model lives: in a grid, or on a structured layer either can reach.

What is the difference between Claude Code and Claude for finance work? Same model, different surface. The Claude app is a conversation with Projects and connectors; Claude Code is an agent that acts on a folder and runs code. Both connect to the same MCP servers. For a multi-client setup in the Claude app, see Claude for Fractional CFOs.

Does Claude Code keep my financial data? Claude Code sends to Anthropic what it reads in a session, under your plan's data terms. Keep credentials out of files it reads, and connect client data only where your engagement allows it (AI and Confidential Financial Data).


The Bottom Line

Claude Code is one of the best tools a finance person can use today: it reasons well, holds a long task and works on real files. On a raw spreadsheet it inherits the failure modes of any AI plus grid setup. The fix is structural: rules in a CLAUDE.md, conventions in a FINANCE.md, the model on a layer Claude Code edits over MCP, and Excel as the export. Then the agent stops slipping on the 20% that matters.

For the wider approach to AI-built models, start with The Right Way to Generate a Financial Model with AI. The same setup with OpenAI's agent is in Codex for Finance, and the multi-client version in Claude Code for Fractional CFOs.


Layerz is a structured spreadsheet, ready for AI. It holds the model so the agent does not have to: named variables and formulas separate from data, a FINANCE.md per model, every change versioned, clean Excel export anytime. Claude Code connects over MCP. Free for one person working alone, with unlimited models.

Anthony Barbey

Anthony Barbey · Founder, Layerz

Anthony spent his career in finance and consulting, close to the modeling workflows of M&A, transactions, and advisory. He now builds Layerz, the finance workspace that keeps Claude in the context of your model so it doesn’t drift, forget between sessions, or burn tokens on grids.

Related articles

Ready to build models that are defensible by design?

Layerz separates model structure from data so every number is traceable.

Explore Layerz