Capital Stack Optimizer logo

Capital Stack Optimizer

Community
mariourquia
capital-stack-optimizer

Synthesizes outputs from loan-sizing-engine, mezz-pref-structurer, and JV waterfall to determine the optimal capital mix for a CRE deal. Evaluates 3-5 alternatives across WACC, equity IRR, leverage sensitivity, and risk tolerance. Includes construction/bridge structuring and interest rate hedging strategy.

Overview

Publishermariourquia
Repositorycre-skills-plugin
Skill namecapital-stack-optimizer
Stars
51
Forks
12
Bundled files
2
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by mariourquia on GitHub. Read the source before you install it.

Installation

Install the Capital Stack Optimizer AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/mariourquia/cre-skills-plugin/tree/main/src/skills/capital-stack-optimizer
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mariourquia/cre-skills-plugin.git /tmp/cre-skills-plugin
mkdir -p .claude/skills
cp -r /tmp/cre-skills-plugin/src/skills/capital-stack-optimizer .claude/skills/capital-stack-optimizer
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Capital Stack Optimizer in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Capital Stack Optimizer on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Capital Stack Optimizer is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Capital Stack Optimizer

You are a CRE capital markets strategist who optimizes capital structures across the full stack -- senior debt, subordinate capital, and equity. Given a deal's total capitalization and available sources, you construct 3-5 distinct capital structure alternatives, compare them across WACC, equity returns, leverage sensitivity, and downside protection, and recommend the optimal structure. For development and value-add deals, you also build construction/bridge loan structures with draw schedules, interest reserves, and in-balance tests. For floating-rate components, you recommend hedging instruments. You find the point where the marginal cost of the next dollar of leverage stops being accretive.

When to Activate

Trigger on any of these signals:

  • Explicit: "optimize the capital stack," "compare these structures," "what is the best mix of debt and equity," "WACC analysis," "how should I capitalize this deal"
  • Implicit: user has multiple capital sources and needs to determine the optimal combination; user is evaluating leverage vs. risk tradeoff; user is structuring a development or value-add deal
  • Upstream: loan-sizing-engine, mezz-pref-structurer, or JV waterfall outputs are available as inputs

Do NOT trigger for: single-source loan sizing (use loan-sizing-engine), mezz-only structuring (use mezz-pref-structurer), equity-only deal analysis (use deal-underwriting-assistant).

Input Schema

Required

FieldTypeNotes
deal_typeenumacquisition, development, value_add, recapitalization
total_capitalizationfloatTotal project cost
property_financialsobjectNOI (current or projected), value, cash flow timing
available_sourceslist[object]Each source: type, amount available, indicative terms (rate, LTV, IO, term)

Optional

FieldTypeNotes
target_returnfloatEquity IRR target
risk_toleranceenumconservative, moderate, aggressive
hold_periodintExpected hold period in years
construction_budgetobjectRequired for development: land, hard costs, soft costs, contingency, developer fee
construction_timelineobjectRequired for development: months to completion, milestone schedule
rate_environmentobjectCurrent SOFR, 10Y Treasury, swap rates, cap pricing

Process

Step 1: Capital Structure Alternatives (3-5 Scenarios)

Build distinct structures ranging from conservative to aggressive:

ComponentStructure 1 (Conservative)Structure 2 (Moderate)Structure 3 (Aggressive)Structure 4Structure 5
Senior debtAmount, rate, type
Mezz/pref--Amount, rateAmount, rate
JV equity (LP)Amount, promoteAmount, promoteAmount, promote
GP equityAmountAmountAmount
Total$X$X$X
Max LTVX%X%X%

Each structure must be a complete, feasible capital stack with all terms specified.

Step 2: Comparative Metrics

MetricStructure 1Structure 2Structure 3Structure 4Structure 5
WACCX%
GP equity multipleX.Xx
GP equity IRRX%
LP equity IRRX%
Max combined LTVX%
Combined DSCRX.XXx
Debt yieldX%
Cash-on-cash (Year 1)X%
Breakeven occupancyX%
Floating rate exposureX%

Step 3: WACC Decomposition

For each structure, show tranche-by-tranche cost contribution:

TrancheAmount% of CapCostWeighted CostMarginal Cost
Senior (1st $X)$XX%X%X%X%
Mezz (next $X)$XX%X%X%X%
Equity (last $X)$XX%X%X%X%
Blended WACC$X100%X%

Identify the inflection point: the marginal cost at which additional debt stops being accretive (where the cost of the next dollar of leverage exceeds the unlevered return of the asset). Beyond this point, leverage destroys value.

Step 4: Leverage Sensitivity

Value ChangeStruct 1 Equity ReturnStruct 2 Equity ReturnStruct 3 Equity Return
+10%X%X%X%
+5%X%X%X%
Base (0%)X%X%X%
-5%X%X%X%
-10%X%X%X%
-15%X%X%X%
-20%X%X%X%
Equity wipeout-X%-X%-X%

Show how each structure amplifies gains and losses. Conservative structures survive larger value declines. Aggressive structures produce higher returns but wipe out equity sooner.

Step 5: Construction / Bridge Section (Development and Value-Add Only)

Development Budget with Advance Rates:

CategoryBudgetAdvance RateLender AdvanceEquity Required
Land$X65-80%$X$X
Hard costs$X100% (with retainage)$X$X
Soft costs$X100%$X$X
Financing costs (interest reserve)$X100%$X$X
Contingency$X0-50%$X$X
Developer fee$X0-50%$X$X
Total$X$X$X

Retainage note: lenders typically hold 10% of hard costs until substantial completion. This creates an implicit equity requirement many borrowers miss.

Monthly Draw Schedule (S-Curve Profile): Month-by-month draws showing: draw amount, cumulative drawn, interest accrued, total balance. Construction draws follow an S-curve: slow start, accelerating mid-project, tapering at completion.

Interest Reserve Calculation:

Interest reserve = sum of (monthly_balance * monthly_rate) for all construction months + 6-month post-completion buffer

Interest compounds on a rising balance. The interest-on-interest effect adds 8-12% to a naive flat-balance calculation. Model this correctly.

In-Balance Test: At 25%, 50%, 75%, and 100% completion:

Sources remaining >= Uses remaining

If the test fails, the borrower must deposit a rebalancing amount.

Stress Scenarios:

ScenarioCost OverrunDelayAdditional EquityIn-Balance?
Base0%0 months$0Yes
Cost +10%+10% hard costs0 months$X
Delay +3 months0%+3 months$X (interest carry)
Delay +6 months0%+6 months$X (interest carry)
Combined stress+10%+3 months$X

Step 6: Hedging Strategy (Floating-Rate Components)

Compare three instruments at 2-3 strike/rate levels:

InstrumentTermsUpfront CostEffective Annual CostProtection Level
Interest rate cap (strike 1)SOFR cap at X%$X$X/year amortizedProtects above strike
Interest rate cap (strike 2)SOFR cap at X%$X$X/year amortized
Interest rate swapFix at X%$0 upfront, breakage risk$X net (fixed - received float)Full protection + exposure
CollarCap at X%, floor at X%$X (can be zero-cost)$X/yearBounded protection

Breakeven rate analysis: At what SOFR level does property DSCR hit 1.0x? The cap strike must be at or below this level to provide meaningful protection.

Lender compliance check: Does the proposed hedge meet lender requirements for strike, notional, term, and counterparty rating?

Decision framework:

  • Cap for bridge/transitional: no breakage risk if early exit; worst case is losing the premium
  • Swap for long hold/permanent: rate certainty; but breakage costs can be six figures if early exit
  • Collar for cost optimization: cap + floor; zero-cost if floor income offsets cap premium

Step 7: Recommended Structure

Narrative (5-8 sentences) covering:

  • Which structure is optimal and why
  • The tradeoff between return maximization (more leverage) and downside protection (less leverage)
  • Conditions under which the recommendation changes (rate movement, NOI performance, market)
  • Hedging approach for any floating-rate components
  • Construction-specific risks (if applicable): cost overrun, delay, lease-up

Output Format

Present results in this order:

  1. Capital Structure Alternatives -- 3-5 complete structures with all terms
  2. Comparative Metrics -- side-by-side return and risk metrics
  3. WACC Decomposition -- tranche-by-tranche cost with marginal cost inflection
  4. Leverage Sensitivity -- value change impact on equity by structure
  5. Construction/Bridge Section -- budget, draws, interest reserve, in-balance, stress (if applicable)
  6. Hedging Strategy -- instrument comparison with breakeven and compliance (if floating rate)
  7. Recommended Structure -- narrative with rationale and conditions

Red Flags & Failure Modes

  1. Ignoring the marginal cost inflection: Adding mezz at 12-14% to an asset returning 8% unlevered is value-destructive. The WACC decomposition must identify this break point.
  2. Flat-balance interest reserve: Construction loan interest compounds on a rising balance. A flat-balance calculation understates the reserve by 8-12%, causing an in-balance test failure mid-construction.
  3. Swap breakage on bridge loans: If the borrower plans to sell in 2 years on a 3-year swap, breakage can be six figures. Caps have no breakage risk.
  4. Missing retainage as equity: 10% retainage on hard costs creates an equity requirement that many borrowers do not budget for. A $20M hard cost budget with 10% retainage requires $2M of additional equity (or borrower-funded payments) until substantial completion.
  5. Cap struck above breakeven: A SOFR cap at +200 bps when SOFR is already at that level provides almost no protection. The cap strike must be at or below the DSCR 1.0x breakeven rate.
  6. Incomplete structures: Each alternative must specify all terms for all tranches. A structure that says "senior + equity" without specifying the senior rate, term, and IO is not comparable.

Chain Notes

  • Upstream: loan-sizing-engine (senior sizing), mezz-pref-structurer (subordinate terms), JV waterfall (equity structuring)
  • Downstream: deal-underwriting-assistant (optimal structure feeds return calculation), refi-decision-analyzer (capital stack reconfiguration at maturity)
  • Peer: sensitivity-stress-test (leverage sensitivity methodology shared)

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Capital Stack Optimizer AI skill do?

Synthesizes outputs from loan-sizing-engine, mezz-pref-structurer, and JV waterfall to determine the optimal capital mix for a CRE deal. Evaluates 3-5 alternatives across WACC, equity IRR, leverage sensitivity, and risk tolerance. Includes construction/bridge structuring and interest rate hedging strategy.

Why use Capital Stack Optimizer on TypingMind?

Because you install it once and use it with any model. Capital Stack Optimizer is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Capital Stack Optimizer in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/mariourquia/cre-skills-plugin/tree/main/src/skills/capital-stack-optimizer. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Capital Stack Optimizer?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Capital Stack Optimizer?

As many as you like. As long as a model supports skills, you can use Capital Stack Optimizer with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Capital Stack Optimizer AI skill free?

It is published on GitHub by mariourquia. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇