adding-an-asset-classlisted
Install: claude install-skill vsriram11/wealthtrajectory
# Adding a new asset class
The codebase treats "asset class" as a load-bearing concept — extending it touches the type system, the kind registry, the factory, and the UI. **Skipping any one of the four steps produces a class that compiles but doesn't render or aggregate correctly.**
## The four files that must change together
| File | What you add |
|---|---|
| `lib/types.ts` | Extend the `AssetClass` union; if the new class is a discriminated kind, add a holding-shape interface (mirrors EquityHolding / BondHolding / etc.) |
| `lib/portfolio/holdingKinds.ts` | Add a meta entry — label, color, default real CAGR, default leverage, whether it's "live-priced" (live-price API) or manual |
| `lib/portfolio/holdingFactory.ts` | Add a builder function `buildHolding(id, input)` for the new kind; route from the dispatcher at the top of the file |
| `app/_components/holdings/holding-creator/<NewKind>Form.tsx` | New per-kind creation form — copy the closest existing form (TickerForm for live-priced, RealEstateForm for manual valuation, etc.) as the template |
## Order of operations
1. **Read** `lib/types.ts:Holding` and a similar existing holding type (e.g. `EquityHolding`) to understand the shape contract.
2. **Read** `lib/portfolio/holdingKinds.ts` to see how an existing entry is structured.
3. **Read** the most-similar existing form under `app/_components/holdings/holding-creator/` as your template.
4. **Add the type** to `lib/types.ts` first — typecheck will then flag every site