Emergency fund

From JoelLewis/finance_skills · View interactive version

Emergency fund is an AI agent skill from the GitHub repository JoelLewis/finance_skills. Size and structure an emergency fund based on individual circumstances, income stability, and expense profile. Use when the user asks about emergency fund sizing, how many months of expenses to save, where to keep emergency savings, or tiered fund structures. Also trigger when users mention 'rainy d

How to use this skill

Skill file

Emergency Fund Planning

Core Concepts

Rule of Thumb

Essential Expenses

The emergency fund should cover non-discretionary spending only:

Expense-Based Sizing

Monthly essential expenses multiplied by the desired months of coverage:

Income Replacement Approach

After-tax monthly income multiplied by months of coverage:

Variable Income Adjustment

For commission-based, freelance, seasonal, or gig workers:

Tiered Emergency Fund

Structure the fund across tiers for optimal balance of access and yield:

Vehicle Selection

| Vehicle | Yield | Liquidity | FDIC/SIPC | Best For |

|---------|-------|-----------|-----------|----------|

| Checking account | Very low | Instant | FDIC | Tier 1 (1 month) |

| HYSA | Moderate | 1-2 days | FDIC | Tier 2 (core fund) |

| Money market fund | Moderate | 1-2 days | SIPC | Tier 2 (core fund) |

| T-bills (4-week) | Moderate-high | At maturity | Full faith & credit | Tier 2/3 (ladder) |

| CD (3-12 month) | Moderate-high | At maturity (penalty) | FDIC | Tier 3 (ladder) |

| I-bonds | Inflation-linked | After 12 months | Full faith & credit | Tier 3 (long-term) |

| Short-term bond fund | Variable | 1-3 days | SIPC | Tier 3 (flexible) |

Opportunity Cost

Holding cash has a real cost — the difference between what the cash earns and what it could earn if invested:

When to Tap the Emergency Fund

Appropriate uses:

NOT appropriate uses:

Replenishment Plan

After using the emergency fund:

Key Formulas

| Formula | Expression | Use Case |

|---------|-----------|----------|

| Expense-based fund | Monthly essentials × months of coverage | Core sizing calculation |

| Income-based fund | After-tax monthly income × months of coverage | Upper bound estimate |

| Opportunity cost | Fund balance × (investment return - cash return) | Cost of holding cash |

| Replenishment timeline | Fund shortfall / monthly replenishment amount | Months to rebuild |

| Variable income buffer | Avg monthly income - base budget | Surplus for smoothing |

Worked Examples

Example 1: Emergency fund sizing for a dual-income household

Given: Married couple, both employed in stable jobs. Monthly essential expenses: $4,500 (housing $1,800, food $600, insurance $400, utilities $300, transportation $500, debt minimums $400, healthcare $200, other essentials $300).

Calculate: Recommended emergency fund size.

Solution:

  1. Dual income, stable employment: 3 months is the baseline; 4 months provides a comfortable margin.
  2. Emergency fund = $4,500 × 3 = $13,500 (minimum) to $4,500 × 4 = $18,000 (recommended).
  3. Considerations: If either spouse works in a cyclical industry or has less job security, increase to 6 months ($27,000).
  4. If one spouse could cover essentials alone: May reduce to 3 months since the risk of zero income is lower.
  5. Recommendation: $13,500-$18,000 for this stable dual-income household.

Example 2: Tiered fund allocation

Given: Target emergency fund of $27,000 (6 months × $4,500/month) for a single-income household.

Calculate: Optimal tiered allocation.

Solution:

  1. Tier 1 — Checking account: $4,500 (1 month). Immediate access for sudden expenses (car repair, medical co-pay). Earning ~0.01% but provides instant liquidity.
  2. Tier 2 — High-yield savings account: $13,500 (3 months). Core emergency reserves. Earning ~4.5% APY (illustrative, in the ~4-5% range seen as of 2026 — check current HYSA rates). Available in 1-2 business days via transfer.
  3. Tier 3 — T-bill ladder: $9,000 (2 months). Three $3,000 T-bills maturing at 4-week, 8-week, and 13-week intervals. Earning ~4.8% (illustrative, in the ~4-5% range seen as of 2026 — check current T-bill rates). At least one tranche matures every ~4 weeks.
  4. Blended yield: (4,500 × 0.01% + 13,500 × 4.5% + 9,000 × 4.8%) / 27,000 ≈ 3.85% weighted average.
  5. vs all checking (0.01%): Earning ~$1,040/year more with the tiered approach — effectively free money for modest complexity.

Common Pitfalls

Cross-References

Running the Script

uv run scripts/emergency_fund.py            # run the demo (uses PEP 723 inline deps)
uv run scripts/emergency_fund.py --verify   # check demo outputs against the worked examples (exit 1 on mismatch)
python3 scripts/emergency_fund.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 emergency_fund.py.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.