Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run dev - Start Vite development server (usually http://localhost:5173)npm run build - Build production versionnpm run preview - Preview production buildnpm test - Run all tests with Vitestnpm run typecheck - Run TypeScript type checkingnpm run format - Format code with PrettierThis is a React-based pension calculator that helps users determine if they're financially prepared for retirement. The app uses Monte Carlo simulation to model investment uncertainty and provides percentile-based projections.
- Contains the deterministic pension
projection logic:src/pension-calculations.ts
calculatePensionProjection() - Core function that projects pension pot value
over timepot = pot * (1 + growthRate) + annualContributionpot = pot * (1 + growthRate) - annualDrawdown + statePension
- Monte Carlo simulation for modeling market
uncertainty:src/monte-carlo.ts
runMonteCarloSimulation() - Runs 1000+ simulations with random returnspickFromNormalDistribution() - Creates normally distributed returns based on
expected return ± volatilitycalculatePercentiles() - Converts simulation results into 5th, 25th, 50th,
75th, 95th percentilesMain Component:
src/pension-calculator.tsx - Root component with
two-column layout (controls + chart)
Tab-Based Input System:
CurrentSituationTab.tsx - Age, current pot, contributionsMarketAssumptionsTab.tsx - Expected returns and volatilityYourDecisionsTab.tsx - Retirement age, drawdown amount, and state pensionVisualization:
src/components/PensionChart.tsx
Reusable Components:
InputSlider.tsx - Standardized slider with value displayCollapsibleSection.tsx - Expandable content areas to save spaceInfoButton.tsx - Tooltip component for contextual helpProjectedOutcomes.tsx - Compact summary of key metricsPensionParams interface in types.tscalculatePensionProjection()runMonteCarloSimulation()calculatePercentiles()PensionChartState Pension Integration:
src/state-pension.ts implements UK state
pension rules:
getStatePensionEligibilityAge() - Calculates state pension age from current
ageisEligibleForStatePension() - Determines if state pension should be addedChart Scaling Solution: The 95th percentile in optimistic scenarios can reach extreme values, making median/quartile lines appear flat. PensionChart.tsx solves this by:
undefinedTest Coverage:
src/pension-calculator.test.ts contains 36 tests across 7
categories:
Retirement Logic: Drawdown begins immediately at retirement age, not the year after. This is the expected behavior tested throughout the test suite.
Key types in
src/types.ts:
PensionParams - All user input parameters (includes statePensionAmount)PercentileDataPoint - Chart data with p5, p25, p50, p75, p95 valuesSurvivalRate - Actuarial data for life expectancy calculations