portfolio-diagnosis

portfolio-diagnosis is a skill for Claude Code, Codex from ginlix-ai/LangAlpha. It costs 77 tokens per session (1,529 once invoked), scanned A, original, Apache-2.0.

A portfolio health check for an investor's holdings. It compares investments across sectors, regions, asset types, cash, currencies, and risk measures with the investor's stated goals.

In plain words
What is it for?
Use it to review a portfolio's diversification, volatility, beta, drawdown, cash position, currency mix, and fit with an investment profile.
Why use it?
It helps reveal concentration, unsuitable risk, large drawdowns, or an unbalanced mix without turning the review into a trade recommendation.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to review a portfolio's diversification, volatility, beta, drawdown, cash position, currency mix, and fit with an investment profile.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ginlix-ai/langalpha/portfolio-diagnosis
About the project

LangAlpha is an agent workspace for researching financial markets and supporting investment decisions through persistent research, news analysis, and parallel subagents. It is for investors who want to develop and update trading theses over time, including generating long-short pair-trade ideas. The catalogue entries provide the skills, instructions, MCP servers, and plugin that make up its agent workflow.

ginlix-ai/LangAlpha · 1,869 stars · on GitHub · langalpha.ai

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ginlix-ai/LangAlpha --skill portfolio-diagnosis
Clone the repo
git clone --depth 1 https://github.com/ginlix-ai/LangAlpha

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for portfolio-diagnosis

README.md
[![agentmods](https://agentmods.dev/badge/skills/ginlix-ai/langalpha/portfolio-diagnosis/github.svg)](https://agentmods.dev/skills/ginlix-ai/langalpha/portfolio-diagnosis)
Your own site
<a href="https://agentmods.dev/skills/ginlix-ai/langalpha/portfolio-diagnosis"><img src="https://agentmods.dev/badge/skills/ginlix-ai/langalpha/portfolio-diagnosis/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for portfolio-diagnosis

Your own site · 80×15
<a href="https://agentmods.dev/skills/ginlix-ai/langalpha/portfolio-diagnosis"><img src="https://agentmods.dev/badge/skills/ginlix-ai/langalpha/portfolio-diagnosis.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,529 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00077 $0.01529
Opus 5.5 $0.00031 $0.00612
Sonnet 5.5 $0.00015 $0.00306
Haiku 4.5 $0.00008 $0.00153

Measured yesterday against content hash fbbea1398cc8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

portfolio-diagnosis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/langalpha_research/skills/portfolio-diagnosis/SKILL.md · 65 lines

How it starts

The opening of the file, as written. The whole thing — 65 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Portfolio Diagnosis

A one-minute read of what the user holds, measured against what they told you they want. Every finding carries a number and what that number is compared with. No lecture and no trade calls.

1. Inputs

  • .agents/user/profile/portfolio.json: the holdings. When this turn already read it, use that copy.
  • The ## Investment Profile block in your system prompt: its Risk level, Investor type, Experience, Markets, Wants to trade, Analysis approaches, Investing styles, Holding horizon and Sectors lines. A line may hold an older profile's free text: read what is there. When the block has no line for what you need, an older profile may keep it in a free-text key of .agents/user/profile/preference.json, such as risk_tolerance or holding_period. With no risk level at all, report the risk numbers without a fit verdict.
  • A brokerage in <mcp-servers>: take positions and cash balances from it, unless this turn already fetched them. Its quantities and market values win over the file. If they differ from portfolio.json, say so in one line and offer to re-import. Don't write the file here.
  • No holdings: say the diagnosis needs them and ask for a few positions as ticker and quantity.

2. Compute, in one execute_code call

from tools.yf_price import get_multiple_stocks_history   # 1y daily bars, many symbols
from tools.yf_fundamentals import get_company_info       # sector, country, quoteType, category, currency
from tools.price_data import get_stock_data, get_asset_data  # fallback bars; crypto and forex
  • Prices: one get_multiple_stocks_history(symbols, period="1y") holding every position, the benchmark, and any currency pairs, with crypto as BTC-USD and pairs as HKDUSD=X. It keys results by canonical symbol (600519.SH, HKD-USD), not always your spelling. Retry what lands in errors with get_stock_data, or get_asset_data("BTCUSD", "crypto") and get_asset_data("HKDUSD", "forex"). When a server is missing from <mcp-servers>, use the other.
  • Benchmark: the one for the market holding the most weight. US SPY, Hong Kong 2800.HK, mainland China 510300.SH, Japan 1306.T, Europe EXSA.DE.
  • Base currency: the currency most of the value is in. Convert every other series at the pair's daily close, forward-filled, inverting the reverse pair when the direct one fails.
  • Value and weights: quantity times the latest close, or the broker's market value. Cash counts toward the total.
  • Concentration: the largest position's weight, the top five's combined weight, and effective N (1 / Σw² over invested positions). A broad index ETF is diversified on its own, so judge single-name risk without it.
  • Exposure:
    • Sector: from sector, or for an ETF its category.
    • Region: from the listing. No suffix is us, .HK is hk, .SH/.SZ is cn, .T is jp, European exchanges are eu. Note it when a holding lists in one market and does business mainly in another.
    • Asset class: from instrument_type.
    • Compare each with the stated Markets, Wants to trade and Sectors: the weight outside them, and any stated one with nothing in it. Read Wants to trade against only the values instrument_type shares with it (stock, etf, option, crypto, bond, fund), and skip that comparison when none of those is stated.
  • Cash share, and the currency mix when more than one currency is held.
  • Risk: replay today's weights over the past year on the benchmark's trading days, forward-filling a holding across its own market's holidays. From that series, take annualized volatility (daily standard deviation × √252), beta to the benchmark, and the one-year maximum drawdown. Holdings with under 60 days of history stay out of the risk figures.

Read the full file on GitHub · 65 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 65 lines · 77 tokens per session scan A fbbea1398cc8

Subscribe to this mod's changes

portfolio-diagnosis is a skill published in the GitHub repository ginlix-ai/LangAlpha (1,869 stars, last pushed today), licensed Apache-2.0. It adds 77 tokens to every session and 1,529 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-21.