AI Tutorial

Build a Skill-Driven Financial Analysis Agent with Claude and Python

A step-by-step walkthrough of building a skill-driven financial analysis agent using Claude, Python, MCP connectors, and Anthropic's financial-services repo.

LUMIEN5 min read
Build a Skill-Driven Financial Analysis Agent with Claude and Python

A new tutorial from Marktechpost walks through building a financial analysis agent that mirrors the skill-driven architecture inside Anthropic's public financial-services repository. Using Python, the claude-sonnet-4-6 model, and MCP (Model Context Protocol) connectors for external data, the workflow runs a synthetic DCF valuation, builds a WACC sensitivity heatmap, exports comparable-company analysis to Excel, and drafts a private-equity investment committee memo, all without a live deployment.

What happened

Detail Value
Source repo github.com/anthropics/financial-services
Model used claude-sonnet-4-6
Key libraries anthropic, pandas, openpyxl, pyyaml, matplotlib
Skill files parsed SKILL.md files across agent, vertical, and partner plugin directories
Output formats Excel (.xlsx), heatmap image, plain-text memo, JSON spec

The tutorial starts by cloning Anthropic’s financial-services repo with a single git clone --depth 1 command, then walking its directory tree to count agents, vertical plugins, partner integrations, and managed-agent cookbooks. A small repo_map() function outputs a DataFrame showing how many SKILL.md files and command Markdown files each plugin contains.

MCP connector config files (.mcp.json) found inside the plugins directory are also inspected. These files define external financial data server endpoints that the agent can call at runtime, effectively turning third-party data feeds into tool calls the model can invoke.

How the SkillAgent works

Each SKILL.md file contains a YAML frontmatter block with a name and description, followed by a methodology body. A Skill class strips the frontmatter, stores the body, and exposes a short description (capped at 300 characters). A SkillRegistry class indexes every unique skill by name and supports fuzzy keyword search so you can pull the right playbook with registry.get("dcf") or similar queries.

The SkillAgent takes one or more skill names, fetches their methodology text from the registry, and prepends it as a system-level context block when calling the Anthropic Messages API. The model then sees both the task instruction and the relevant financial playbook before it responds.

Two tools are available inside the agent’s loop:

  • run_python: executes arbitrary Python in a persistent namespace (pandas and numpy pre-imported) and returns stdout.
  • save_file: writes any string content to the outputs/ directory under a given filename.

The agent loops until the model stops requesting tool calls, then returns the final text response. This is a standard agentic tool-use pattern, but wiring it to skill-specific system prompts is what makes outputs stay on-format for financial work.

What the agent actually produces

The tutorial runs five concrete tasks to demonstrate the architecture:

  1. DCF valuation: a synthetic discounted cash flow model with free cash flow projections, discount rate, and terminal value calculated in Python and printed as a table.
  2. WACC sensitivity heatmap: a matplotlib-generated grid showing enterprise value across combinations of WACC and terminal growth rate, saved as an image file.
  3. Comparable-company analysis: a comp table with EV/EBITDA and P/E multiples exported to a formatted Excel file via openpyxl.
  4. PE investment committee memo: a structured memo draft saved as a plain-text file, following a private-equity deal-review format drawn from the relevant skill.
  5. Managed-agent deployment spec: the agent reads and displays a deployment specification JSON without triggering an actual deployment, useful for reviewing config before going live.

Why it matters

Most LLM-based financial tools dump all context into one giant prompt and hope the model stays on format. The skill-registry approach separates methodology from task instruction. You maintain a library of vetted playbooks, inject only what a given task needs, and swap skills without rewriting prompts. That is a more maintainable pattern for any domain-specific agent, not just finance.

MCP connectors are worth watching here too. The protocol (developed by Anthropic) lets an agent attach live data sources as named tools at runtime. The financial-services repo already defines connector configs for external feeds. As more data providers publish MCP server endpoints, this pattern will become the standard way to give agents fresh market or CRM data without hard-coding API calls. If you are building AI integrations for clients, understanding MCP now puts you ahead of the curve.

For context on how agentic systems can also create security exposure, see our earlier piece on Microsoft’s AI security tooling response after the OpenAI Hugging Face incident.

Our take

The architecture is genuinely clean. Parsing SKILL.md files into a registry is a low-tech solution that scales well: add a new playbook by dropping a Markdown file, no code changes needed. The tool-use loop is minimal and readable, which matters when you are debugging why an agent produced a wrong terminal value at 2 a.m.

The rough edges are real though. Persistent Python namespaces across tool calls can produce silent state bugs that are hard to trace. The tutorial does not cover error recovery when the model calls run_python with broken code. For a production deployment, you would want sandboxed execution and a retry budget. The tutorial is honest about being a synthetic demo, which is the right framing.

If you want to adapt this for client work, the Excel and memo outputs are the most immediately useful parts. A financial services client already expects those formats. The heatmap is a nice addition for board presentations, and generating it programmatically from model-driven inputs rather than a static spreadsheet is a genuine workflow improvement.

What to do about it

  1. Clone the Anthropic financial-services repo and run repo_map() to understand what skills and plugins are already available before writing any custom ones.
  2. Install the five required libraries: anthropic, pandas, openpyxl, pyyaml, and matplotlib.
  3. Build your own SkillRegistry pointing at a folder of domain-specific Markdown playbooks relevant to your business or clients.
  4. Wire the save_file tool to a cloud bucket or SharePoint path instead of a local outputs/ folder for team-accessible deliverables.
  5. Review the MCP connector config files in the repo and identify which external data sources match your use case before committing to a deployment architecture.

If you are not sure where this fits in your stack, our AI integration service covers agent architecture from prototype to production. You can also talk to the team about scoping a domain-specific agent for your workflows.

Source: Marktechpost

Frequently asked questions

What is a skill-driven AI agent?

A skill-driven agent uses a library of domain-specific methodology documents (here, SKILL.md files) injected as system context into an LLM call. Each task only receives the relevant playbook, keeping prompts focused and outputs on-format without hard-coding instructions.

What is MCP and why does it matter for financial agents?

MCP (Model Context Protocol) is a standard developed by Anthropic that lets an agent attach external data sources as callable tools at runtime. The financial-services repo includes .mcp.json config files that define external financial data server endpoints the agent can use without hard-coded API calls.

Which Claude model is used in this financial analysis tutorial?

The tutorial uses claude-sonnet-4-6, called via the official Anthropic Python SDK.

What file outputs does the financial agent generate?

The agent produces a formatted Excel file for comparable-company analysis, a matplotlib heatmap image for WACC sensitivity, a plain-text investment committee memo, and can inspect managed-agent deployment specification JSON files.

More from AI