Overview
Have Claude Code build a small Python pipeline that sends each saved property-offer email to claude -p with a JSON schema, collects the fields in a CSV and scores every deal with a formula you write and control.
Problem or Objective
- Which agents clean, chart and explain a dataset you provide?
- Which agents sort email, draft replies and clear the backlog for you?
More in Finance and Admin
AI Agents and Models
Tools and Integrations
- Tools
- Claude Code · Python
- Prerequisites
- Claude Code (most surfaces require a Claude subscription or Anthropic Console account), Python, and the offer emails exported from your mail client as files.
How It Works
Save the offer emails you receive from agents or wholesalers as text or .eml files in one folder; check how your mail client exports messages, since that side is not covered here. Write down the fields you need, such as address, asking price, rent, costs and condition, and your scoring rule, for example gross yield and monthly cash flow after a fixed allowance for repairs. Ask Claude Code to write a Python script that runs claude -p on each file with --output-format json and a JSON schema for those fields, stores the result in a CSV and leaves a field empty with a reason when the email does not state it. Ask it to put the scoring formula in its own small function with tests that you read. Run it, open the CSV, check a sample of rows against the original emails, and decide yourself which deals to follow up.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up Claude Code.
- Connect the toolsConnect the tools this workflow relies on: Claude Code, Python.
- Check the prerequisitesClaude Code (most surfaces require a Claude subscription or Anthropic Console account), Python, and the offer emails exported from your mail client as files.
- Gather your detailsCollect what the prompt asks for: Folder of saved offer emails, Fields to extract, Output file, Your scoring formula.
- Run the starter promptPaste the starter prompt below into Claude Code and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at code.claude.com before you rely on it.
Practical Starter Prompt: Build the deal extraction script
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
Write a Python script that reads every email file in [Folder of saved offer emails] and runs claude -p on each with --output-format json and a JSON schema for these fields: [Fields to extract]. If an email does not state a field, leave it empty and record why. Write the results to [Output file]. Put my scoring rule in its own function with unit tests: [Your scoring formula]. Show me the schema and the tests before running anything, and ask me before any command that touches files outside this folder.Review the schema and the scoring tests before the first run, approve commands when Claude Code asks, and check sample rows against the original emails before acting on any score.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. Anthropic documents running Claude Code non-interactively with the -p flag and getting output that conforms to a JSON Schema with --output-format json and --json-schema. The pages say nothing about property, so extraction quality depends on how complete each email is, and the scores are only as sound as the formula you write.
Limitations and Considerations
This is not financial advice; a person decides, and every figure should be checked against the listing or the seller before you make an offer. Empty fields should stay empty rather than be guessed. In a -p run there is no trust dialog, so allow only the tools the script needs with --allowedTools. Emails can contain personal details of sellers and agents; keep the folder private. Each extraction call uses your Claude Code usage. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Related Videos
About anthropics/claude-code
The SECRET Claude Code Upgrade That Has Everyone Going Nuts (Full Guide) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)About anthropics/claude-code
The only Claude Code guide you'll ever need (Opus 4.5) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- Run Claude Code programmatically - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 26 Nov 2026, 17:27 UTC
What this source supports
- Add the -p (or --print) flag to any claude command to run it non-interactively.
- To get output conforming to a specific schema, use --output-format json with --json-schema and a JSON Schema definition.
- A -p session shows no workspace trust dialog, and shell commands and network requests beyond the read-only set still need an --allowedTools entry or a permissions rule.
- Overview - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 25 Nov 2026, 11:57 UTC
What this source supports
- Claude Code is an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools.
- Most Claude Code surfaces require a Claude subscription or Anthropic Console account.

