If you need to estimate how much you could lose on a portfolio, this handles the standard risk toolkit: parametric VaR using variance-covariance, Monte Carlo simulation for non-normal distributions, Expected Shortfall for tail risk beyond VaR, and component/marginal VaR to see which positions contribute most to total risk. It also covers stress testing and scenario analysis with historical or hypothetical shocks. The formulas are straightforward and it walks through converting daily to multi-day horizons, decomposing risk into systematic factors versus idiosyncratic noise, and the difference between coherent measures like CVaR and plain VaR. Useful for regulatory capital calculations or just understanding your downside before things get ugly.

skills.sh installs
733
GitHub stars
224
last updated
Aug 21, 2026

Install

$ npx -y skills add joellewis/finance_skills --skill forward-risk --agent claude-code

Installs into .claude/skills of the current project.

Files

Forward-Looking Risk Analysis

Core Concepts

Parametric (Variance-Covariance) VaR

Assumes returns are normally distributed. For a single asset or portfolio in dollar terms (assuming zero expected return over short horizons):

VaR = W * z_alpha * sigma_p

where:

  • W = portfolio value
  • z_alpha = z-score for confidence level (1.645 for 95%, 2.326 for 99%)
  • sigma_p = portfolio volatility over the relevant horizon

More generally, including expected return:

VaR_alpha = mu - z_alpha * sigma

To convert from 1-day VaR to h-day VaR (assuming i.i.d. returns):

VaR_h = VaR_1 * sqrt(h)

Portfolio VaR (Multiple Assets)

For a portfolio with weight vector w and covariance matrix Sigma:

sigma_p = sqrt(w' * Sigma * w)
VaR_p   = W * z_alpha * sqrt(w' * Sigma * w)

The covariance matrix captures both individual volatilities and correlations between assets.

Monte Carlo VaR

Simulate a large number of portfolio return scenarios (e.g., 10,000+), then take the alpha-percentile of the simulated loss distribution.

Sponsors

Details

Repository
github.com/joellewis/finance_skills
Categories
Frontend Development, Testing & QA, Productivity & Planning, Finance & Trading
First seen
Jun 3, 2026

More from joellewis/finance_skills

All 84
1aedev-tools avatarafter-effectsaedev-tools/adobe-agent-skillsAutomate Adobe After Effects via ExtendScript. Use when the user asks to create, modify, or query anything in an After Effects project — layers, keyframes, expr731skills.sh installs
2ruvnet avatarvector-clusterruvnet/rufloCluster code by graph community detection via npx ruvector@0.2.25 hooks graph-cluster (spectral / Louvain)729skills.sh installs
3diodeinc avataridiomatic-zenerdiodeinc/pcbStyle rules and idioms for writing high-quality Zener HDL code. Use when writing, reviewing, or refactoring `.zen` files — modules, reference designs, or board 724skills.sh installs
4ruvnet avatarbrowser-replayruvnet/rufloReplay a recorded session trajectory against the same URL or a mutated variant; uses browser-selectors embedding similarity to recover from DOM drift721skills.sh installs
5joellewis avatarfixed-income-sovereignjoellewis/finance_skillsAnalyze US Treasury securities and interest rate risk: bond pricing, yield curve construction, duration, convexity, TIPS, and forward/spot rate analysis. Use wh718skills.sh installs
6mindrally avatarfirebase-developmentmindrally/skillsFirebase development guidelines for Firestore, Authentication, Functions, and Storage with TypeScript and Angular.715skills.sh installs