Financial Analysis Skill

Analyze business financials from a QuickBooks CSV export.

by hewi333·MIT license·★ 122 Stars on the repo·GitHub ↗

Use now

Inside this skill

SKILL.md · the author's own words
# Financial Analysis Skill

## Overview
Takes a QuickBooks CSV export (Profit & Loss, Transaction List, or Sales by Item)
and produces a plain-English financial analysis for a non-technical business owner.
The agent identifies cost categories, flags problem areas, and suggests specific
actions — all delivered in Telegram as a readable summary, not a spreadsheet.

**Two modes:**
1. **CSV import** (works now) — owner exports from QuickBooks, sends to agent
2. **QuickBooks API** (optional) — agent pulls financials directly (requires
   `quickbooks-online` skill to be wired with OAuth tokens)

## When to Use
- "Analyze my QuickBooks export" (after sending a CSV)
- "Where am I losing money?"

Word-for-word excerpt, not a result. Read the full SKILL.md ↓

Files of Financial Analysis Skill

hewi333/main1 file shown
SKILL.md
Show the full text302 lines

Financial Analysis Skill

Overview

Takes a QuickBooks CSV export (Profit & Loss, Transaction List, or Sales by Item) and produces a plain-English financial analysis for a non-technical business owner. The agent identifies cost categories, flags problem areas, and suggests specific actions — all delivered in Telegram as a readable summary, not a spreadsheet.

Two modes:

  1. CSV import (works now) — owner exports from QuickBooks, sends to agent
  2. QuickBooks API (optional) — agent pulls financials directly (requires quickbooks-online skill to be wired with OAuth tokens)

When to Use

  • "Analyze my QuickBooks export" (after sending a CSV)
  • "Where am I losing money?"
  • "Which jobs had the worst margins last quarter?"
  • "What are my biggest cost categories?"
  • "Give me a financial summary for the owner meeting"
  • Monthly/quarterly financial review

Prerequisites

CSV Mode (current)
  • CSV file exported from QuickBooks Online or QuickBooks Desktop
  • File placed on the VPS (or content pasted — see formats below)
QuickBooks API Mode (optional, post-hackathon)
  • quickbooks-online skill installed + OAuth tokens wired
  • Not required for CSV mode

Supported CSV Formats

Format 1: Profit & Loss (Standard QuickBooks Export)
Date,Transaction Type,Num,Name,Memo/Description,Account,Income,Expense
2026-01-15,Invoice,101,Smith Residence,Odor removal service,Service Income,2800,
2026-01-18,Bill,,Home Depot,Chemicals,COGS - Chemicals,,150
Format 2: Transaction List (All Transactions)
Date,Transaction Type,Num,Name,Split,Amount,Status
2026-01-15,Invoice,101,Smith Residence,Service Income,2800,Cleared
2026-01-18,Bill,,Home Depot,COGS - Chemicals,-150,Cleared
Format 3: Sales by Item/Job
Item/Job,Qty,Amount,COGS,Margin,Margin %
Odor Removal - Residential,1,2800,350,2450,87.5%
Odor Removal - Commercial,2,4500,800,3700,82.2%

The agent auto-detects the format by reading the header row and matching column names. If columns are ambiguous, the agent asks the owner to clarify.

The Flow

Step 1: Owner Sends CSV

Owner sends file to agent (via Telegram document upload or places on VPS). Agent confirms receipt and reads the file.

Step 2: Agent Parses + Categorizes
import csv
import json
from collections import defaultdict

def analyze_csv(filepath):
    with open(filepath, 'r') as f:
        reader = csv.DictReader(f)
        rows = list(reader)

    # Auto-detect format from headers
    headers = set(rows[0].keys())

    if 'Income' in headers or 'Expense' in headers:
        return analyze_pnl(rows)
    elif 'Amount' in headers:
        return analyze_transactions(rows)
    elif 'COGS' in headers or 'Margin' in headers:
        return analyze_sales_by_job(rows)
    else:
        return {"error": "Unknown CSV format", "headers": list(headers)}
Step 3: Agent Runs Analysis
A. Revenue Summary
  • Total revenue (period)
  • Revenue by job/customer
  • Revenue by service type (if identifiable)
  • Month-over-month trend
  • Average job size
B. Cost Analysis
  • Total costs (period)
  • Cost categories (ranked by size):
    • COGS (chemicals, equipment, supplies)
    • Labor (subcontractors, wages)
    • Travel/fuel
    • Marketing
    • Software/subscriptions
    • Insurance
    • Other
  • Cost as % of revenue (overall)
  • Cost trend (increasing? decreasing?)
C. Job-Level Profitability
  • Each job with revenue, cost, and margin
  • Flag: jobs with margin < 30% (or negative margin)
  • Flag: jobs where cost > revenue (loss-making)
  • Best performing job (highest margin)
  • Worst performing job (biggest loss or lowest margin)
D. Opportunity Analysis
  • Most profitable service type → "do more of these"
  • Least profitable → "consider raising prices or declining"
  • Customer concentration risk (if >X% from one source)
  • Seasonal patterns (which months are strongest)
  • Cost categories growing faster than revenue
Step 4: Agent Delivers Plain-English Report
📊 [BUSINESS_NAME] Financial Analysis — Jan-Jun 2026

TOTALS:
- Revenue: $48,200 across 22 jobs
- Costs: $14,800 (30.7% of revenue)
- Net profit: $33,400 (69.3% margin — healthy)

YOUR BIGGEST COST CATEGORIES:
1. Chemicals & Supplies: $4,200 (28% of costs)
2. Fuel/Travel: $3,100 (21% of costs)
3. Insurance: $2,400 (16% of costs)
4. Software/Subscriptions: $890 (6% of costs)

⚠️ JOBS THAT NEED ATTENTION:
- Job #1018 ([CITY], small apartment): Revenue $650,
  Costs $580 → Margin only 8.6%. This job cost almost
  as much as it made. Consider a minimum job size of
  $1,000 or raise the small-job rate.

💰 YOUR BEST JOBS:
- Job #1003 ([CITY], 3200 sqft residential): Revenue
  $3,800, Costs $290 → Margin 92.4%. Large residential
  jobs are your sweet spot.

📈 OPPORTUNITIES:
- Your [CITY]/[REGION] jobs average 88% margin vs
  72% in other regions. Consider targeting more [REGION]
  partners.
- Your commercial jobs average $4,500 vs $2,400 for
  residential. But you only did 3 commercial jobs vs 19
  residential. More commercial outreach could boost revenue.
- Fuel costs are 21% of total costs. Premium Region trips
  have higher fuel — the Premium Region
  surcharge should be reviewed to ensure it covers actual
  travel cost.

NEXT STEPS:
- Set a minimum job size? (Your smallest jobs have
  the worst margins)
- Raise the Premium Region travel surcharge?
- Target more commercial jobs?
- More marketing to [REGION] partners?

Want me to dig deeper into any of these?
Step 5: Owner Can Ask Follow-Ups
  • "Show me all jobs under $1,000"
  • "What's my average margin by region?"
  • "Break down the chemical costs month by month"
  • "Which months had the highest revenue?"
  • "Compare my margins last year vs this year"

QuickBooks API Integration (Optional, Post-Hackathon)

When quickbooks-online skill is wired with OAuth tokens, the agent can pull financials directly without CSV export:

# Pseudocode — requires quickbooks-online skill to be wired
from intuitlib.client import AuthClient

# Pull Profit & Loss report
pnl = quickbooks.get_report('ProfitAndLoss', start_date='2026-01-01',
                            end_date='2026-06-30')

# Pull Sales by Customer
sales = quickbooks.get_report('SalesByCustomer', start_date='2026-01-01',
                               end_date='2026-06-30')

# Run same analysis as CSV mode but from live data

Agent Integration Patterns

Pattern 1: Monthly Financial Review
Owner: "Analyze my June financials"
Agent: [reads CSV / pulls from QBO] → produces report → sends in Telegram
Owner: "Why were chemical costs so high in June?"
Agent: [drills into chemical line items] → "3 large commercial jobs in
       June required extra treatments — $1,200 of the $1,800 total"
Pattern 2: Job Profitability Audit
Agent: "I noticed 3 jobs last quarter had margins under 20% — want a
       breakdown?"
Owner: "Yes"
Agent: [lists jobs with revenue, costs, margin] → "All three were
       small apartments under 1,000 sqft. Your minimum job rate of
       $1,500 would have prevented two of these from being unprofitable."
Pattern 3: CRM Cross-Reference
Agent: "Your CRM shows 8 jobs booked from Standard Region partners this
       quarter, averaging $2,100 revenue. But your financials show
       Standard Region jobs average 72% margin vs 88% in Premium Region. Want me
       to draft a targeted Premium Region partner campaign?"
Pattern 4: Estimator Sanity Check
Agent: "Your financials show actual job costs averaging 30% of revenue.
       Your estimator-engine assumes 25% cost ratio. The gap is mostly
       fuel costs on Premium Region jobs. Want me to update the estimator
       to include a fuel surcharge for Premium Region?"

Common Pitfalls

  1. CSV format varies — QuickBooks Online, Desktop, and different report types all export differently. The agent must auto-detect and ask if unsure. Don't assume column names.
  2. Cost allocation — Some costs (insurance, software) aren't tied to specific jobs. The agent should separate direct job costs from overhead and be clear about the difference.
  3. Time periods — Always confirm the date range with the owner before analyzing. "This shows Jan-Jun 2026 — is that right?"
  4. Negative numbers — QuickBooks sometimes exports expenses as positive, sometimes as negative. The agent should detect the convention and normalize.
  5. Missing data — If COGS isn't broken out by job, the agent should say so rather than guessing. "Chemical costs are lumped — I can't tie them to specific jobs without more detail."
  6. Don't give financial advice. The agent identifies patterns and asks questions. The owner makes decisions. The agent is a tool, not a CPA.
  7. Privacy — Financial data stays on the VPS. Don't send raw numbers to external services. Summary in Telegram is fine; raw CSV is not.

Verification Checklist

  • Can read CSV file from disk
  • Auto-detects CSV format from headers
  • Parses income/expense transactions correctly
  • Identifies cost categories and ranks by size
  • Calculates job-level margins
  • Flags jobs with margin < 30%
  • Flags jobs where cost > revenue
  • [ | Produces plain-English summary in Telegram
  • Owner can ask follow-up questions
  • QuickBooks API integration (optional, post-hackathon)

One-Shot Recipes

"Quick financial health check"
# Reads CSV → returns: total revenue, total costs, margin %,
# top 3 cost categories, worst job, best job, 2-3 recommendations
"Cost breakdown by category"
# Groups all expenses by account/category → ranks by total →
# calculates each as % of revenue → flags any category growing
# faster than revenue
"Job profitability ranking"
# For each job: revenue, direct costs, margin, margin %
# Sorted by margin % ascending (worst first)
# Flags any job with margin < 30% or cost > revenue
1---
2name: financial-analysis
3description: "Analyze business financials from a QuickBooks CSV export. Identifies cost categories, drills down on areas to cut costs, flags low-margin jobs, and spots revenue opportunities. CSV import now, QuickBooks API wiring optional later. Designed for small business owners who don't read spreadsheets — agent translates the numbers into plain English."
4version: "1.0.0"
5author: Hermes Agent
6license: MIT
7metadata:
8 hermes:
9 tags: [finance, quickbooks, cost-analysis, revenue, csv, small-business]
10 related_skills: [quickbooks-online, crm-lite, estimator-engine]
11---
12 
13# Financial Analysis Skill
14 
15## Overview
16Takes a QuickBooks CSV export (Profit & Loss, Transaction List, or Sales by Item)
17and produces a plain-English financial analysis for a non-technical business owner.
18The agent identifies cost categories, flags problem areas, and suggests specific
19actions — all delivered in Telegram as a readable summary, not a spreadsheet.
20 
21**Two modes:**
221. **CSV import** (works now) — owner exports from QuickBooks, sends to agent
232. **QuickBooks API** (optional) — agent pulls financials directly (requires
24 `quickbooks-online` skill to be wired with OAuth tokens)
25 
26## When to Use
27- "Analyze my QuickBooks export" (after sending a CSV)
28- "Where am I losing money?"
29- "Which jobs had the worst margins last quarter?"
30- "What are my biggest cost categories?"
31- "Give me a financial summary for the owner meeting"
32- Monthly/quarterly financial review
33 
34## Prerequisites
35 
36### CSV Mode (current)
37- CSV file exported from QuickBooks Online or QuickBooks Desktop
38- File placed on the VPS (or content pasted — see formats below)
39 
40### QuickBooks API Mode (optional, post-hackathon)
41- `quickbooks-online` skill installed + OAuth tokens wired
42- Not required for CSV mode
43 
44## Supported CSV Formats
45 
46### Format 1: Profit & Loss (Standard QuickBooks Export)
47```csv
48Date,Transaction Type,Num,Name,Memo/Description,Account,Income,Expense
492026-01-15,Invoice,101,Smith Residence,Odor removal service,Service Income,2800,
502026-01-18,Bill,,Home Depot,Chemicals,COGS - Chemicals,,150
51```
52 
53### Format 2: Transaction List (All Transactions)
54```csv
55Date,Transaction Type,Num,Name,Split,Amount,Status
562026-01-15,Invoice,101,Smith Residence,Service Income,2800,Cleared
572026-01-18,Bill,,Home Depot,COGS - Chemicals,-150,Cleared
58```
59 
60### Format 3: Sales by Item/Job
61```csv
62Item/Job,Qty,Amount,COGS,Margin,Margin %
63Odor Removal - Residential,1,2800,350,2450,87.5%
64Odor Removal - Commercial,2,4500,800,3700,82.2%
65```
66 
67**The agent auto-detects the format** by reading the header row and matching
68column names. If columns are ambiguous, the agent asks the owner to clarify.
69 
70## The Flow
71 
72### Step 1: Owner Sends CSV
73Owner sends file to agent (via Telegram document upload or places on VPS).
74Agent confirms receipt and reads the file.
75 
76### Step 2: Agent Parses + Categorizes
77```python
78import csv
79import json
80from collections import defaultdict
81 
82def analyze_csv(filepath):
83 with open(filepath, 'r') as f:
84 reader = csv.DictReader(f)
85 rows = list(reader)
86 
87 # Auto-detect format from headers
88 headers = set(rows[0].keys())
89 
90 if 'Income' in headers or 'Expense' in headers:
91 return analyze_pnl(rows)
92 elif 'Amount' in headers:
93 return analyze_transactions(rows)
94 elif 'COGS' in headers or 'Margin' in headers:
95 return analyze_sales_by_job(rows)
96 else:
97 return {"error": "Unknown CSV format", "headers": list(headers)}
98```
99 
100### Step 3: Agent Runs Analysis
101 
102#### A. Revenue Summary
103- Total revenue (period)
104- Revenue by job/customer
105- Revenue by service type (if identifiable)
106- Month-over-month trend
107- Average job size
108 
109#### B. Cost Analysis
110- Total costs (period)
111- Cost categories (ranked by size):
112 - COGS (chemicals, equipment, supplies)
113 - Labor (subcontractors, wages)
114 - Travel/fuel
115 - Marketing
116 - Software/subscriptions
117 - Insurance
118 - Other
119- Cost as % of revenue (overall)
120- Cost trend (increasing? decreasing?)
121 
122#### C. Job-Level Profitability
123- Each job with revenue, cost, and margin
124- **Flag: jobs with margin < 30%** (or negative margin)
125- **Flag: jobs where cost > revenue** (loss-making)
126- Best performing job (highest margin)
127- Worst performing job (biggest loss or lowest margin)
128 
129#### D. Opportunity Analysis
130- Most profitable service type → "do more of these"
131- Least profitable → "consider raising prices or declining"
132- Customer concentration risk (if >X% from one source)
133- Seasonal patterns (which months are strongest)
134- Cost categories growing faster than revenue
135 
136### Step 4: Agent Delivers Plain-English Report
137```
138📊 [BUSINESS_NAME] Financial Analysis — Jan-Jun 2026
139 
140TOTALS:
141- Revenue: $48,200 across 22 jobs
142- Costs: $14,800 (30.7% of revenue)
143- Net profit: $33,400 (69.3% margin — healthy)
144 
145YOUR BIGGEST COST CATEGORIES:
1461. Chemicals & Supplies: $4,200 (28% of costs)
1472. Fuel/Travel: $3,100 (21% of costs)
1483. Insurance: $2,400 (16% of costs)
1494. Software/Subscriptions: $890 (6% of costs)
150 
151⚠️ JOBS THAT NEED ATTENTION:
152- Job #1018 ([CITY], small apartment): Revenue $650,
153 Costs $580 → Margin only 8.6%. This job cost almost
154 as much as it made. Consider a minimum job size of
155 $1,000 or raise the small-job rate.
156 
157💰 YOUR BEST JOBS:
158- Job #1003 ([CITY], 3200 sqft residential): Revenue
159 $3,800, Costs $290 → Margin 92.4%. Large residential
160 jobs are your sweet spot.
161 
162📈 OPPORTUNITIES:
163- Your [CITY]/[REGION] jobs average 88% margin vs
164 72% in other regions. Consider targeting more [REGION]
165 partners.
166- Your commercial jobs average $4,500 vs $2,400 for
167 residential. But you only did 3 commercial jobs vs 19
168 residential. More commercial outreach could boost revenue.
169- Fuel costs are 21% of total costs. Premium Region trips
170 have higher fuel — the Premium Region
171 surcharge should be reviewed to ensure it covers actual
172 travel cost.
173 
174NEXT STEPS:
175- Set a minimum job size? (Your smallest jobs have
176 the worst margins)
177- Raise the Premium Region travel surcharge?
178- Target more commercial jobs?
179- More marketing to [REGION] partners?
180 
181Want me to dig deeper into any of these?
182```
183 
184### Step 5: Owner Can Ask Follow-Ups
185- "Show me all jobs under $1,000"
186- "What's my average margin by region?"
187- "Break down the chemical costs month by month"
188- "Which months had the highest revenue?"
189- "Compare my margins last year vs this year"
190 
191## QuickBooks API Integration (Optional, Post-Hackathon)
192 
193When `quickbooks-online` skill is wired with OAuth tokens, the agent can
194pull financials directly without CSV export:
195 
196```python
197# Pseudocode — requires quickbooks-online skill to be wired
198from intuitlib.client import AuthClient
199 
200# Pull Profit & Loss report
201pnl = quickbooks.get_report('ProfitAndLoss', start_date='2026-01-01',
202 end_date='2026-06-30')
203 
204# Pull Sales by Customer
205sales = quickbooks.get_report('SalesByCustomer', start_date='2026-01-01',
206 end_date='2026-06-30')
207 
208# Run same analysis as CSV mode but from live data
209```
210 
211## Agent Integration Patterns
212 
213### Pattern 1: Monthly Financial Review
214```
215Owner: "Analyze my June financials"
216Agent: [reads CSV / pulls from QBO] → produces report → sends in Telegram
217Owner: "Why were chemical costs so high in June?"
218Agent: [drills into chemical line items] → "3 large commercial jobs in
219 June required extra treatments — $1,200 of the $1,800 total"
220```
221 
222### Pattern 2: Job Profitability Audit
223```
224Agent: "I noticed 3 jobs last quarter had margins under 20% — want a
225 breakdown?"
226Owner: "Yes"
227Agent: [lists jobs with revenue, costs, margin] → "All three were
228 small apartments under 1,000 sqft. Your minimum job rate of
229 $1,500 would have prevented two of these from being unprofitable."
230```
231 
232### Pattern 3: CRM Cross-Reference
233```
234Agent: "Your CRM shows 8 jobs booked from Standard Region partners this
235 quarter, averaging $2,100 revenue. But your financials show
236 Standard Region jobs average 72% margin vs 88% in Premium Region. Want me
237 to draft a targeted Premium Region partner campaign?"
238```
239 
240### Pattern 4: Estimator Sanity Check
241```
242Agent: "Your financials show actual job costs averaging 30% of revenue.
243 Your estimator-engine assumes 25% cost ratio. The gap is mostly
244 fuel costs on Premium Region jobs. Want me to update the estimator
245 to include a fuel surcharge for Premium Region?"
246```
247 
248## Common Pitfalls
249 
2501. **CSV format varies** — QuickBooks Online, Desktop, and different
251 report types all export differently. The agent must auto-detect and
252 ask if unsure. Don't assume column names.
2532. **Cost allocation** — Some costs (insurance, software) aren't tied
254 to specific jobs. The agent should separate direct job costs from
255 overhead and be clear about the difference.
2563. **Time periods** — Always confirm the date range with the owner
257 before analyzing. "This shows Jan-Jun 2026 — is that right?"
2584. **Negative numbers** — QuickBooks sometimes exports expenses as
259 positive, sometimes as negative. The agent should detect the
260 convention and normalize.
2615. **Missing data** — If COGS isn't broken out by job, the agent should
262 say so rather than guessing. "Chemical costs are lumped — I can't
263 tie them to specific jobs without more detail."
2646. **Don't give financial advice.** The agent identifies patterns and
265 asks questions. The owner makes decisions. The agent is a tool, not
266 a CPA.
2677. **Privacy** — Financial data stays on the VPS. Don't send raw numbers
268 to external services. Summary in Telegram is fine; raw CSV is not.
269 
270## Verification Checklist
271- [ ] Can read CSV file from disk
272- [ ] Auto-detects CSV format from headers
273- [ ] Parses income/expense transactions correctly
274- [ ] Identifies cost categories and ranks by size
275- [ ] Calculates job-level margins
276- [ ] Flags jobs with margin < 30%
277- [ ] Flags jobs where cost > revenue
278- [ | Produces plain-English summary in Telegram
279- [ ] Owner can ask follow-up questions
280- [ ] QuickBooks API integration (optional, post-hackathon)
281 
282## One-Shot Recipes
283 
284### "Quick financial health check"
285```python
286# Reads CSV → returns: total revenue, total costs, margin %,
287# top 3 cost categories, worst job, best job, 2-3 recommendations
288```
289 
290### "Cost breakdown by category"
291```python
292# Groups all expenses by account/category → ranks by total →
293# calculates each as % of revenue → flags any category growing
294# faster than revenue
295```
296 
297### "Job profitability ranking"
298```python
299# For each job: revenue, direct costs, margin, margin %
300# Sorted by margin % ascending (worst first)
301# Flags any job with margin < 30% or cost > revenue
302```

Discussion

Alternatives