Skip to content

Mathematical framework for diversification: variance, efficient frontier, minimum variance, and factor-based risk attribution.

CCM score
58 of 100
skills.sh installs
828
GitHub stars
270
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers portfolio variance for two and n assets, the efficient frontier, and minimum variance weights
  • Includes diversification ratio, risk contribution, and marginal risk contribution formulas with worked examples
  • Warns that correlations rise in crises, so crisis-period correlation matrices should stress-test portfolios
  • Designed for investors checking whether holdings are truly diversified across independent risk factors

Install

$ npx -y skills add joellewis/finance_skills --skill diversification -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Diversification

Core Concepts

Portfolio Variance (2 Assets)

For a portfolio of two assets with weights w_1 and w_2, volatilities sigma_1 and sigma_2, and correlation rho_12:

sigma^2_p = w_1^2 * sigma_1^2 + w_2^2 * sigma_2^2 + 2 * w_1 * w_2 * sigma_1 * sigma_2 * rho_12

Diversification benefit arises whenever rho_12 < 1, because the portfolio volatility will be less than the weighted average of individual volatilities.

Portfolio Variance (n Assets)

In matrix notation for n assets with weight vector w and covariance matrix Sigma:

sigma^2_p = w' * Sigma * w

This generalizes to any number of assets and captures all pairwise correlations.

Diversification Benefit

Portfolio volatility is strictly less than the weighted average of individual volatilities whenever any pairwise correlation is below 1:

sigma_p < Sigma(w_i * sigma_i) when rho_ij < 1 for some i,j

The lower the average correlation, the greater the diversification benefit.

Details

Repository
github.com/joellewis/finance_skills
Categories
Finance & Trading, Data Science & Analytics
First seen
Jun 3, 2026

Questions

What does the diversification skill do for Claude Code?

The diversification skill builds diversified portfolios using correlation analysis, efficient frontier construction and factor-based diversification. It covers portfolio variance, minimum variance portfolios, diversification ratios and risk contributions, and it explains why diversification can fail during market crashes.

How do I install the diversification skill?

Run npx -y skills add joellewis/finance_skills --skill diversification -y in a project. Once installed, Claude can answer questions about portfolio variance, the efficient frontier and whether holdings are really diversified.

Is the diversification skill part of a larger finance skill collection?

Yes, it comes from the finance_skills repository by Joel Lewis, which the skill is listed under in the Finance & Trading category on Claude Marketplaces. It sits alongside other finance skills for investment and compliance topics.

More from joellewis/finance_skills

All 84

Similar to Diversification

More Finance & Trading