Portfolio: Claude skills backed by calculation code
Portfolio drift monitoring and rebalancing, parametric VaR and expected shortfall, tax-loss harvesting screens with a wash-sale look-back, cost basis by lot, time- and money-weighted returns, Sharpe ratio reliability, and small-universe historical and forward simulations - plus guidance for accounting, attribution and risk-model workflows that the engines do not implement.
What wealth-portfolio calculates
11 commands, each available in the CLI, as an MCP tool and as a JavaScript import. Every result carries the method it used, the questions it still needs answered and the next steps worth taking.
| Command | What it returns | What it needs |
|---|---|---|
portfolio drift-monitor | Allocation drift against targets, with the trades that would correct it. | current, target, value |
portfolio rebalance | Trades that move a portfolio from its current allocation to target. | current, target, value |
portfolio var | Parametric Value at Risk and expected shortfall. | value, vol |
portfolio factors | Asset-class mix, with factor and duration averages of values you supply. | holdings |
portfolio tlh | Tax-loss harvesting screen with a wash-sale look-back and replacement candidates. | lots |
quant backtest | Historical backtest over embedded annual returns for VTI, BND, VXUS and VNQ. | weights |
quant forward-test | Monte Carlo projection of a weighted portfolio under a macro regime. | weights |
portfolio cost-basis | Cost basis and holding period for a sale, by FIFO, specific identification or average cost. | lots, sale |
portfolio twr | Time-weighted return, which removes the effect of contributions and withdrawals. | valuations |
portfolio irr | Money-weighted return (XIRR) from dated contributions, distributions and ending value. | cashFlows |
quant sharpe-stats | How far a Sharpe ratio can be trusted: standard error, and probabilistic and deflated Sharpe ratios. | returns |
When to use it
- Evaluate portfolio asset allocation against targets and monitor drift.
- Run historical backtests (CAGR, Sharpe, Sortino, max drawdown) or forward Monte Carlo simulations.
- Calculate Value at Risk and expected shortfall.
- Find tax-loss harvesting opportunities across taxable lots.
Requests this pack answers:
- “is the portfolio off target”
- “do they need rebalancing”
- “what trades bring this back to target”
- “rebalance this portfolio”
- “how much could this portfolio lose”
- “what is the value at risk”
- “what is this portfolio made of”
- “what is the duration”
- “any losses to harvest”
- “tax loss harvesting opportunities”
- “how would this mix have done”
- “backtest a 60/40”
- “what happens if stagflation returns”
- “project this portfolio forward”
- “what is the basis on this sale”
- “which lots should we sell”
- “how did the manager perform”
- “time-weighted return”
- “what is the IRR on this fund”
- “money-weighted return”
- “is this Sharpe ratio significant”
- “could this backtest be luck”
What it does not do
Named here because leaving it out is how an agent ends up asserting something the code never computed.
Guidance only, no engine behind it
- Portfolio accounting, performance attribution and client reporting (Addepar, Orion, Black Diamond, APX, Geneva)
- Risk-model factor exposures (BarraOne, Axioma): the engine only averages factor scores you supply
- Portfolio optimization, tax-aware transitions and direct indexing
Limits to state with every result
- Tax-loss harvesting checks only purchases in the 30 days *before* the sale, across the lots supplied. Confirm separately that nothing substantially identical is bought in the 30 days after, including in IRA and spouse accounts. Replacement candidates track a different index, but whether a fund is "substantially identical" is a judgment for the advisor or tax professional. No replacement is suggested for total-bond funds.
- Backtests use approximate embedded annual returns and capture drawdowns at year-end only.
- Forward-simulation regime assumptions are illustrative, not forecasts; pass your firm's capital market assumptions for client work.
- VaR is parametric normal and only as good as the volatility you supply.
Run it
node bin/wealth-skills.js portfolio drift-monitor --current '{"equity":68,"fixedIncome":32}' --target '{"equity":60,"fixedIncome":40}' --value 1000000 --band 5
node bin/wealth-skills.js portfolio var --value 1000000 --vol 0.14 --confidence 0.99
node bin/wealth-skills.js portfolio tlh --lots '[{"id":"L1","symbol":"VOO","quantity":100,"purchasePrice":500,"currentPrice":420,"purchaseDate":"2025-02-03"}]'
node bin/wealth-skills.js quant backtest --weights '{"VTI":0.6,"BND":0.4}' --initial 100000
node bin/wealth-skills.js quant forward-test --weights '{"VTI":0.6,"BND":0.4}' --regime stagflation
The same commands are exposed as MCP tools, so Claude, Claude Code, Codex, Cursor and any other MCP client can call them directly. See the integration guide and the pack itself, skills/wealth-portfolio/SKILL.md.
Catalog coverage
91 resources from the US Wealth Management Capability Catalog map to this pack, 22 of them backed by engine code and the rest cited as guidance or reference.
| Resource | What the pack does with it | Coverage |
|---|---|---|
| The Statistics of Sharpe Ratios (Lo, 2002) | Uncertainty in risk-adjusted performance Standard error of the Sharpe ratio under independent returns. | engine |
| The Deflated Sharpe Ratio (Bailey and Lopez de Prado, 2014) | Adjust for selection bias and non-normal returns Deflated Sharpe ratio for selection across trials. | engine |
| IRC 1012 Basis of property | Cost-basis statutory foundation Cost basis by lot. | engine |
| IRS Publication 551 | Asset-basis guidance Purchase-price basis by lot; no gifted, inherited or adjusted basis. | partial-engine |
| IRS Form 1099-B instructions | Broker transaction and basis reporting Lot basis and holding period; no 1099-B reconciliation. | partial-engine |
| IRC 1091 Wash sales | Loss disallowance on specified replacement transactions Wash-sale look-back across supplied lots only. | partial-engine |
| Global Investment Performance Standards | Investment-performance presentation standards Time-weighted return; no composite construction. | partial-engine |
| Addepar | Investment data aggregation and portfolio reporting Performance from supplied valuations; no data aggregation. | partial-engine |
| Orion Advisor Technology | Portfolio accounting, reporting and advisor operations Lot basis and time-weighted return; not a book of record. | partial-engine |
| SS&C Black Diamond | Wealth portfolio reporting and client experience Performance calculation only; no reporting portal. | partial-engine |
| SS&C Advent APX | Portfolio accounting and investment reporting Cost basis by lot; not portfolio accounting. | partial-engine |
| Envestnet wealth platform | Managed-account and advisor investment workflows Drift and rebalance trades; no managed-account platform. | partial-engine |
| Morningstar Office | Advisor portfolio management and reporting Drift monitoring and performance; no portfolio management platform. | partial-engine |
| MSCI BarraOne | Multi-asset portfolio risk analysis Parametric VaR and expected shortfall; no multi-factor risk model. | partial-engine |
| MSCI Barra Portfolio Manager | Portfolio construction and factor-risk analysis Asset-class mix and averages of supplied factor scores; no factor model. | partial-engine |
| Bloomberg PORT | Portfolio performance, risk and attribution Return, risk and Sharpe reliability; no attribution. | partial-engine |
| FactSet Portfolio Analytics | Portfolio analytics and performance attribution Time-weighted return only; no attribution. | partial-engine |
| Aladdin Wealth | Wealth portfolio risk and advisor analytics Parametric risk and regime simulation. | partial-engine |
| Nitrogen | Risk alignment and proposal analytics Risk-tolerance fit and proposal backtests; no risk questionnaire scoring. | partial-engine |
| 55ip | Tax-aware investment management and transitions Lot-level tax awareness for transitions; no tax-aware optimizer. | partial-engine |
| Kwanti | Portfolio comparison and investment analytics Backtest comparison over four ETFs; no fund database. | partial-engine |
| Pontera | Advisor management of held-away retirement accounts Drift on supplied held-away allocations; no account access. | partial-engine |
| BNY Pershing Wove | Connected wealth-management workflows Connected workflow guidance only. | guidance |
| InvestCloud | Digital wealth experiences and investment workflows Client digital experience is out of scope. | guidance |
| SimCorp Axioma portfolio optimization | Constrained portfolio optimization and risk analytics No optimizer; G001-G007 are open-source options. | guidance |
| BCBS 239 | Risk-data aggregation and reporting principles Risk-data principles; guidance only. | standard-reference |
| PyPortfolioOpt | Efficient-frontier, Black-Litterman and hierarchical allocation Optional optimization library; the packs do not optimize. | integration-reference |
| Riskfolio-Lib | Portfolio optimization across risk measures Optional optimization library; the packs do not optimize. | integration-reference |
| cvxportfolio | Convex portfolio optimization with trading costs Optional optimization library; the packs do not optimize. | integration-reference |
| skfolio | Portfolio optimization with estimator-style workflows Optional optimization library; the packs do not optimize. | integration-reference |
| CVXPY | Convex modeling for custom allocation constraints Optional optimization library; the packs do not optimize. | integration-reference |
| PortfolioAnalytics | R portfolio optimization and constraint modeling Optional optimization library; the packs do not optimize. | integration-reference |
| RiskPortfolios | Risk-based portfolio allocation in R Optional optimization library; the packs do not optimize. | integration-reference |
| GS Quant | Quantitative finance analytics and data clients Optional quantitative or risk analytics library. | integration-reference |
| DeepDow | Deep-learning portfolio allocation Deep-learning allocation research code. | integration-reference |
| TensorFlow Quant Finance | TensorFlow numerical-finance library Optional quantitative or risk analytics library. | integration-reference |
| OpenGamma Strata | Market-risk and derivatives analytics Optional quantitative or risk analytics library. | integration-reference |
| Open Source Risk Engine | Portfolio risk and valuation infrastructure Optional quantitative or risk analytics library. | integration-reference |
| finmath-lib | Mathematical finance and simulation Optional quantitative or risk analytics library. | integration-reference |
| rateslib | Fixed-income curves and instrument analytics Fixed-income curves; duration here comes from supplied values. | integration-reference |
| FinancePy | Instrument pricing and financial analytics Optional quantitative or risk analytics library. | integration-reference |
| bond_pricing | Bond prices, yields and duration Bond duration source for the durationYears input. | integration-reference |
| LEAN | Event-driven research, backtesting and trading Backtesting beyond the four embedded ETFs. | integration-reference |
| NautilusTrader | Trading-system simulation and live adapters Backtesting beyond the four embedded ETFs. | integration-reference |
| Backtrader | Python strategy backtesting Backtesting beyond the four embedded ETFs. | integration-reference |
| Zipline Reloaded | Event-driven strategy backtesting Backtesting beyond the four embedded ETFs. | integration-reference |
| vectorbt | Vectorized strategy exploration Backtesting beyond the four embedded ETFs. | integration-reference |
| backtesting.py | Strategy simulation and parameter exploration Backtesting beyond the four embedded ETFs. | integration-reference |
| bt | Portfolio-oriented backtesting Backtesting beyond the four embedded ETFs. | integration-reference |
| QSTrader | Systematic portfolio backtesting Backtesting beyond the four embedded ETFs. | integration-reference |
| Lumibot | Strategy backtesting and broker execution Backtesting beyond the four embedded ETFs. | integration-reference |
| RQAlpha | Extensible backtesting engine; adapt market conventions Backtesting beyond the four embedded ETFs. | integration-reference |
| Alphalens | Predictive-factor performance analysis Factor performance analysis. | integration-reference |
| PerformanceAnalytics | R performance and risk analysis Performance and risk statistics. | integration-reference |
| quantstats | Strategy-performance statistics and reports Performance and risk statistics. | integration-reference |
| empyrical-reloaded | Common portfolio risk and return metrics Performance and risk statistics. | integration-reference |
| pyfolio-reloaded | Portfolio performance tear sheets Performance and risk statistics. | integration-reference |
| ffn | Financial performance and portfolio statistics Performance and risk statistics. | integration-reference |
| arch | Volatility modeling and financial econometrics Volatility modelling for the VaR volatility input. | integration-reference |
| Portfolio Performance | Personal portfolio performance measurement Personal performance tracking. | integration-reference |
| Ghostfolio | Personal investment tracking and analysis Personal investment tracking. | integration-reference |
| Portfolio Selection (Markowitz, 1952) | Mean-variance diversification foundation Portfolio variance as weights-covariance-weights, used by the forward simulation. | research-reference |
| Capital Asset Prices (Sharpe, 1964) | Equilibrium risk and expected returns Portfolio construction research; no optimizer. | research-reference |
| Liquidity Preference as Behavior Towards Risk (Tobin, 1958) | Risky allocation and cash separation Portfolio construction research; no optimizer. | research-reference |
| Lifetime Portfolio Selection under Uncertainty (Merton, 1969) | Dynamic consumption and portfolio choice Portfolio construction research; no optimizer. | research-reference |
| Optimum Consumption and Portfolio Rules (Merton, 1971) | Continuous-time lifetime allocation Portfolio construction research; no optimizer. | research-reference |
| Global Portfolio Optimization (Black and Litterman, 1992) | Combine equilibrium returns and investor views Portfolio construction research; no optimizer. | research-reference |
| Optimal Versus Naive Diversification (DeMiguel et al., 2009) | Evaluate estimation error against equal weighting Portfolio construction research; no optimizer. | research-reference |
| Risk Reduction in Large Portfolios (Jagannathan and Ma, 2003) | Understand constraint-driven risk reduction Portfolio construction research; no optimizer. | research-reference |
| A Well-Conditioned Estimator for Large-Dimensional Covariance Matrices (Ledoit and Wolf, 2004) | Covariance shrinkage for portfolio risk Portfolio construction research; no optimizer. | research-reference |
| Building Diversified Portfolios that Outperform Out of Sample (Lopez de Prado, 2016) | Hierarchical portfolio construction research Portfolio construction research; no optimizer. | research-reference |
| Common Risk Factors in the Returns on Stocks and Bonds (Fama and French, 1993) | Equity and bond factor modeling Factor model research; exposures here come from supplied scores. | research-reference |
| A Five-Factor Asset Pricing Model (Fama and French, 2015) | Profitability and investment factors Factor model research; exposures here come from supplied scores. | research-reference |
| On Persistence in Mutual Fund Performance (Carhart, 1997) | Performance persistence and factor adjustment Factor and anomaly research. | research-reference |
| Returns to Buying Winners and Selling Losers (Jegadeesh and Titman, 1993) | Cross-sectional momentum evidence Factor and anomaly research. | research-reference |
| The Other Side of Value (Novy-Marx, 2013) | Profitability and stock returns Factor and anomaly research. | research-reference |
| Value and Momentum Everywhere (Asness et al., 2013) | Cross-asset value and momentum research Factor and anomaly research. | research-reference |
| Betting Against Beta (Frazzini and Pedersen, 2014) | Leverage constraints and low-beta investing Factor and anomaly research. | research-reference |
| Time Series Momentum (Moskowitz et al., 2012) | Trend-following evidence across assets Factor and anomaly research. | research-reference |
| Digesting Anomalies (Hou et al., 2015) | Investment-based factor explanation Factor and anomaly research. | research-reference |
| ... and the Cross-Section of Expected Returns (Harvey et al., 2016) | Multiple-testing concerns in factor discovery Factor and anomaly research. | research-reference |
| Coherent Measures of Risk (Artzner et al., 1999) | Axioms for portfolio risk measures Expected shortfall is a coherent risk measure; VaR is not. | research-reference |
| Optimization of Conditional Value-at-Risk (Rockafellar and Uryasev, 2000) | Tail-risk optimization CVaR is computed, not optimized. | research-reference |
| Autoregressive Conditional Heteroscedasticity (Engle, 1982) | Time-varying conditional volatility Conditional volatility models; VaR here takes a supplied volatility. | research-reference |
| Generalized Autoregressive Conditional Heteroskedasticity (Bollerslev, 1986) | GARCH volatility dynamics Conditional volatility models; VaR here takes a supplied volatility. | research-reference |
| Tax-Aware Portfolio Construction via Convex Optimization | Optimization with tax-sensitive trade decisions Tax-aware optimization; harvesting here is rule-based. | research-reference |
| Multi-Period Trading via Convex Optimization | Receding-horizon portfolio construction Multi-period optimization with trading costs; no optimizer. | research-reference |
| Portfolio Optimization with Linear and Fixed Transaction Costs | Rebalancing with realistic trading constraints Multi-period optimization with trading costs; no optimizer. | research-reference |
| A Reality Check for Data Snooping (White, 2000) | Correct for strategy selection bias Data-snooping and overfitting tests; not implemented. | research-reference |
| A Test for Superior Predictive Ability (Hansen, 2005) | Compare forecasting models under selection Data-snooping and overfitting tests; not implemented. | research-reference |
| The Probability of Backtest Overfitting (Bailey et al., 2017) | Assess overfitting from strategy searches Data-snooping and overfitting tests; not implemented. | research-reference |
Questions it answers
Is the portfolio off target?
Allocation drift against targets, with the trades that would correct it. Run portfolio drift-monitor in the CLI, or call the same tool over MCP. It needs current, target and value. Drift is measured against the targets sleeve by sleeve. The result carries the method it used, the data it used, anything still missing and the next steps worth taking, for a licensed professional to review.
What trades bring this back to target?
Trades that move a portfolio from its current allocation to target. Run portfolio rebalance in the CLI, or call the same tool over MCP. It needs current, target and value. Trades are the difference from target. The result carries the method it used, the data it used, anything still missing and the next steps worth taking, for a licensed professional to review.
How much could this portfolio lose?
Parametric Value at Risk and expected shortfall. Run portfolio var in the CLI, or call the same tool over MCP. It needs value and vol. Risk is reported in dollars against it. The result carries the method it used, the data it used, anything still missing and the next steps worth taking, for a licensed professional to review.
What is this portfolio made of?
Asset-class mix, with factor and duration averages of values you supply. Run portfolio factors in the CLI, or call the same tool over MCP. It needs holdings. Every figure is a weighted average across them. The result carries the method it used, the data it used, anything still missing and the next steps worth taking, for a licensed professional to review.
Any losses to harvest?
Tax-loss harvesting screen with a wash-sale look-back and replacement candidates. Run portfolio tlh in the CLI, or call the same tool over MCP. It needs lots. Losses and the wash-sale window are computed per lot. The result carries the method it used, the data it used, anything still missing and the next steps worth taking, for a licensed professional to review.
How would this mix have done?
Historical backtest over embedded annual returns for VTI, BND, VXUS and VNQ. Run quant backtest in the CLI, or call the same tool over MCP. It needs weights. Only those four have embedded return data. The result carries the method it used, the data it used, anything still missing and the next steps worth taking, for a licensed professional to review.
The other skill packs
- Compliance: Automated screen of advisory communications for promissory language and missing standard disclosures, FINRA 2111 suitability and Marketing Rule performance checks, investment adviser registration lookups in SEC IAPD compilation files, and guidance for supervisory review.
- CRM: Meeting transcript parsing into decisions and action items, and CRM task payload construction, plus guidance for meeting preparation.
- Execution: Pre-trade validation (buying power, oversell, short-term gain), order payload construction for Alpaca, Interactive Brokers and FIX 4.4, ISIN/CUSIP/FIGI/LEI check digits and T+1 settlement dates, for human-approved execution.
- Fund operations: Fund administration and wealth operations checks - position reconciliation against the custodian, NAV tie-out with level 3 and stale-price flags, LP capital statement roll-forwards, and month-end close tracking - plus guidance for accounting and regulatory reporting that the engines do not perform..
- Onboarding: Customer Identification Program field checks, application gaps by account type (CIP, beneficial ownership, FINRA 4512, 2090, 2111 and 2165), and onboarding milestone tracking.
- Planning: US retirement and tax planning calculations - tax year 2026 bracket headroom for sizing Roth conversions, required minimum distributions, retirement Monte Carlo with inflation-adjusted withdrawals, capital-loss netting and carryover, and net investment income tax - plus guidance for broader household planning that the engines do not model..
- Research: Valuation ratios from supplied fundamentals, DCF valuation with sensitivity, keyword risk-factor summaries of filing text, XBRL fact extraction, and live FRED and SEC EDGAR fetches, plus guidance for earnings and market research that the engines do not perform..
- UHNW: Concentrated-stock collar construction with constructive-sale review, and private equity multiple tracking (TVPI, DPI, RVPI), plus guidance for trust, philanthropic and exchange-fund planning that the engines do not model..