Build Your Underwriting Agent
50 properties. 10 seconds. Less than a dollar. Scored against your exact criteria.
The Playbook
Six steps. Your rules. < $1 per batch.
Every command. Every configuration. Every API key. Follow this and you'll have a working underwriting agent analyzing real deals by tonight.
Install Node.js and create the project
10 minYou need Node.js 18 or higher. Check your version by opening Terminal (Mac) or Command Prompt (Windows) and running:
node --versionIf you don't have it or it's below 18, install it from nodejs.org/download ↗. Download the LTS version. Run the installer. That's it.
Now create your project:
mkdir underwriting-agent
cd underwriting-agent
npm init -y
npm install @anthropic-ai/sdk pdf-parse csv-parse dotenv exceljsWhat each package does:
@anthropic-ai/sdk- Official Claude API client. Sends property data to Claude for analysis.pdf-parse- Reads PDF files (offering memorandums, appraisals, property reports). Uses the v2 API withPDFParseclass.csv-parse- Reads CSV files (rent rolls, financial exports from your PM software).exceljs- Reads Excel files (.xlsx, .xls). Actively maintained, zero security vulnerabilities.dotenv- Loads your API key from a .env file so it's not hardcoded.
xlsx (SheetJS) package — it has unpatched high-severity security vulnerabilities. Use exceljs instead.Get your Anthropic API key
5 minGo to console.anthropic.com ↗. Create an account if you don't have one.
Navigate to Settings → API Keys ↗. Click Create Key. Name it underwriting-agent. Copy the key.
In your project folder, create a file called .env:
ANTHROPIC_API_KEY=sk-ant-your-key-hereAdd credits to your account:
- Go to Settings → Billing ↗
- Add a payment method and load $5. This is enough for ~250-500 property analyses.
- Each analysis uses Claude Sonnet and costs about $0.01-0.02 per property.
.env to your .gitignore.Write your underwriting criteria document
30 minCreate a file called criteria.md in your project folder. This is the most important file. It's YOUR investment thesis in plain English. Claude will evaluate every property against this document.
Start with this template. Replace every bracketed value with your actual numbers:
# My Underwriting Criteria
## Deal Killers (auto-reject if any are true)
- Location outside: [City/State or list of zip codes]
- Property type not: [SFR / Multi 2-4 / Multi 5+ / Commercial]
- Asking price above: $[MAX PRICE]
- Environmental issues (Phase I required)
- Structural issues requiring > $[AMOUNT] to repair
- [Add your own deal killers]
## Scoring Criteria (0-10 each)
- Cap Rate: Target [X]%+
(10 = above target, 5 = at target, 0 = below [Y]%)
- Cash-on-Cash Return: Target [X]%+
- Occupancy Rate: Target [X]%+
(10 = 95%+, 5 = 85%, 0 = below 70%)
- Rent-to-Market Ratio: How far below market?
(10 = 20%+ below market, 5 = at market, 0 = above market)
- Neighborhood: A/B/C/D
(10 = A, 7 = B, 4 = C, 0 = D)
- Deferred Maintenance: Relative to purchase price
(10 = cosmetic only, 5 = moderate, 0 = major systems)
- Value-Add Potential: Can rents increase? Units added?
(10 = multiple value-add plays, 0 = fully optimized)
- Financing: Seller financing? Assumable loan?
(10 = seller financing available, 5 = conventional, 0 = hard money only)
## Scoring Weights
- Cap Rate: 20%
- Cash-on-Cash: 15%
- Occupancy: 15%
- Rent Upside: 15%
- Neighborhood: 10%
- Maintenance: 10%
- Value-Add: 10%
- Financing: 5%
## Red Flags (flag but don't auto-reject)
- Property taxes increased > 20% in last 2 years
- Insurance claims history
- Vacancy above 30%
- Negative cash flow at current rents
- Seller owned less than 2 years
- Flood zone or environmental concerns nearby
## Output I Want
For each property:
1. PASS / FAIL / REVIEW
2. Score 0-100 (weighted)
3. Top 3 strengths
4. Top 3 risks
5. Red flags found
6. Estimated rehab cost range
7. Projected Year 1 NOI
8. BUY / PASS / NEEDS_MORE_INFOTips for writing great criteria:
- Be specific with numbers. "Good cap rate" means nothing. "Cap rate above 7%" is a rule the agent can enforce.
- Include your ACTUAL deal killers. Think about the last deal you passed on. Why? Put that reason in the document.
- Weight what matters most to YOU. If cash flow is king and appreciation is a bonus, weight accordingly.
- This document is living. After your first batch analysis, you'll want to refine it. That's expected.
Organize your property files
15 minCreate a folder called properties in your project. Drop your property reports into it.
underwriting-agent/
.env
criteria.md
analyze.js (will be created by Claude Code)
properties/
123-main-st.pdf (offering memorandum)
456-oak-ave.csv (rent roll export)
789-elm.xlsx (broker's pro forma)
deal-pipeline.csv (multiple properties in one file)Supported file types:
- PDF - Offering memorandums, appraisals, broker packages, inspection reports. The agent extracts all text and analyzes it.
- CSV - Rent rolls, financial exports, property lists. Each row can be a unit or a property.
- Excel (.xlsx) - Pro formas, broker spreadsheets, financial models. The agent reads all sheets.
- Text (.txt) - Plain text property descriptions, MLS exports, notes.
How to get property reports:
- LoopNet: loopnet.com ↗ - Download offering memorandums directly from listings.
- Crexi: crexi.com ↗ - Commercial listings with downloadable packages.
- Your broker: Ask for the full due diligence package in PDF format.
- Your PM software: Export rent rolls as CSV from AppFolio (appfolio.com ↗), Buildium (buildium.com ↗), or RentManager.
- County records: Pull tax records, sales history, and zoning from your county assessor's website.
Generate and run the analysis script
20 minScroll down to unlock the full prompt below. Then follow these three steps:
- Step A: Open claude.ai ↗ (free tier works) or install Claude Code ↗ in your terminal.
- Step B: Copy the entire prompt from the section below this walkthrough. Paste it into Claude. Hit enter.
- Step C: Claude will generate a complete
analyze.jsfile. Copy that file into yourunderwriting-agent/folder.
cd into your project folder first. Claude Code will create the file directly — no copy-paste needed.What the generated script does:
- Reads every file in your
properties/folder - Extracts text from PDFs (using
PDFParsev2), parses CSVs, and reads Excel files withexceljs - Sends each property's data to Claude Sonnet with your criteria
- Processes up to 5 properties simultaneously (parallel, with rate limiting)
- Returns a JSON analysis for each: score, strengths, risks, red flags, recommendation
- Outputs
results.json(full data) andsummary.csv(ranked spreadsheet) - Prints a ranked summary to your terminal
Running it:
# Analyze all properties in the folder
node analyze.js ./properties/
# Output will look like:
# ✓ Analyzed 47 properties in 12.3 seconds
# Cost: $0.72
#
# RECOMMENDED (8):
# 1. 123 Main St — Score: 91 — BUY
# 2. 456 Oak Ave — Score: 87 — BUY
# ...
#
# REVIEW (12):
# 9. 789 Elm St — Score: 68 — NEEDS_MORE_INFO
# ...
#
# PASS (27):
# 21. 101 Pine Rd — Score: 34 — PASS
# ...
#
# Results saved to results.json and summary.csvOpen summary.csv in Excel or Google Sheets to see your ranked pipeline with all scores, flags, and recommendations in a sortable table.
Refine your criteria and build a weekly workflow
OngoingAfter your first batch, review the results critically:
- Check the top 5 scored properties: Do you agree with the ranking? Would you actually pursue #1? If not, adjust your scoring weights.
- Check the "PASS" properties: Did it reject anything you'd actually want? If so, your deal killers might be too strict.
- Check for "NEEDS_MORE_INFO": These are properties where the agent couldn't find enough data. You either need better source documents or need to tell the agent what to assume when data is missing.
- Check red flags: Is the agent catching things you'd catch? Missing things you'd catch? Update the red flags section in criteria.md.
Build your weekly analysis routine:
- Every Monday: download new listings from LoopNet/Crexi/your broker into the
properties/folder - Run
node analyze.js ./properties/ - Open the summary CSV. Focus only on BUY and REVIEW properties.
- Make offers on the top-scored properties. You've already done the initial underwriting.
- Time spent: 10 minutes. Properties analyzed: 50+. Cost: less than a dollar.
Advanced: automate the pipeline
Done For You
Get the complete Underwriting Agent prompt
Drop your info to unlock the full Claude Code prompt. Ready to copy and paste.
Choose wisely. One playbook per person.