---
name: "credit_analysis"
description: "Analyzes borrower creditworthiness: computes credit ratios and Altman Z-score, reviews covenants, assesses default risk, and produces a structured credit memo for loan committee review."
---

# Credit Analysis

## Purpose

Run a complete borrower credit workup: quantitative ratio and distress screening, the 5 Cs qualitative review, covenant compliance analysis, regulatory risk rating, and a structured credit memo with a clear recommendation (approve / approve with conditions / decline).

Trigger phrases: "analyze this borrower's credit", "write a credit memo", "assess default risk", "review these covenants", "credit underwriting package".

## Workflow

### 1. Gather inputs
Collect period-consistent financials before any analysis. Required set:
- Income statement: revenue, EBIT, net income, interest expense
- Balance sheet: total assets, total liabilities, total debt, shareholder equity, current assets, current liabilities, inventory, working capital, retained earnings
- Cash flow: operating cash flow, total debt service, net operating income (or EBITDA with adjustments)
- Facility: loan amount, asset/appraisal value, collateral description
- Qualitative: management background, industry, ownership, repayment history, guarantors

If a required input is missing, mark dependent outputs "n/a". Never invent numbers.

### 2. Run the ratio screen
Use the bundled calculator (it emits "n/a" for missing inputs instead of guessing):

```
python3 bin/credit_ratios.py inputs.json
```

See `bin/credit_ratios.py --example` for the input schema. Verify at least the headline numbers by hand against `references/ratio-reference.md` before trusting any output.

### 3. Apply the 5 Cs (qualitative review)
- **Character:** repayment history with this lender and others, trade references, credit bureau data, guarantor strength.
- **Capacity:** does operating cash flow cover debt service under base case AND a stressed case? Model one downside scenario (e.g. 20% revenue drop, 100 bps rate rise) and one severe scenario.
- **Capital:** equity cushion, retained earnings trend, owner capital at risk.
- **Collateral:** advance rate, current LTV, valuation date and method, perfection status.
- **Conditions:** industry outlook, regulatory exposure, macro sensitivity, customer/supplier concentration.

### 4. Review covenants
Separate affirmative (maintain insurance, submit quarterly financials), negative (no additional liens, dividend limits, capex caps), and financial-ratio covenants (minimum DSCR, maximum leverage, minimum current ratio, minimum tangible net worth). For each covenant: state the test, the current reading, headroom, and what a breach would trigger. Flag any proposed covenant the borrower is already near breaching.

### 5. Assign a risk rating
Use the OCC regulatory classification scale (see `references/rating-scale.md`):
Pass / Watch / Special Mention / Substandard / Doubtful / Loss. A rating without written rationale fails examiner scrutiny. Where the institution supports it, split the rating: borrower risk (probability of default) vs. facility risk (loss given default).

### 6. Draft the credit memo
Render `assets/credit-memo-template.md`. The executive summary fits on one page. Every risk gets a mitigant or an explicit "unmitigated" label. Policy exceptions are called out by name with compensating factors, never buried.

## Output Contract
A complete credit workup delivers:
1. Ratio table with company figures, trend (3-year if available), benchmark assessment, and computed flags.
2. 5 Cs write-up, one downside + one severe stress scenario with DSCR under stress.
3. Covenant compliance table: covenant, test level, current reading, headroom, breach consequence.
4. Risk rating with written rationale.
5. Credit memo in the template format, ending in an explicit recommendation.

## Operating Rules
1. Accuracy rule: every factual claim verified against a primary source. Unverifiable claims are cut or framed as opinion.
2. Never invent financial inputs. Missing data yields "n/a", not estimates.
3. Altman Z-score is calibrated for public manufacturing firms. For private firms use the Z-prime variant; for non-manufacturing, Z-double-prime. Applying the original formula outside its calibration produces misleading results. Details in `references/ratio-reference.md`.
4. Trend beats level: a deteriorating ratio over several periods is a stronger warning than one weak reading.
5. Stress test every credit. Base-case-only underwriting is incomplete work.
6. The recommendation is the analyst's judgment. The ratios support it; they do not make it.
