fixed-income-structured — Claude Code skill for MBS, ABS and CLO
A skill for structured fixed income: CMO tranches, prepayment speeds, waterfall mechanics. Useful when you need to size risk on MBS or CLO paper.
npx skills add JoelLewis/finance_skills --skill fixed-income-structured -a claude-codeWhat fixed-income-structured does
The skill hands your agent a reference on structured fixed income products. It covers MBS pass-throughs, where principal, interest and prepayments from a mortgage pool flow to investors pro rata, and notes that agency paper from Ginnie Mae, Fannie Mae and Freddie Mac carries a guarantee against credit losses, so prepayment stays the main concern. Non-agency MBS have no such guarantee and carry both credit and prepayment risk.
Prepayment risk gets both faces spelled out: contraction risk when rates fall and principal comes back early, extension risk when rates rise and you sit in a below-market coupon longer than planned. The PSA model is there with its linear ramp from 0% CPR to 6% CPR over the first 30 months and the plateau after, plus the CPR-to-SMM conversion and the WAL formula. On CMO tranches you get sequential pay, PAC with a predictable schedule inside a speed band, and the support tranches that absorb the variability. On CLOs: subordination, OC and IC tests that divert cash flow to senior tranches when the portfolio sours.
For valuation the skill insists on effective duration or OAS rather than modified duration, since cash flows move with rates. That is the practical takeaway: run modified duration on an MBS and you get a wrong number. A formula table and worked examples sit at the bottom, including a 150% PSA to CPR and SMM conversion for month 20 and a subordination calculation for an AAA tranche.
What it helps with
- convert a PSA speed into CPR and SMM
- map a CLO waterfall across tranches by seniority
- work out subordination below an AAA tranche
- explain negative convexity in mortgage paper
- pick effective duration over modified for MBS
Example prompts for the agent
- Convert 150% PSA to CPR and SMM for month 20
- Walk me through this CLO waterfall and show the AAA subordination
- Why can't I use modified duration on this agency MBS?
How to install fixed-income-structured
1Skills CLI (Vercel)
npx skills add JoelLewis/finance_skills --skill fixed-income-structured -a claude-code2Manually: put the files in place
~/.claude/skills/fixed-income-structured/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/fixed-income-structured/
1Skills CLI (Vercel)
npx skills add JoelLewis/finance_skills --skill fixed-income-structured -a codex2Manually: put the files in place
.agents/skills/fixed-income-structured/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add JoelLewis/finance_skills --skill fixed-income-structured -a cursor2Manually: put the files in place
.cursor/skills/fixed-income-structured/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install JoelLewis/finance_skills fixed-income-structured2Manually: put the files in place
.github/skills/fixed-income-structured/SKILL.md1Skills CLI (Vercel)
npx skills add JoelLewis/finance_skills --skill fixed-income-structured -a gemini-cli2Platform CLI
gemini skills install https://github.com/JoelLewis/finance_skills --path plugins/wealth-management/skills/fixed-income-structuredManually: put the files in place
.devin/skills/fixed-income-structured/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add JoelLewis/finance_skills --skill fixed-income-structured -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about fixed-income-structured
How do I install fixed-income-structured in Claude?
Run npx skills add JoelLewis/finance_skills --skill fixed-income-structured -a claude-code. The skill file lands at ~/.claude/skills/fixed-income-structured/SKILL.md.
What does fixed-income-structured do?
It analyzes structured fixed income: MBS, ABS and CLOs. It computes prepayment speeds, WAL and tranche subordination, and explains waterfall mechanics.
How is it different from fixed-income-sovereign and fixed-income-corporate?
It cross-references both: sovereign covers the Treasury curve plus duration and convexity, corporate covers credit spreads for non-agency MBS and CLOs. This skill handles tranching and prepayment.
Source text
SKILL.md · MIT
--- name: fixed-income-structured description: "Analyze structured fixed income products including mortgage-backed securities, asset-backed securities, and CLOs. Use when the user asks about MBS, ABS, CLOs, CDOs, prepayment risk, tranching, or waterfall structures. Also trigger when users mention 'mortgage bonds', 'agency MBS', 'pass-through securities', 'PSA prepayment speed', 'negative convexity', 'extension risk', 'contraction risk', 'CMO tranches', 'securitization', or ask how structured products redistribute credit and prepayment risk." --- # Fixed Income — Structured Products ## Core Concepts ### MBS Pass-Throughs A pool of mortgages whose cash flows (principal, interest, prepayments) are passed through to investors on a pro-rata basis. Agency MBS (Ginnie Mae, Fannie Mae, Freddie Mac) carry a government or GSE guarantee against credit losses, isolating prepayment risk as the primary concern. Non-agency MBS lack this guarantee and carry both credit and prepayment risk. ### Prepayment Risk Borrowers can refinance when rates drop, returning principal early. This creates negative convexity — when rates fall, MBS prices rise less than comparable Treasuries because prepayments accelerate and shorten the bond's effective life. Prepayment risk has two faces: **Contraction risk:** Rates fall, prepayments accelerate, duration shortens. Investors receive principal back when reinvestment rates are lower. **Extension risk:** Rates rise, prepayments slow, duration extends. Investors are locked into below-market coupons for longer than expected. ### PSA Prepayment Model The Public Securities Association model provides a benchmark prepayment speed: 100% PSA = ramp from 0% CPR to 6% CPR linearly over the first 30 months, then constant at 6% CPR thereafter. At 150% PSA, all speeds are multiplied by 1.5 (e.g., the plateau is 9% CPR). At 200% PSA, the plateau is 12% CPR. ### CPR and SMM **CPR (Conditional Prepayment Rate):** Annualized prepayment rate as a percentage of the remaining pool balance. **SMM (Single Monthly Mortality):** Monthly prepayment rate. SMM = 1 - (1 - CPR)^(1/12) ### Weighted Average Life (WAL) WAL = sum(t × Principal_t) / Total Principal. Unlike maturity, WAL accounts for the timing of principal repayments (both scheduled and prepayments). WAL is shorter than maturity for amortizing securities and is sensitive to prepayment assumptions. ### CMO Tranches Collateralized Mortgage Obligations redistribute MBS cash flows into tranches with different risk profiles: **Sequential pay:** Principal flows to the first tranche until retired, then the second, etc. Earlier tranches have shorter duration, later tranches have longer duration. **PAC (Planned Amortization Class):** Provides a predictable principal schedule within a band of prepayment speeds (e.g., 100-250% PSA). Stability comes at the expense of companion/support tranches that absorb prepayment variability. **Support/Companion tranches:** Absorb excess or deficit prepayments to protect PAC tranches. Highly volatile duration. ### ABS (Asset-Backed Securities) Securitized pools of non-mortgage assets: - Auto loans: amortizing, relatively predictable cash flows - Credit cards: revolving, with a revolving period followed by a controlled amortization period - Student loans: longer duration, income-driven repayment creates uncertainty ### CLOs (Collateralized Loan Obligations) Tranched portfolios of leveraged loans (typically 150-250 loans). AAA tranches benefit from significant subordination (30-40% of the structure below them). Equity tranches receive residual cash flows after all senior tranches are paid. Waterfall tests (overcollateralization and interest coverage tests) redirect cash flows to protect senior tranches when the portfolio deteriorates. ### Waterfall Structure Cash flows are distributed by seniority: senior tranches receive interest and principal first, mezzanine next, equity last. If pool performance deteriorates, lower tranches absorb losses first (subordination protects senior tranches). Overcollateralization (OC) tests and interest coverage (IC) tests trigger cash flow diversions when breached. ### OAS for Structured Products OAS is essential for MBS because it captures prepayment optionality. Standard modified duration is inappropriate for MBS — use effective duration (computed via OAS models) or empirical duration. Monte Carlo simulation of interest rate paths and corresponding prepayment responses is the standard valuation approach for MBS. ## Key Formulas | Formula | Expression | Use Case | |---------|-----------|----------| | SMM from CPR | SMM = 1 - (1-CPR)^(1/12) | Monthly prepayment rate | | CPR from SMM | CPR = 1 - (1-SMM)^12 | Annualize monthly rate | | PSA CPR (month t, t<=30) | CPR = 6% × (t/30) × PSA/100 | Ramping prepayment model | | PSA CPR (month t, t>30) | CPR = 6% × PSA/100 | Plateau prepayment model | | WAL | sum(t × Principal_t) / Total Principal | Average principal timing | | OAS Price | P = E[sum CF_t(path) / (1+s_t+OAS)^t] | MBS valuation | ## Worked Examples ### Example 1: Convert PSA to CPR **Given:** 150% PSA, month 20 **Calculate:** CPR and SMM in month 20 **Solution:** At 100% PSA, month 20: CPR = 6% × (20/30) = 4.0% At 150% PSA: CPR = 4.0% × 1.5 = 6.0% SMM = 1 - (1 - 0.06)^(1/12) = 1 - (0.94)^(0.0833) = 1 - 0.99486 = 0.00514 = 0.514% In month 20 at 150% PSA, approximately 0.514% of the remaining pool balance prepays each month, equivalent to 6.0% annualized. ### Example 2: CLO Tranche Analysis **Given:** A CLO with $500M total assets. AAA tranche = $325M (65%), AA = $50M (10%), A = $37.5M (7.5%), BBB = $25M (5%), BB = $12.5M (2.5%), Equity = $50M (10%). **Calculate:** Subordination level for the AAA tranche **Solution:** Subordination below AAA = AA + A + BBB + BB + Equity = $50M + $37.5M + $25M + $12.5M + $50M = $175M Subordination % = $175M / $500M = 35% The AAA tranche has 35% subordination — the portfolio would need to lose more than 35% of its value before AAA investors suffer any principal loss. This substantial credit enhancement is why CLO AAA tranches have historically experienced zero defaults. ## Common Pitfalls - Ignoring negative convexity of MBS — MBS underperform Treasuries in both rallies (contraction) and selloffs (extension) - Using modified duration for MBS — use effective/OAS duration instead, as cash flows change with rates - Assuming constant prepayment speeds — speeds vary with rates, seasonality, borrower demographics, and housing turnover - Not understanding that waterfall mechanics affect tranche risk differently — senior and subordinate tranches of the same deal have very different risk profiles ## Cross-References - **fixed-income-sovereign** (wealth-management plugin): the Treasury curve and duration/convexity concepts - **fixed-income-corporate** (wealth-management plugin): credit spread concepts applied to non-agency MBS and CLOs - **real-assets** (wealth-management plugin): real estate market fundamentals underlying MBS - **asset-allocation** (wealth-management plugin): structured products in multi-asset portfolios ## Running the Script ```bash uv run scripts/fixed_income_structured.py # run the demo (uses PEP 723 inline deps) uv run scripts/fixed_income_structured.py --verify # check demo outputs against the worked examples (exit 1 on mismatch) python3 scripts/fixed_income_structured.py # alternative (requires: pip install numpy) ``` The demo prints the calculations covered above; its values match the worked examples in this skill. Run `--help` for a list of the classes and functions. For programmatic use, import the module rather than running it — the demo only executes under `python fixed_income_structured.py`.
© JoelLewis · MIT · JoelLewis/finance_skills