Agent skill

Portfolio Review

by xbtlin in xbtlin/ai-berkshire

Reviews an investment portfolio holding by holding and as a whole: position health, concentration, overlap and opportunity cost, from a holdings list or saved portfolio file.

MITAuto-check passedBusiness, Finance & HR

SKILL.md written in Chinese; this summary is our English description.

Install Portfolio Review

skills CLI
$ npx skills add xbtlin/ai-berkshire --skill portfolio-review -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install xbtlin/ai-berkshire portfolio-review --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/xbtlin/ai-berkshire.git skills-src && mkdir -p .claude/skills && cp -r skills-src/codex-skills/portfolio-review .claude/skills/portfolio-review && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
portfolio-review
GitHub stars
17k
Token cost
~1.2k tokens
SKILL.md length
404 words
Files
1
Skills in repo
22
Repo updated
First seen
Licence
MIT

At a glance

Reviews an investment portfolio holding by holding and as a whole: position health, concentration, overlap and opportunity cost, from a holdings list or saved portfolio file.

  • Works in 4 steps: 当前股价和估值指标(PE、PB、股息率) → 最近一个季度的关键财务变化 → 近期重大事件 → …
  • Checking whether any holding has outgrown a sensible position size
  • SKILL.md covers Codex adapter note, 设计理念, 执行流程 and 关键原则
  • Calls python3

What it does

The skill starts from the holdings you give it, as percentages, as share counts with cost prices, or as a saved portfolio file at reports/portfolio-latest.md, and normalizes them into one table of position, code, quantity, cost, price, market value, weight and gain or loss. Background agents then fetch current price and valuation metrics, key financial changes from the latest quarter, recent events and analyst consensus for each holding, and a financial rigor script checks the valuation data.

Each position gets a quick health check on whether the buy logic has changed and how sound the thesis is, plus three questions: would you buy it today, would you be comfortable holding for five years if you could not trade, and is the original thesis intact. Portfolio-level analysis follows, starting with concentration, and holdings with scarce information are labeled low confidence.

When your agent uses it

  • Checking whether any holding has outgrown a sensible position size
  • Deciding where new money should go versus swapping an existing position
  • Running a periodic health check on every holding's thesis
  • Spotting overlapping exposure between positions

Example prompts

  • “Review my portfolio: Tencent 30%, Meituan 20%, Moutai 20%, Nvidia 15%, cash 15%.”
  • “Update my saved portfolio file and flag the holdings whose thesis looks weaker.”
  • “Review 500 shares of Tencent bought at 480 HKD and 1000 shares of Meituan bought at 130 HKD.”

Requirements

  • Web search access for current prices and data
  • Python 3 for the tools/financial_rigor.py script

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. 当前股价和估值指标(PE、PB、股息率)
  2. 最近一个季度的关键财务变化
  3. 近期重大事件
  4. 分析师一致预期(前瞻PE、目标价)

What it can do on your machine

Read from SKILL.md and the folder at commit a221a20. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Portfolio Review loads about 1.2k tokens when it runs. Until then it costs about 23 tokens; SKILL.md has 404 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~23
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from xbtlin/ai-berkshire at commit a221a20, republished under its MIT licence (© xbtlin). 404 words, ~1,235 tokens.

Download SKILL.mdSave it as .claude/skills/portfolio-review/SKILL.md (or your agent's skills folder).
name
portfolio-review
description
AI Berkshire skill: 组合管理:从"研究公司"到"管理组合". Source: skills/portfolio-review.md.

Codex adapter note

This skill is generated from skills/portfolio-review.md so Claude Code and Codex users share one canonical workflow.

  • Treat $ARGUMENTS as the user's request in the current Codex thread.
  • When the source mentions Claude-only surfaces such as Task, Agent, WebSearch, Bash, Read, or Write, use the closest Codex capability available in this session: subagents when available, web search when needed, shell commands for local tools, and normal file edits for workspace files.
  • Use shared project tools from tools/ in this repository. Prefer running commands from the repository root with paths like python3 tools/financial_rigor.py ...; if the current thread starts outside the repo, locate the actual checkout path first instead of assuming a fixed home-directory path.
  • Before starting research, run the date command to confirm today's date; treat it as the baseline for "latest" data and state the data cutoff date in the report header. Never assume the current date from training data.
  • Preserve the research quality rules from AGENTS.md: cross-check financial data, use exact arithmetic tools for valuation/math, and clearly label uncertainty and source gaps.

组合管理:从"研究公司"到"管理组合"

对 $ARGUMENTS 执行投资组合审视与优化。

支持输入格式:

  • 持仓清单,例如:腾讯30%, 美团20%, 茅台20%, 英伟达15%, 现金15%
  • 或:腾讯 500股 @480港元, 美团 1000股 @130港元, ...
  • 或:我的持仓(如果已有保存的组合文件 reports/portfolio-latest.md)

"分散投资是对无知的保护。如果你知道自己在做什么,分散投资就没有意义。" —— 巴菲特

"我这辈子见过的真正好的投资机会,十个手指就数得完。" —— 李录

设计理念

研究公司只是投资的一半。另一半是组合层面的决策:

  • 买多少?(仓位)
  • 用什么钱买?(资金来源——新钱还是换仓)
  • 和已有持仓是否冲突?(相关性)
  • 最优组合长什么样?(机会成本)

巴菲特从不孤立地看一只股票——他总是在想"这是不是我能做的最好的事?"

执行流程

第一步:解析持仓

从输入中解析出当前持仓,标准化为以下格式:

标的代码持仓量成本价现价市值占比盈亏

如果输入只有比例没有金额,按比例分析即可。

同时检查是否存在已有的组合文件(reports/portfolio-latest.md),如有则读取并更新。

第二步:获取最新数据

使用 Task 工具启动后台 Agent,通过 WebSearch 为每个持仓并行获取:

  1. 当前股价和估值指标(PE、PB、股息率)
  2. 最近一个季度的关键财务变化
  3. 近期重大事件
  4. 分析师一致预期(前瞻PE、目标价)

对每个持仓使用 tools/financial_rigor.py verify-valuation 校验估值数据。对每只持仓标注信息丰富度(A/B/C级),C级持仓的分析结论标注低置信度。

Show full SKILL.md (168 more words)Show less
第三步:单仓位体检

对每个持仓进行快速健康检查:

标的当前PE买入逻辑是否变化论文健康度仓位建议
腾讯18x未变化8/10合理
美团25x竞争加剧6/10偏高,考虑减仓

对每个持仓回答:

  • 如果今天没有持仓,你还会在当前价格买入吗?
  • 如果明天不能交易,持有5年你舒服吗?
  • 买入论文还完整吗?

段永平:"如果你不想持有一只股票10年,那就一天也不要持有。"

第四步:组合层面分析
4.1 集中度分析
指标当前值建议范围判断
第一大持仓占比<40%
前三大持仓占比50-80%
总持仓数量5-15只
现金占比10-30%(视市场环境)

李录的标准:3-5只核心持仓,前3占80%+。但这要求每一只都研究透彻。

巴菲特的标准:核心持仓不超过10只,但允许更多卫星仓位。

4.2 相关性检查

识别持仓之间的隐性关联:

持仓A持仓B相关类型风险
腾讯快手同属中国互联网监管风险共振
英伟达台积电AI供应链上下游AI Capex同向波动
美团拼多多同属中国消费宏观消费同向波动

检查清单:

  • 是否有超过50%的仓位暴露在同一个主题/行业?
  • 是否有超过50%的仓位暴露在同一个国家/货币?
  • 如果中美关系恶化,组合会亏多少?
  • 如果全球经济衰退,组合会亏多少?
4.3 机会成本分析

这是巴菲特最核心的思维方式——每一块钱都应该放在回报最高的地方。

将所有持仓按"预期年化回报"排序:

排名标的当前占比预期年化回报确定性预期回报×确定性
1
2
...

预期回报估算方法(使用 tools/financial_rigor.py three-scenario 计算):

  • 简化公式:预期年化 ≈ FCF Yield + 预期增速(主要方法)
  • 价值型验证:安全边际回归 + 利润增速 + 股息率
  • 成长型验证:利润增速 × 合理PE的变化

关键问题:排名最后的持仓,预期回报是否高于现金(无风险利率~4%)?如果不是,应该卖出换成现金。

4.4 压力测试
情景假设组合预计影响最大回撤
全球衰退企业盈利下降20-30%
中美冲突升级中概股折价50%
利率飙升10年期国债→6%
科技泡沫破裂科技股PE压缩40%

对每个情景做定性+粗估评估(基于各持仓的行业属性和历史估值波动范围):

  • 哪些持仓受冲击最大?大致影响方向和量级范围
  • 组合整体是否能承受?
  • 是否需要对冲?
第五步:优化建议
5.1 调仓建议

基于以上分析,给出具体的调仓建议:

动作标的当前占比建议占比理由
加仓
减仓
清仓
新建仓
不动
5.2 寻找替代标的

如果组合中有"不如现金"的仓位,或者现金占比过高,建议使用 /industry-research 或 /investment-checklist 对感兴趣的行业/公司进行系统筛选,而非在本Skill内直接推荐个股。

5.3 现金管理
当前现金占比建议现金占比理由

巴菲特:目前持有$3,820亿现金,占比超过总资产的25%——当找不到好机会时,现金是最好的仓位。

第六步:输出组合报告
报告结构
一、组合概览(持仓表格+饼图描述)
二、单仓位体检(每个持仓的健康状态)
三、组合分析
   - 集中度:是否过度分散/集中?
   - 相关性:隐性关联和风险共振
   - 机会成本:排名最低的仓位是否值得持有?
   - 压力测试:极端情景下的回撤预估
四、调仓建议(具体操作+理由)
五、下次审视时间和关注重点
结论必须明确回答
  1. 组合整体健康度:优秀 / 良好 / 需要调整 / 问题严重
  2. 最应该做的一件事是什么?(加仓X / 减仓Y / 不动)
  3. 当前最大风险是什么?
第七步:保存组合文件

将组合信息写入 reports/portfolio-latest.md,包含:

  • 最新持仓表
  • 本次审视日期和结论
  • 调仓记录(追加)
  • 下次审视提醒

关键原则

  • 每一块钱都有机会成本 — 持有一只平庸的股票,成本是错过了一只优秀的
  • 集中不是风险,无知才是 — 持有3只你深度理解的股票,比持有30只你一知半解的安全
  • 现金是一种仓位 — 找不到好机会时,持有现金不丢人
  • 组合层面 > 个股层面 — 一只好股票在错误的仓位上也会拖累你
  • 定期审视,但不要过度交易 — 每季度审视一次足够,不要每天盯盘调仓

© xbtlin, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in codex-skills/portfolio-review of xbtlin/ai-berkshire.

Open the folder on GitHubat commit a221a20

Compare with similar skills

Portfolio Review next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Portfolio Review compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Portfolio Review this skillxbtlin/ai-berkshire17k—~1.2kAutomated safety check: PassMIT
AI-Trader Market IntelHKUDS/AI-Trader23k—~1.1kAutomated safety check: PassNone
Eastmoney Market DataHKUDS/Vibe-Trading35k—~1kAutomated safety check: PassMIT
Stock Deep Analysis Workflowwbh604/UZI-Skill7.1k—~9.1kAutomated safety check: NotesMIT
Zhengxi Fund Manager Views Librarylyra81604/zhengxi-views1.8k—~1.6kAutomated safety check: PassMIT
SEC EDGAR Filings FetcherHKUDS/Vibe-Trading35k—~1.4kAutomated safety check: PassMIT

Similar skills

  • AI-Trader Market Intel

    HKUDS/AI-Trader

    Reads AI-Trader's read-only market snapshots, grouped financial news and events board through its market-intel endpoints, for context before trading or posting.

    23k GitHub stars~1.1k tokensUpdated 4 mo ago
    Business, Finance & HRAuto-check passed
  • Eastmoney Market Data

    HKUDS/Vibe-Trading

    Index of Eastmoney's free, no-token market data interfaces for China A-shares and Hong Kong stocks: fund flows, dragon-tiger lists, margin trading, reports and news.

    35k GitHub stars~1k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Runs a staged deep analysis of a single stock on China A-share, Hong Kong and US markets, ending in an HTML report with valuation models and investor-panel scores.

    7.1k GitHub stars~9.1k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check: notes
  • Zhengxi Fund Manager Views Library

    lyra81604/zhengxi-views

    Answers questions with sourced quotes from one Chinese fund manager's public writings, applies his stated investment method and compares his words with real fund holdings.

    1.8k GitHub stars~1.6k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • SEC EDGAR Filings Fetcher

    HKUDS/Vibe-Trading

    Fetches U.S. SEC EDGAR data: resolves tickers to CIK numbers, lists recent 10-K, 10-Q and 8-K filings with document URLs, and pulls XBRL financial series.

    35k GitHub stars~1.4k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Longbridge Earnings

    helsome/folio

    Earnings analysis — pre- and post-earnings. An agent skill from helsome/folio.

    271 GitHub starsUsed in 1 repo~2.5k tokens
    Business, Finance & HRAuto-check passed

More from xbtlin/ai-berkshire

All 22 skills in this repo
  • Scans a long-running industry trend for supply chain chokepoints, aiming to find second- and third-layer suppliers that the market has not yet priced in.

    17k GitHub stars~2.6k tokensUpdated 2 days ago
    Auto-check passed
  • Deep Company Article Series

    xbtlin/ai-berkshire

    Plans and writes a three-to-eight-part long-form article series that breaks down one company, built on fact-checked financials, valuation and management analysis.

    17k GitHub stars~2k tokensUpdated 2 days ago
    Auto-check passed
  • Earnings Report Deep Reading

    xbtlin/ai-berkshire

    Reads a company's filings and earnings call material in depth, rates how complete the sources are and extracts the key figures into a structured review.

    17k GitHub stars~1.4k tokensUpdated 2 days ago
    Auto-check passed
  • Runs four parallel analyst personas over one earnings report, then an editor and reader-review pass turn the findings into a publishable article.

    17k GitHub stars~2.3k tokensUpdated 2 days ago
    Auto-check passed
  • A four-step research framework for finding and tracking high-growth core companies in one industry: map the sector, ask core questions, verify, then hold to the turning point.

    17k GitHub stars~974 tokensUpdated 2 days ago
    Auto-check passed
  • A research rule set for pulling company financials from prioritized sources by market and cross-checking every key figure against two independent sources.

    17k GitHub stars~1.4k tokensUpdated 2 days ago
    Auto-check passed

Questions about Portfolio Review

What does Portfolio Review do?

Reviews an investment portfolio holding by holding and as a whole: position health, concentration, overlap and opportunity cost, from a holdings list or saved portfolio file. md, and normalizes them into one table of position, code, quantity, cost, price, market value, weight and gain or loss. Background agents then fetch current price and valuation metrics, key financial changes from the latest quarter, recent events and analyst consensus for each holding, and a financial rigor script checks the valuation data.

When should I use Portfolio Review?

Portfolio Review fits situations like: checking whether any holding has outgrown a sensible position size; deciding where new money should go versus swapping an existing position; running a periodic health check on every holding's thesis; spotting overlapping exposure between positions.

How do I install Portfolio Review in Claude Code?

Run `npx skills add xbtlin/ai-berkshire --skill portfolio-review -a claude-code`. Or copy the skill folder (codex-skills/portfolio-review in xbtlin/ai-berkshire) into .claude/skills/portfolio-review in your project. Claude Code loads it when a task matches its description.

How do I install Portfolio Review in Codex?

Run `npx skills add xbtlin/ai-berkshire --skill portfolio-review -a codex`. Or copy the skill folder (codex-skills/portfolio-review in xbtlin/ai-berkshire) into .agents/skills/portfolio-review in your project. Codex loads it when a task matches its description.

Can I use Portfolio Review in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add xbtlin/ai-berkshire --skill portfolio-review -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/portfolio-review, .gemini/skills/portfolio-review, .github/skills/portfolio-review and .opencode/skills/portfolio-review in your project.

What does Portfolio Review need to run?

Going by SKILL.md and its folder, Portfolio Review needs the command-line tools its instructions call (python3). Our summary lists: Web search access for current prices and data; Python 3 for the tools/financial_rigor.py script.

Does Portfolio Review access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Portfolio Review safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Portfolio Review use?

Portfolio Review is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Portfolio Review use?

About 1.2k tokens (SKILL.md is roughly 4.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Portfolio Review?

Skills that share tags, products or a category with Portfolio Review: AI-Trader Market Intel (HKUDS/AI-Trader, 23k stars), Eastmoney Market Data (HKUDS/Vibe-Trading, 35k stars), Stock Deep Analysis Workflow (wbh604/UZI-Skill, 7.1k stars) and Zhengxi Fund Manager Views Library (lyra81604/zhengxi-views, 1.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Portfolio Review?

xbtlin (a GitHub user) maintains it in xbtlin/ai-berkshire, which has 16,676 GitHub stars. The repository holds 22 skills in this directory. The repository was last updated on October 8, 2026.

Source: xbtlin/ai-berkshire on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.