# AI Berkshire Financial Analysis Skills: A Modular Framework for Institutional-Grade Research

> Discover AI Berkshire's six financial analysis skills including valuation modeling and portfolio monitoring. Eliminate LLM errors with exact arithmetic for institutional-grade research.

- Repository: [Xbt Lin/ai-berkshire](https://github.com/xbtlin/ai-berkshire)
- Tags: deep-dive
- Published: 2026-07-29

---

**AI Berkshire offers six specialized financial analysis skills—including financial-data acquisition, financial-analyst valuation modeling, financial-detective research for private firms, income-investment evaluation, earnings-review validation, and portfolio-review monitoring—all enforced by a strict validation layer in [`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py) that eliminates LLM calculation errors through exact arithmetic and cross-validation.**

The `xbtlin/ai-berkshire` repository implements a **modular "skill" architecture** where each financial analysis capability is expressed as a markdown file under `skills/`. These definitions drive Claude-Code slash-commands and Codex-generated prompts while orchestrating underlying financial rigor utilities to ensure accurate, source-validated research for both public and private companies.

## Core Financial Analysis Skills

AI Berkshire organizes its capabilities into distinct roles, each targeting specific stages of the investment research workflow. All skills share a **common validation layer** ([`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py)) that guarantees exact arithmetic and enforces the >1% discrepancy rule defined in the financial data specification.

### Financial-Data: Standardized Acquisition

The **financial-data** skill provides standardized acquisition and cross-validation of corporate financial metrics across global markets. Defined in [`skills/financial-data.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/financial-data.md), this skill maintains a data-source matrix covering US equities (macrotrends, stockanalysis), Hong Kong and A-shares (aastocks, 东方财富), and Taiwan (FinMind).

The skill implements error-threshold logic: discrepancies ≤1% are auto-accepted, 1-5% trigger warnings, and >5% force manual verification (see [`financial-data.md`](https://github.com/xbtlin/ai-berkshire/blob/main/financial-data.md) lines 73-77). For Taiwanese stocks, it provides command-line wrappers invoking [`tools/twstock_data.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/twstock_data.py) (lines 40-48).

### Financial-Analyst: Deep-Dive Valuation

The **financial-analyst** role (defined in [`skills/investment-team.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-team.md)) executes deep-dive balance-sheet, cash-flow, and valuation analysis for listed companies. This skill utilizes [`financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/financial_rigor.py) to verify market capitalization, validate valuation multiples, and perform three-scenario modeling.

According to the source code in [`investment-team.md`](https://github.com/xbtlin/ai-berkshire/blob/main/investment-team.md) (lines 79-84), the analyst must cross-validate all metrics before building forward projections, ensuring no "LLM mental math" contaminates the valuation.

### Financial-Detective: Private Company Research

For unlisted firms, the **financial-detective** role (see [`skills/private-company-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/private-company-research.md)) assembles fragmented financial information from multiple low-confidence sources. This skill combines prospectus data, media reports, and financing-round information, annotating each data point with confidence icons (🟢, 🟡, 🔴) to surface reliability levels (line 27).

The detective runs alternative valuation methods—DCF, comparable-company analysis, and financing-round analysis—using the same rigorous validation rules as public-company research.

### Income-Investment: Dividend Analysis

The **income-investment** skill focuses on evaluating dividend yield, payout ratios, and income-generation potential. It calls [`financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/financial_rigor.py) for exact payout and yield calculations, ensuring that income-focused portfolio decisions rely on verified arithmetic rather than estimated approximations.

### Earnings-Review: Release Validation

The **earnings-review** and **earnings-team** skills validate quarterly earnings releases and prepare briefing materials for earnings calls. As implemented in [`skills/earnings-review.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/earnings-review.md) (lines 78-90), this workflow executes cross-validation of reported figures, verifies market-cap consistency, and runs scenario analysis to contextualize surprises against forward guidance.

### Portfolio-Review: Holdings Monitoring

The **portfolio-review** skill applies financial-rigor checks to every holding in a portfolio. It runs `verify-valuation` across positions and annotates data-richness grades, enabling systematic monitoring of valuation drift and data quality degradation across the investment book.

## Technical Architecture and Validation Layer

The reliability of AI Berkshire's financial analysis skills stems from its strict separation between prompt orchestration (skills) and calculation execution (tools).

### Skill Definition Layer (`skills/*.md`)

Each markdown file under `skills/` describes a complete task flow: role definition, required data inputs, execution steps, and exact CLI commands to invoke supporting tools. For example, [`skills/financial-data.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/financial-data.md) lists source priorities by market region and provides sample Bash invocations for [`twstock_data.py`](https://github.com/xbtlin/ai-berkshire/blob/main/twstock_data.py) (lines 42-45).

### Financial Rigor Engine ([`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py))

The [`financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/financial_rigor.py) utility supplies the computational backbone with sub-commands including:

- `verify-market-cap`: Validates market capitalization calculations
- `verify-valuation`: Checks PE/PB multiple consistency
- `cross-validate`: Compares values across data sources with error threshold handling
- `three-scenario`: Runs bull/base/bear valuation modeling

This tool is called from multiple skills (see [`investment-team.md`](https://github.com/xbtlin/ai-berkshire/blob/main/investment-team.md) lines 79-84, [`earnings-review.md`](https://github.com/xbtlin/ai-berkshire/blob/main/earnings-review.md) lines 78-90) to guarantee that all numerical outputs derive from exact arithmetic rather than language model approximations.

### Taiwanese Market Data ([`tools/twstock_data.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/twstock_data.py))

For Taiwan equity markets, [`twstock_data.py`](https://github.com/xbtlin/ai-berkshire/blob/main/twstock_data.py) provides a zero-dependency script wrapping the FinMind API. Referenced in [`financial-data.md`](https://github.com/xbtlin/ai-berkshire/blob/main/financial-data.md) (line 36), this tool enables real-time quote retrieval and valuation metric calculation without external dependencies.

## Practical Command-Line Workflows

The following examples demonstrate the exact CLI patterns implemented in the AI Berkshire skills framework.

### Cross-Validating US Financial Metrics

To pull revenue, EPS, and ROE with automatic discrepancy flagging:

```bash
python3 tools/financial_rigor.py cross-validate \
  --field revenue \
  --values '{"macrotrends":1234,"stockanalysis":1228}' \
  --unit "亿元"

```

This follows the priority pattern defined in [`financial-data.md`](https://github.com/xbtlin/ai-berkshire/blob/main/financial-data.md) (source 1 = macrotrends, source 2 = stockanalysis), automatically flagging any variance exceeding the 1% tolerance threshold.

### Verifying Taiwanese Stock Valuations

```bash
python3 tools/twstock_data.py valuation 2330
python3 tools/financial_rigor.py verify-valuation \
  --price 520 \
  --eps 23.5 \
  --bvps 28.1

```

The first command obtains the latest quote and PER/PBR from FinMind (see [`financial-data.md`](https://github.com/xbtlin/ai-berkshire/blob/main/financial-data.md) lines 42-45). The second validates the derived valuation metrics against exact inputs.

### Running Three-Scenario Valuation Models

```bash
python3 tools/financial_rigor.py three-scenario \
  --price 145 \
  --eps 7.2 \
  --shares 5.3 \
  --growth 5 7 12 \
  --pe 12 15 20

```

This replicates the workflow embedded in the `financial-analyst` role (see [`investment-team.md`](https://github.com/xbtlin/ai-berkshire/blob/main/investment-team.md) line 83), generating bull, base, and bear case valuations using explicit growth and multiple assumptions.

### Assembling Private-Company Financials

For unlisted fintech revenue estimation with confidence tagging:

```bash
python3 tools/financial_rigor.py cross-validate \
  --field revenue \
  --values '{"prospectus": "¥1.2B", "media_report": "¥1.15B"}' \
  --unit "人民币"

```

This reflects the "financial-detective" pattern described in [`private-company-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/private-company-research.md) (lines 78-84), enabling triangulation of fragmented data sources.

## Summary

- **AI Berkshire** implements six distinct financial analysis skills as modular markdown definitions under `skills/`, covering data acquisition, valuation analysis, private company research, income investing, earnings validation, and portfolio monitoring.
- All skills route numerical calculations through **[`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py)**, enforcing exact arithmetic and a >1% cross-validation threshold that prevents LLM hallucination in financial calculations.
- The architecture supports **multi-market data sourcing** (US, HK, A-shares, Taiwan) with specific wrappers like [`twstock_data.py`](https://github.com/xbtlin/ai-berkshire/blob/main/twstock_data.py) for regional APIs, ensuring standardized input across diverse jurisdictions.
- **Private company capabilities** include confidence-tagging conventions (🟢🟡🔴) and fragmented-data triangulation, extending rigorous analysis beyond publicly traded entities.
- Command-line interfaces allow direct invocation of validation utilities, enabling integration into existing workflows or automated pipeline triggers.

## Frequently Asked Questions

### How does AI Berkshire prevent calculation errors in financial analysis?

AI Berkshire eliminates "LLM mental math" by routing all numerical operations through **[`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py)**, a dedicated validation layer that performs exact arithmetic. According to the source code in `xbtlin/ai-berkshire`, this tool enforces a >1% discrepancy rule: any variance between data sources exceeding 1% triggers warnings or manual verification requirements, ensuring that valuation and cross-validation outputs derive from precise computation rather than language model estimation.

### What data sources does AI Berkshire support for financial metrics?

The **financial-data** skill maintains a prioritized source matrix covering multiple jurisdictions. For US equities, it uses macrotrends and stockanalysis; for Hong Kong and A-shares, aastocks and 东方财富 (East Money); for Taiwan, FinMind via the [`twstock_data.py`](https://github.com/xbtlin/ai-berkshire/blob/main/twstock_data.py) wrapper. This multi-source approach enables the `cross-validate` command to detect data anomalies by comparing values across independent providers before ingestion into analysis workflows.

### Can AI Berkshire analyze private companies without public filings?

Yes, the **financial-detective** role specializes in unlisted company research. As defined in [`skills/private-company-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/private-company-research.md), this skill assembles fragmented information from prospectuses, media reports, and financing rounds, applying confidence icons (🟢 for high confidence, 🟡 for medium, 🔴 for low) to annotate data reliability. It runs alternative valuation methods—DCF, comparable-company analysis, and financing-round analysis—using the same rigorous validation rules applied to public securities.

### What is the three-scenario valuation workflow?

The **three-scenario** command in [`financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/financial_rigor.py) generates bull, base, and bear case valuations by accepting explicit growth rates and PE multiples as parameters. This workflow, embedded in the `financial-analyst` role within [`skills/investment-team.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-team.md), requires analysts to define optimistic (e.g., 12% growth, PE 20), baseline (7% growth, PE 15), and pessimistic (5% growth, PE 12) assumptions, then calculates implied valuations using exact share counts and earnings figures rather than approximate ranges.