# How the AI Berkshire portfolio-review Skill Transforms Position Management

> Discover how the AI Berkshire portfolio-review skill rebalances positions with disciplined decision-making. Analyze risks, stress-test scenarios, and get actionable recommendations for optimized portfolio management.

- Repository: [Xbt Lin/ai-berkshire](https://github.com/xbtlin/ai-berkshire)
- Tags: how-to-guide
- Published: 2026-07-05

---

**The portfolio-review skill converts raw holding data into disciplined rebalancing decisions through a seven-step pipeline that parses positions, validates fundamentals via [`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py), analyzes concentration and correlation risks, stress-tests scenarios, and outputs a structured markdown report with specific position-sizing recommendations.**

The AI Berkshire repository implements a systematic framework for value-oriented portfolio automation. The `portfolio-review` skill serves as the central workflow for position management, transforming unstructured portfolio inputs into data-driven health assessments and rebalancing actions orchestrated through [`skills/portfolio-review.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/portfolio-review.md) and its machine-readable counterpart in [`codex-skills/portfolio-review/SKILL.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-skills/portfolio-review/SKILL.md).

## The Seven-Step Position Management Pipeline

The skill implements a disciplined workflow defined in [`skills/portfolio-review.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/portfolio-review.md) that processes holdings from raw input to actionable recommendations.

### Step 1: Parse and Normalize Holdings

The skill accepts multiple input formats—including percentage lists, share-@price lists, or saved portfolio files—and normalizes them into a uniform table structure. According to the source documentation at lines 26-33, the normalized schema captures **ticker**, **code**, **quantity**, **cost**, **market price**, **market value**, **weight**, and **P/L** for each position.

### Step 2: Enrich with Real-Time Fundamentals

For each ticker, the skill triggers parallel background agents to gather current market data. This includes stock prices, valuation multiples (PE, PB, dividend yield), latest quarterly financial changes, recent news, and analyst consensus. As specified at lines 38-46, this data undergoes validation through [`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py) using the `verify-valuation` command to sanity-check PE/PB/dividend data against historical ranges and flag outliers.

### Step 3: Execute Single-Position Health Checks

The skill generates a concise health-check table for every holding, as described at lines 64-70. This diagnostic displays current PE ratios, an assessment of whether the original investment thesis remains valid, a qualitative health score, and a specific position-size recommendation (add, reduce, hold, or clear).

### Step 4: Analyze Portfolio-Level Risk Factors

The skill aggregates individual position data into four critical risk analyses defined between lines 65-136.

**Concentration Analysis** evaluates exposure against preset thresholds, measuring the largest single holding, top-three concentration, total number of stocks, and cash weight.

**Correlation Detection** identifies hidden relationships across holdings, including sector overlap, country concentration, and supply-chain dependencies that create unintended portfolio correlation.

**Opportunity-Cost Ranking** utilizes `financial_rigor.py three-scenario` to project optimistic, base-case, and pessimistic annualized returns for each position, ranking holdings by expected performance to identify capital reallocation opportunities.

**Stress Testing** runs scenario analyses simulating global recession, geopolitical shocks, rate hikes, and tech bubble conditions to estimate portfolio impact under adverse market states.

### Step 5: Calculate Optimization Recommendations

Based on the analytical outputs, the skill formulates concrete rebalancing actions at lines 144-152. These recommendations specify exact actions—**add**, **reduce**, **clear**, or **create new positions**—with target allocation percentages and cash-management guidelines.

### Step 6: Generate Structured Reports

The skill outputs a comprehensive markdown report to [`reports/portfolio-latest.md`](https://github.com/xbtlin/ai-berkshire/blob/main/reports/portfolio-latest.md) following the structure defined at lines 154-170. The report contains a portfolio overview table, single-position diagnostics, portfolio-level risk assessments, and a clear "next-step" call-to-action section.

### Step 7: Persist State for Incremental Updates

Finally, the skill saves the current portfolio state and review timestamp, enabling future incremental comparisons and tracking of position changes over time (lines 74-80).

## Integration with Financial Analysis Tools

The `portfolio-review` skill leverages shared utilities in [`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py) to ensure analytical rigor.

The **`verify-valuation`** function validates fetched market data against historical ranges, preventing decision-making based on anomalous quotes or data errors.

The **`three-scenario`** function generates probabilistic return estimates for each holding, providing the quantitative foundation for the opportunity-cost analysis and rebalancing recommendations.

## Practical Implementation Examples

### Invoking the Skill from Command Line

You can trigger the workflow using the repository's skill wrapper:

```bash

# Review a portfolio expressed as percentages

./run_skill.sh /portfolio-review "腾讯30%, 美团20%, 茅台20%, 现金30%"

```

The wrapper passes the argument string as `$ARGUMENTS` to the skill, initiating the parsing and analysis pipeline.

### Calling Financial Rigor Tools Internally

The skill invokes validation utilities via subprocess calls as shown in the skill definition:

```python

# Pseudocode from SKILL.md lines 52-60

for ticker in holdings:
    subprocess.run(
        ["python3", "tools/financial_rigor.py", "verify-valuation", ticker],
        check=True,
        capture_output=True,
    )

```

Each holding undergoes validation before downstream analysis proceeds.

### Generated Report Structure

The output file [`reports/portfolio-latest.md`](https://github.com/xbtlin/ai-berkshire/blob/main/reports/portfolio-latest.md) follows this standardized format:

```markdown

# portfolio-latest.md

## 组合概览

| 标的 | 持仓量 | 市值 | 占比 | 盈亏 |
|------|--------|------|------|------|
| 腾讯 | 1000 | $10M | 30% | +5% |

## 单仓位体检

| 标的 | 当前PE | 论文健康度 | 仓位建议 |
|------|--------|------------|----------|
| 腾讯 | 18x | 8/10 | 合理 |

## 调仓建议

| 动作 | 标的 | 当前占比 | 建议占比 | 理由 |
|------|------|----------|----------|------|
| 减仓 | 美团 | 20% | 12% | 竞争加剧 |
| 加仓 | 英伟达 | 15% | 18% | 高增长 |

```

## Summary

- The `portfolio-review` skill provides a **systematic workflow** for converting raw portfolio data into actionable management decisions.
- It validates all market data using **[`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py)** with `verify-valuation` and `three-scenario` functions before analysis.
- The pipeline evaluates both **individual position health** and **portfolio-level risks** including concentration, correlation, opportunity cost, and stress scenarios.
- Output is persisted to **[`reports/portfolio-latest.md`](https://github.com/xbtlin/ai-berkshire/blob/main/reports/portfolio-latest.md)** with specific rebalancing recommendations and position-sizing guidance.
- The architecture supports multiple input formats and maintains state for incremental portfolio tracking.

## Frequently Asked Questions

### What input formats does the portfolio-review skill accept?

The skill accepts percentage lists (e.g., "腾讯30%, 美团20%"), share-@price lists, or references to saved portfolio files. All formats are normalized into a uniform table containing ticker, quantity, cost basis, market price, and weight data as defined in [`skills/portfolio-review.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/portfolio-review.md) lines 26-33.

### How does the skill evaluate individual position health?

Each holding undergoes a single-position health check that examines current PE ratios against the original investment thesis, assigns a qualitative health score, and generates a specific position-size recommendation. This process utilizes validated fundamental data from [`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py) to ensure accuracy.

### What types of risk analysis does the portfolio-review skill perform?

The skill conducts four portfolio-level analyses: concentration risk assessment against preset thresholds, correlation detection across sectors and geographies, opportunity-cost ranking using three-scenario return projections, and stress-testing against market shocks including recessions and rate hikes.

### Where are the review results stored?

The skill generates a markdown report at [`reports/portfolio-latest.md`](https://github.com/xbtlin/ai-berkshire/blob/main/reports/portfolio-latest.md) containing portfolio overviews, position diagnostics, and rebalancing recommendations. It also persists the portfolio state and timestamp for future incremental reviews, enabling historical tracking of position changes.