How to Use the Portfolio-Review Skill in AI Berkshire: A Complete Guide

The portfolio-review skill transforms raw holdings descriptions into data-driven audit reports through a deterministic seven-step pipeline defined in skills/portfolio-review.md.

The portfolio-review skill in the AI Berkshire repository provides an automated workflow for analyzing investment portfolios with institutional-grade rigor. It converts textual descriptions of holdings into comprehensive audit reports that include valuation checks, correlation analysis, and rebalancing recommendations. This skill leverages parallel web searches and the tools/financial_rigor.py validation suite to deliver quantitative portfolio management.

What Is the Portfolio-Review Skill?

The portfolio-review skill is a canonical workflow declared in skills/portfolio-review.md that performs automated portfolio audits and optimizations. It accepts textual descriptions of holdings—either as percentages, share counts, or references to existing portfolio files—and outputs a comprehensive markdown report stored in reports/portfolio-latest.md. The skill is available in both Claude Code and Codex environments through the auto-generated wrapper at codex-skills/portfolio-review/SKILL.md.

The Seven-Step Analysis Pipeline

The skill executes a deterministic seven-step pipeline to transform raw input into actionable investment insights.

Step 1: Parse Holdings

The skill normalizes user input into a tabular format containing fields like 标的 (asset), 代码 (ticker), and 持仓量 (position size). This step handles various input formats including percentage allocations and absolute share counts with entry prices.

Step 2: Fetch Latest Data

The system launches a Task Agent that executes parallel WebSearch calls for each holding. This retrieves current prices, PE/PB ratios, dividend yields, quarterly financial changes, major events, and recent analyst forecasts.

Step 3: Single-Position Health Check

Each holding undergoes a health matrix evaluation using the verify-valuation function from tools/financial_rigor.py. The system prompts users with three binary questions, including "如果今天没有持仓,你还会在当前价格买入吗?" (If you didn't hold this today, would you buy it at the current price?).

Step 4: Portfolio-Level Analysis

This phase conducts four critical analyses:

  • Concentration checks: Validates that the largest holding remains under 40%, top-3 holdings comprise 50-80%, total holdings number 5-15, and cash position stays at 10-30%.
  • Correlation analysis: Detects hidden exposures across industries, countries, and currencies while estimating potential losses under macro-shocks.
  • Opportunity-cost ranking: Uses financial_rigor.py three-scenario to compute expected annual returns and compares them against the risk-free cash rate (~4%).
  • Stress testing: Assesses qualitative and quantitative impacts of global recession, US-China conflict, interest rate surges, and tech-bubble bursts.

Step 5: Optimization Recommendations

The skill generates concrete rebalancing actions (加仓/减仓/清仓/新建仓) with detailed rationale and a cash-management table.

Step 6: Report Assembly

The system compiles a markdown report containing an overview, single-position health status, portfolio analysis, actionable suggestions, and a next-review schedule.

Step 7: Persist

The final report writes to reports/portfolio-latest.md, creating a persistent audit trail for future incremental reviews.

Input Formats and Command Syntax

The skill accepts three distinct input formats through the /portfolio-review command.

Percentage Allocation:

/portfolio-review 腾讯30%, 美团20%, 茅台20%, 英伟达15%, 现金15%

Detailed Share Counts:

/portfolio-review 腾讯 500股 @480港元, 美团 1000股 @130港元, 英伟达 120股 @1200港元

Existing Portfolio File:

/portfolio-review 我的持仓

This command reads the current holdings from reports/portfolio-latest.md if previously saved.

Core Components and File Structure

The skill relies on specific files that handle parsing, validation, and storage.

Skill Definition

The canonical workflow lives in skills/portfolio-review.md, which defines the command syntax, accepted inputs, and the multi-step analysis pipeline. The codex-skills/portfolio-review/SKILL.md file provides an auto-generated wrapper ensuring identical behavior across Claude Code and Codex environments.

Financial Validation Tools

The tools/financial_rigor.py module supplies two critical functions:

  • verify-valuation: Validates valuation data quality for individual holdings.
  • three-scenario: Computes expected annual returns across bull, base, and bear cases for opportunity-cost analysis.

Persistent Storage

The reports/portfolio-latest.md file serves as the persistent storage for portfolio audits. The skill reads this file when users specify "我的持仓" and writes updated reports back to maintain a historic audit trail.

Running the Skill Programmatically

You can invoke the skill via Python using the repository's CLI wrapper:

import subprocess

cmd = [
    "python3", "scripts/run_skill.py",
    "--skill", "portfolio-review",
    "--args", "腾讯30%, 美团20%, 茅台20%, 英伟达15%, 现金15%"
]

result = subprocess.run(cmd, capture_output=True, text=True)
print(result.stdout)  # Outputs the generated markdown report

This executes the full seven-step pipeline and returns the comprehensive audit report.

Summary

  • The portfolio-review skill is defined in skills/portfolio-review.md and available through both Claude Code and Codex via codex-skills/portfolio-review/SKILL.md.
  • It follows a seven-step pipeline from parsing holdings to persisting audit reports in reports/portfolio-latest.md.
  • Input formats include percentage allocations, share counts, and existing portfolio file references ("我的持仓").
  • Financial validation relies on tools/financial_rigor.py functions including verify-valuation and three-scenario.
  • The skill enforces concentration limits, performs correlation checks, and runs stress tests against macroeconomic scenarios.

Frequently Asked Questions

What input formats does the portfolio-review skill accept?

The skill accepts three formats: percentage allocations (e.g., "腾讯30%"), detailed share counts with prices (e.g., "腾讯 500股 @480港元"), or the keyword "我的持仓" to load existing data from reports/portfolio-latest.md.

Where does the portfolio-review skill store its output?

The skill persists audit reports to reports/portfolio-latest.md. This creates a historic trail that enables incremental portfolio reviews and allows comparison against previous analyses to track changes in position health and concentration metrics.

How does the skill validate financial data?

The skill calls verify-valuation from tools/financial_rigor.py to ensure data quality for each holding. It also uses three-scenario modeling to calculate expected annual returns across market conditions for opportunity-cost comparisons against the ~4% risk-free cash rate.

Can I use the portfolio-review skill in both Claude Code and Codex?

Yes. The skill is defined in skills/portfolio-review.md and auto-generated to codex-skills/portfolio-review/SKILL.md, ensuring identical seven-step pipeline execution across both Claude Code and Codex environments regardless of which interface you use.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →