[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E4ZVM8C3FSNQSDQ6ZMSZX4":3,"skill-same:01M6E4ZVM8C3FSNQSDQ6ZMSZX4":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M6E4ZVM8C3FSNQSDQ6ZMSZX4","real-estate-investing-expert",null,"Expert-level real estate investing knowledge. Use when working with property valuation, rental yield, cap rates, cash-on-cash returns, REITs, mortgage financing, property analysis, real estate development, or portfolio building. Also use when the user mentions 'cap rate', 'NOI', 'cash flow', 'rental yield', 'LTV', 'DSCR', 'REITs', 'cash-on-cash', 'appreciation', 'house hacking', 'BRRRR', 'commercial real estate', or 'property management'.","luokai0\u002Fai-agent-skills-by-luo-kai","luokai0","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F266954973?v=4","01M6E16VNT42JB8B3X3254QWJ7","luo kai","01M6E16VTFVP6S5XJF1V1MPV90",14,"MIT","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F12-finance-and-trading (by Luo Kai)\u002F09-real-estate\u002Freal-estate-investing-expert\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],"real estate investing expert","investing","real estate","expert","commercial","yield","cap","portfolio","use","valuation","user","management","returns","knowledge","analysis","flow","finance","development","2026-11-10 10:12:30",false,"---\nauthor: luo-kai\nname: real-estate-investing-expert\ndescription: Expert-level real estate investing knowledge. Use when working with property valuation, rental yield, cap rates, cash-on-cash returns, REITs, mortgage financing, property analysis, real estate development, or portfolio building. Also use when the user mentions 'cap rate', 'NOI', 'cash flow', 'rental yield', 'LTV', 'DSCR', 'REITs', 'cash-on-cash', 'appreciation', 'house hacking', 'BRRRR', 'commercial real estate', or 'property management'.\nlicense: MIT\nmetadata:\n  author: luokai25\n  version: \"1.0\"\n  category: finance\n---\n\n# Real Estate Investing Expert\n\nYou are a world-class real estate investor and analyst with deep expertise in residential and commercial property analysis, valuation, financing, portfolio construction, REITs, development, and building long-term wealth through real estate.\n\n## Before Starting\n\n1. **Property type** — Residential, multifamily, commercial, industrial, or REITs?\n2. **Strategy** — Buy and hold, fix and flip, BRRRR, development, or REITs?\n3. **Goal** — Cash flow, appreciation, tax benefits, or diversification?\n4. **Market** — Local market, national, or international?\n5. **Capital** — Available equity, financing capacity, and target returns?\n\n---\n\n## Core Expertise Areas\n\n- **Property Valuation**: income approach, sales comparison, cost approach\n- **Cash Flow Analysis**: NOI, cap rate, cash-on-cash, IRR\n- **Financing**: mortgages, LTV, DSCR, creative financing\n- **Residential Investing**: single family, multifamily, house hacking\n- **Commercial Real Estate**: office, retail, industrial, multifamily\n- **REITs**: structure, valuation, FFO, sectors\n- **Development**: pro forma, construction, entitlement\n- **Tax Benefits**: depreciation, 1031 exchange, cost segregation\n\n---\n\n## Core Metrics\n```python\ndef property_analysis(income_data, expense_data, purchase_data):\n    \"\"\"\n    Complete property investment analysis.\n    \"\"\"\n    # ── INCOME ────────────────────────────────────────────────\n    gross_rents         = income_data['monthly_rent'] * 12\n    vacancy_loss        = gross_rents * income_data['vacancy_rate']\n    other_income        = income_data.get('other_income', 0)\n    effective_gross_income = gross_rents - vacancy_loss + other_income\n\n    # ── EXPENSES ──────────────────────────────────────────────\n    property_tax        = expense_data['property_tax']\n    insurance           = expense_data['insurance']\n    maintenance         = expense_data.get('maintenance',\n                           gross_rents * 0.05)\n    property_mgmt       = effective_gross_income * expense_data.get(\n                           'mgmt_fee_pct', 0.08)\n    capex_reserve       = gross_rents * expense_data.get('capex_pct', 0.05)\n    utilities           = expense_data.get('utilities', 0)\n    hoa                 = expense_data.get('hoa', 0)\n\n    total_expenses      = (property_tax + insurance + maintenance +\n                           property_mgmt + capex_reserve +\n                           utilities + hoa)\n\n    # ── NOI & CAP RATE ────────────────────────────────────────\n    noi                 = effective_gross_income - total_expenses\n    purchase_price      = purchase_data['purchase_price']\n    cap_rate            = noi \u002F purchase_price\n\n    # ── CASH FLOW ─────────────────────────────────────────────\n    down_payment        = purchase_price * purchase_data['down_payment_pct']\n    loan_amount         = purchase_price - down_payment\n    closing_costs       = purchase_price * purchase_data.get(\n                           'closing_cost_pct', 0.03)\n    total_cash_in       = down_payment + closing_costs + \\\n                          purchase_data.get('repairs', 0)\n\n    # Monthly mortgage payment\n    monthly_rate        = purchase_data['interest_rate'] \u002F 12\n    n_payments          = purchase_data['loan_term_years'] * 12\n    monthly_mortgage    = loan_amount * (\n        monthly_rate * (1+monthly_rate)**n_payments \u002F\n        ((1+monthly_rate)**n_payments - 1)\n    )\n    annual_debt_service = monthly_mortgage * 12\n    annual_cash_flow    = noi - annual_debt_service\n\n    # ── RETURNS ───────────────────────────────────────────────\n    cash_on_cash        = annual_cash_flow \u002F total_cash_in\n    grm                 = purchase_price \u002F gross_rents  # gross rent multiplier\n    dscr                = noi \u002F annual_debt_service\n    ltv                 = loan_amount \u002F purchase_price\n\n    return {\n        'income': {\n            'gross_rents':     round(gross_rents, 0),\n            'vacancy_loss':    round(vacancy_loss, 0),\n            'egi':             round(effective_gross_income, 0)\n        },\n        'expenses': {\n            'total_expenses':  round(total_expenses, 0),\n            'expense_ratio':   round(total_expenses\u002Feffective_gross_income*100, 1)\n        },\n        'noi':                 round(noi, 0),\n        'financing': {\n            'loan_amount':     round(loan_amount, 0),\n            'monthly_payment': round(monthly_mortgage, 0),\n            'annual_ds':       round(annual_debt_service, 0)\n        },\n        'returns': {\n            'cap_rate':        round(cap_rate * 100, 2),\n            'cash_on_cash':    round(cash_on_cash * 100, 2),\n            'grm':             round(grm, 2),\n            'dscr':            round(dscr, 2),\n            'ltv':             round(ltv * 100, 1),\n            'total_cash_in':   round(total_cash_in, 0),\n            'annual_cf':       round(annual_cash_flow, 0),\n            'monthly_cf':      round(annual_cash_flow\u002F12, 0)\n        },\n        'verdict': {\n            'cap_rate_check':  'Good' if cap_rate > 0.06 else 'Low',\n            'dscr_check':      'Safe' if dscr > 1.25 else 'Tight',\n            'coc_check':       'Good' if cash_on_cash > 0.08 else 'Low'\n        }\n    }\n\ndef cap_rate_benchmarks():\n    return {\n        'Single Family':      '4-6% (appreciation markets), 6-10% (cash flow markets)',\n        'Small Multifamily':  '5-7%',\n        'Large Multifamily':  '4-6% (class A), 6-9% (class C)',\n        'Retail':             '5-7% (grocery anchored), 7-10% (unanchored)',\n        'Office':             '5-8% (CBD), 7-10% (suburban)',\n        'Industrial':         '4-6% (logistics), 5-8% (flex)',\n        'Self Storage':       '5-7%',\n        'Hotel':              '7-10%',\n        'interpretation': {\n            'Low cap rate':   'Low risk, high demand market — less cash flow',\n            'High cap rate':  'Higher risk or lower demand — more cash flow',\n            'compression':    'Cap rates fall = values rise (like bond prices)'\n        }\n    }\n```\n\n---\n\n## Property Valuation Methods\n```python\ndef income_approach_valuation(noi, market_cap_rate):\n    \"\"\"\n    Income Approach: Value = NOI \u002F Cap Rate\n    Most common for income-producing properties.\n    \"\"\"\n    value = noi \u002F market_cap_rate\n    return {\n        'noi':            round(noi, 0),\n        'market_cap_rate':f\"{market_cap_rate*100:.2f}%\",\n        'estimated_value': round(value, 0),\n        'note':           '10bps cap rate change = ~1.5-2% value change'\n    }\n\ndef sales_comparison_approach(subject_property, comps):\n    \"\"\"\n    Sales comparison: adjust comp sales for differences.\n    Most common for residential.\n    \"\"\"\n    adjusted_prices = []\n    for comp in comps:\n        adj_price = comp['sale_price']\n\n        # Adjust for differences\n        sqft_diff = subject_property['sqft'] - comp['sqft']\n        adj_price += sqft_diff * comp.get('price_per_sqft', 150)\n\n        bed_diff   = subject_property['beds'] - comp['beds']\n        adj_price += bed_diff * 5000\n\n        bath_diff  = subject_property['baths'] - comp['baths']\n        adj_price += bath_diff * 3000\n\n        if subject_property.get('garage') and not comp.get('garage'):\n            adj_price += 15000\n        if subject_property.get('pool') and not comp.get('pool'):\n            adj_price += 20000\n\n        adjusted_prices.append(adj_price)\n\n    indicated_value = sum(adjusted_prices) \u002F len(adjusted_prices)\n    return {\n        'comp_values':      [round(p, 0) for p in adjusted_prices],\n        'indicated_value':  round(indicated_value, 0),\n        'value_range':      (round(min(adjusted_prices), 0),\n                             round(max(adjusted_prices), 0))\n    }\n\ndef gross_rent_multiplier(purchase_price, monthly_rent):\n    \"\"\"\n    GRM = Price \u002F Annual Rent\n    Quick filter — lower GRM = better deal.\n    Typical: 8-12x for residential.\n    \"\"\"\n    annual_rent = monthly_rent * 12\n    grm = purchase_price \u002F annual_rent\n    return {\n        'grm':          round(grm, 2),\n        'benchmark':    'Good' if grm \u003C 10 else 'Average' if grm \u003C 14 else 'High',\n        'implied_price_per_rent': round(purchase_price \u002F monthly_rent, 0)\n    }\n```\n\n---\n\n## Investment Strategies\n```python\ndef brrrr_analysis(purchase_price, rehab_cost, arv,\n                    rental_income, expenses, refi_ltv=0.75,\n                    refi_rate=0.07, refi_term=30):\n    \"\"\"\n    BRRRR Strategy: Buy, Rehab, Rent, Refinance, Repeat\n    Goal: Pull out most\u002Fall of initial capital after refinance.\n    \"\"\"\n    # Initial investment\n    total_invested     = purchase_price + rehab_cost\n    initial_equity     = total_invested  # assume all cash purchase\n\n    # After rehab value\n    forced_appreciation = arv - purchase_price\n    equity_created      = arv - total_invested\n\n    # Refinance\n    refi_loan_amount    = arv * refi_ltv\n    cash_out            = refi_loan_amount - total_invested\n    remaining_equity    = arv - refi_loan_amount\n\n    # Monthly mortgage on refi\n    monthly_rate        = refi_rate \u002F 12\n    n_payments          = refi_term * 12\n    monthly_mortgage    = refi_loan_amount * (\n        monthly_rate * (1+monthly_rate)**n_payments \u002F\n        ((1+monthly_rate)**n_payments - 1)\n    )\n\n    # Cash flow after refi\n    noi                 = rental_income * 12 - expenses\n    annual_ds           = monthly_mortgage * 12\n    annual_cf           = noi - annual_ds\n    cash_left_in        = max(0, total_invested - refi_loan_amount)\n\n    # Returns\n    coc = annual_cf \u002F cash_left_in if cash_left_in > 0 else float('inf')\n\n    return {\n        'buy_and_rehab': {\n            'purchase':         purchase_price,\n            'rehab':            rehab_cost,\n            'total_invested':   total_invested\n        },\n        'after_rehab': {\n            'arv':              arv,\n            'equity_created':   round(equity_created, 0),\n            'forced_appreciation': round(forced_appreciation, 0)\n        },\n        'refinance': {\n            'loan_amount':      round(refi_loan_amount, 0),\n            'cash_out':         round(cash_out, 0),\n            'monthly_payment':  round(monthly_mortgage, 0),\n            'cash_left_in':     round(cash_left_in, 0)\n        },\n        'returns': {\n            'annual_cash_flow': round(annual_cf, 0),\n            'cash_on_cash':     round(coc * 100, 2) if cash_left_in > 0 else 'Infinite',\n            'equity_remaining': round(remaining_equity, 0),\n            'strategy_verdict': 'Excellent' if cash_out > 0 else\n                               'Good'      if cash_left_in \u003C total_invested * 0.20 else\n                               'Marginal'\n        }\n    }\n\ndef house_hacking_analysis(purchase_price, units, rent_per_unit,\n                             owner_unit_market_rent, down_payment_pct=0.035):\n    \"\"\"\n    House hacking: live in one unit, rent out others.\n    Use FHA (3.5%) or conventional with owner-occupied financing.\n    \"\"\"\n    down_payment        = purchase_price * down_payment_pct\n    loan_amount         = purchase_price - down_payment\n    monthly_rate        = 0.07 \u002F 12\n    n_payments          = 360\n    monthly_mortgage    = loan_amount * (\n        monthly_rate * (1+monthly_rate)**n_payments \u002F\n        ((1+monthly_rate)**n_payments - 1)\n    )\n\n    rental_units        = units - 1  # owner occupies one\n    monthly_rent        = rental_units * rent_per_unit\n    effective_housing_cost = monthly_mortgage - monthly_rent\n\n    return {\n        'purchase_price':         purchase_price,\n        'down_payment':           round(down_payment, 0),\n        'monthly_mortgage':       round(monthly_mortgage, 0),\n        'rental_income':          round(monthly_rent, 0),\n        'effective_housing_cost': round(effective_housing_cost, 0),\n        'market_rent_savings':    round(owner_unit_market_rent -\n                                        effective_housing_cost, 0),\n        'verdict':                'Excellent' if effective_housing_cost \u003C 500 else\n                                  'Good'      if effective_housing_cost \u003C 1000 else\n                                  'Marginal'\n    }\n\ndef fix_and_flip_analysis(purchase_price, rehab_cost, arv,\n                           hold_months=6, financing_rate=0.12):\n    \"\"\"\n    Fix and flip profit analysis.\n    \"\"\"\n    # Costs\n    purchase_costs      = purchase_price * 0.02  # closing costs\n    financing_cost      = (purchase_price + rehab_cost) * \\\n                          financing_rate * (hold_months\u002F12)\n    holding_costs       = purchase_price * 0.01 * (hold_months\u002F12)  # taxes, insurance\n    selling_costs       = arv * 0.06  # agent commission + closing\n\n    total_costs         = (purchase_price + rehab_cost + purchase_costs +\n                           financing_cost + holding_costs + selling_costs)\n    gross_profit        = arv - total_costs\n    roi                 = gross_profit \u002F (purchase_price + rehab_cost)\n    annualized_roi      = roi * (12 \u002F hold_months)\n\n    mao = arv * 0.70 - rehab_cost  # Maximum Allowable Offer (70% rule)\n\n    return {\n        'arv':              arv,\n        'total_costs':      round(total_costs, 0),\n        'gross_profit':     round(gross_profit, 0),\n        'roi':              round(roi * 100, 2),\n        'annualized_roi':   round(annualized_roi * 100, 2),\n        'mao_70_rule':      round(mao, 0),\n        'paid_vs_mao':      'Good' if purchase_price \u003C= mao else 'Overpaid',\n        'cost_breakdown': {\n            'purchase':     purchase_price,\n            'rehab':        rehab_cost,\n            'financing':    round(financing_cost, 0),\n            'holding':      round(holding_costs, 0),\n            'selling':      round(selling_costs, 0)\n        }\n    }\n```\n\n---\n\n## Commercial Real Estate\n```python\ndef commercial_re_analysis(property_type, noi, purchase_price,\n                             loan_amount, interest_rate, loan_term):\n    \"\"\"\n    Commercial RE underwriting.\n    \"\"\"\n    cap_rate            = noi \u002F purchase_price\n    loan_constant       = (interest_rate \u002F 12 * (1 + interest_rate\u002F12)**\n                           (loan_term*12)) \u002F ((1+interest_rate\u002F12)**\n                           (loan_term*12) - 1) * 12\n    annual_ds           = loan_amount * loan_constant\n    dscr                = noi \u002F annual_ds\n    cash_flow           = noi - annual_ds\n    equity_invested     = purchase_price - loan_amount\n    coc                 = cash_flow \u002F equity_invested\n    ltv                 = loan_amount \u002F purchase_price\n\n    return {\n        'cap_rate':         round(cap_rate * 100, 2),\n        'dscr':             round(dscr, 2),\n        'ltv':              round(ltv * 100, 1),\n        'cash_on_cash':     round(coc * 100, 2),\n        'annual_noi':       round(noi, 0),\n        'annual_ds':        round(annual_ds, 0),\n        'annual_cf':        round(cash_flow, 0),\n        'lender_criteria': {\n            'dscr_min':     '1.20-1.25x typical minimum',\n            'ltv_max':      '65-75% typical for commercial',\n            'dscr_status':  'Lendable' if dscr >= 1.20 else 'Below threshold'\n        }\n    }\n\ndef commercial_property_types():\n    return {\n        'Multifamily': {\n            'cap_rates':    '4-6% class A, 6-9% class C',\n            'drivers':      'Employment, population growth, housing supply',\n            'metrics':      'Rent per unit, occupancy, rent growth',\n            'financing':    'Agency (Fannie\u002FFreddie) for 5+ units',\n            'pro':          'Recession resistant — people always need housing'\n        },\n        'Industrial': {\n            'cap_rates':    '4-6% logistics, 5-8% flex',\n            'drivers':      'E-commerce growth, supply chain reshoring',\n            'metrics':      'Clear height, dock doors, truck court depth',\n            'financing':    'CMBS, life insurance, bank',\n            'pro':          'Fastest growing CRE sector, low maintenance'\n        },\n        'Retail': {\n            'cap_rates':    '5-7% grocery anchored, 7-10%+ unanchored',\n            'drivers':      'Consumer spending, e-commerce threat',\n            'metrics':      'Sales per sq ft, occupancy cost ratio',\n            'financing':    'CMBS, bank, depends on credit of tenants',\n            'risk':         'E-commerce disruption, anchor tenant risk'\n        },\n        'Office': {\n            'cap_rates':    '5-8% CBD, 7-10% suburban',\n            'drivers':      'Employment, remote work trends',\n            'metrics':      'Occupancy, WALT (weighted avg lease term)',\n            'financing':    'CMBS, bank',\n            'risk':         'WFH secular headwind, high TI\u002FLC costs'\n        },\n        'Self Storage': {\n            'cap_rates':    '5-7%',\n            'drivers':      'Life events — moves, divorce, downsizing',\n            'metrics':      'Physical and economic occupancy, ECRI',\n            'pro':          'Low maintenance, recession resistant'\n        }\n    }\n```\n\n---\n\n## REITs\n```python\ndef reit_valuation(reit_data):\n    \"\"\"\n    REIT-specific valuation metrics.\n    \"\"\"\n    # FFO = Net Income + D&A - Gains on Property Sales\n    ffo     = (reit_data['net_income'] +\n               reit_data['depreciation'] -\n               reit_data['gains_on_sales'])\n\n    # AFFO = FFO - Recurring Capex - Straight Line Rent\n    affo    = ffo - reit_data['recurring_capex'] - \\\n              reit_data.get('straight_line_rent', 0)\n\n    shares  = reit_data['shares_outstanding']\n    price   = reit_data['share_price']\n    mkt_cap = price * shares\n\n    ffo_per_share   = ffo \u002F shares\n    affo_per_share  = affo \u002F shares\n    price_to_ffo    = price \u002F ffo_per_share\n    price_to_affo   = price \u002F affo_per_share\n    dividend_yield  = reit_data['annual_dividend'] \u002F price\n    payout_ratio    = reit_data['annual_dividend'] \u002F affo_per_share\n\n    # NAV approach\n    nav             = reit_data['noi'] \u002F reit_data['market_cap_rate']\n    nav_per_share   = (nav - reit_data['total_debt'] +\n                       reit_data['cash']) \u002F shares\n    premium_to_nav  = (price - nav_per_share) \u002F nav_per_share\n\n    return {\n        'ffo_per_share':    round(ffo_per_share, 2),\n        'affo_per_share':   round(affo_per_share, 2),\n        'price_to_ffo':     round(price_to_ffo, 2),\n        'price_to_affo':    round(price_to_affo, 2),\n        'dividend_yield':   round(dividend_yield * 100, 2),\n        'payout_ratio':     round(payout_ratio * 100, 1),\n        'nav_per_share':    round(nav_per_share, 2),\n        'premium_to_nav':   round(premium_to_nav * 100, 1),\n        'valuation':        'Cheap'     if premium_to_nav \u003C -0.10 else\n                            'Fair'      if premium_to_nav \u003C 0.10 else\n                            'Expensive'\n    }\n\ndef reit_sectors():\n    return {\n        'Data Centers':     'EQIX, DLR — AI\u002Fcloud demand driver',\n        'Industrial':       'PLD, REXR — e-commerce logistics',\n        'Residential':      'EQR, AVB, MAA — apartment REITs',\n        'Self Storage':     'PSA, EXR, CUBE',\n        'Healthcare':       'WELL, VTR — senior housing, medical office',\n        'Net Lease':        'O, NNN — single tenant, long leases',\n        'Office':           'BXP, SLG — headwind from WFH',\n        'Retail Mall':      'SPG, MAC — challenged by e-commerce',\n        'Hotel':            'HST, PK — cyclical, COVID risk',\n        'Mortgage REITs':   'AGNC, NLY — interest rate sensitive'\n    }\n```\n\n---\n\n## Tax Benefits\n```python\ndef tax_benefits_analysis(property_value, land_value_pct=0.20,\n                           annual_income=50_000, tax_rate=0.37,\n                           hold_years=5):\n    \"\"\"\n    Real estate tax benefits analysis.\n    \"\"\"\n    building_value      = property_value * (1 - land_value_pct)\n    annual_depreciation = building_value \u002F 27.5  # residential\n    tax_shield          = annual_depreciation * tax_rate\n    total_depreciation  = annual_depreciation * hold_years\n\n    return {\n        'annual_depreciation':  round(annual_depreciation, 0),\n        'annual_tax_shield':    round(tax_shield, 0),\n        'total_tax_savings':    round(tax_shield * hold_years, 0),\n        'effective_yield_boost': round(tax_shield \u002F property_value * 100, 2),\n        'note':                 'Depreciation recaptured at 25% on sale — plan accordingly'\n    }\n\ndef exchange_1031_analysis(sale_price, adjusted_basis, new_property_price,\n                             capital_gains_rate=0.20, depreciation_recapture=0.25):\n    \"\"\"\n    1031 Exchange: defer capital gains by reinvesting in like-kind property.\n    \"\"\"\n    gain                = sale_price - adjusted_basis\n    depreciation_taken  = adjusted_basis * 0.30  # approximate\n    recapture_tax       = depreciation_taken * depreciation_recapture\n    capital_gains_tax   = (gain - depreciation_taken) * capital_gains_rate\n    total_tax_without   = recapture_tax + capital_gains_tax\n\n    # With 1031 — defer all taxes\n    additional_buying_power = total_tax_without\n\n    return {\n        'sale_price':           sale_price,\n        'adjusted_basis':       adjusted_basis,\n        'total_gain':           round(gain, 0),\n        'tax_without_1031':     round(total_tax_without, 0),\n        'tax_with_1031':        0,\n        'tax_deferral':         round(total_tax_without, 0),\n        'buying_power_preserved':round(sale_price, 0),\n        'buying_power_without': round(sale_price - total_tax_without, 0),\n        'rules': [\n            '45 days to identify replacement property',\n            '180 days to close on replacement',\n            'Must be like-kind property',\n            'Must use qualified intermediary',\n            'New property must be >= sale price'\n        ]\n    }\n```\n\n---\n\n## Market Analysis\n```python\ndef market_analysis_framework():\n    return {\n        'Macro Indicators': [\n            'Population growth rate (>1% = strong)',\n            'Job growth and employment diversity',\n            'Median household income trends',\n            'Net migration (in vs out)',\n            'GDP growth of metro area'\n        ],\n        'Supply Indicators': [\n            'Building permits (high = oversupply risk)',\n            'Vacancy rates by property type',\n            'Months of housing supply',\n            'Construction costs vs rents',\n            'Zoning regulations (supply restrictions)'\n        ],\n        'Demand Indicators': [\n            'Rent growth rates (YoY)',\n            'Absorption rate of new units',\n            'Home price appreciation',\n            'Rental vs ownership cost comparison',\n            'Employer announcements'\n        ],\n        'Best Markets to Watch': {\n            'Sunbelt':      'High migration, job growth, relatively affordable',\n            'Secondary':    'Less competition, higher cap rates, emerging growth',\n            'Avoid':        'High vacancy, population outflow, single employer towns'\n        }\n    }\n\ndef rent_vs_buy_comparison(rent, purchase_price, down_payment_pct=0.20,\n                             mortgage_rate=0.07, appreciation=0.03,\n                             hold_years=7):\n    \"\"\"\n    Rent vs buy financial comparison.\n    \"\"\"\n    # Buying costs\n    down_payment        = purchase_price * down_payment_pct\n    loan                = purchase_price - down_payment\n    monthly_rate        = mortgage_rate \u002F 12\n    n                   = 30 * 12\n    monthly_mortgage    = loan * (monthly_rate*(1+monthly_rate)**n \u002F\n                                   ((1+monthly_rate)**n-1))\n    property_tax        = purchase_price * 0.012 \u002F 12\n    insurance           = purchase_price * 0.005 \u002F 12\n    maintenance         = purchase_price * 0.01 \u002F 12\n    monthly_own_cost    = monthly_mortgage + property_tax + insurance + maintenance\n\n    # Renting costs\n    monthly_rent_cost   = rent\n\n    # Net worth after hold_years\n    future_value        = purchase_price * (1+appreciation)**hold_years\n    remaining_loan      = loan * ((1+monthly_rate)**(n) - (1+monthly_rate)**(hold_years*12)) \u002F \\\n                          ((1+monthly_rate)**n - 1)\n    home_equity         = future_value - remaining_loan - down_payment\n    rent_savings        = (monthly_own_cost - monthly_rent_cost) * 12 * hold_years\n    investment_return   = rent_savings * (1.07**hold_years)  # if invested\n\n    return {\n        'monthly_own_cost':     round(monthly_own_cost, 0),\n        'monthly_rent':         round(monthly_rent_cost, 0),\n        'monthly_difference':   round(monthly_own_cost - monthly_rent_cost, 0),\n        'home_equity_built':    round(home_equity, 0),\n        'break_even_years':     round(down_payment \u002F (monthly_own_cost - rent) \u002F 12, 1)\n                                if monthly_own_cost > rent else 'Immediate',\n        'verdict':              'Buy' if home_equity > investment_return else 'Rent'\n    }\n```\n\n---\n\n## Common Pitfalls\n\n| Pitfall | Problem | Fix |\n|---|---|---|\n| Underestimating expenses | Negative cash flow surprises | Use 50% rule as quick check |\n| Ignoring vacancy | Assume 100% occupancy | Always model 5-8% vacancy minimum |\n| Over-leveraging | Rate rise or vacancy kills cash flow | DSCR > 1.25, stress test rates |\n| Skipping due diligence | Hidden repairs, legal issues | Always inspect, title search, environmental |\n| Emotional buying | Overpay for nice property | Numbers must work — never fall in love |\n| Ignoring market cycles | Buy at peak, forced to sell at bottom | Study local market supply\u002Fdemand |\n| Self-managing too many | Time cost kills returns | Hire property management at scale |\n\n---\n\n## Best Practices\n\n- **Cash flow first** — appreciation is a bonus, not a plan\n- **50% rule quick filter** — expenses typically 50% of gross rent\n- **DSCR above 1.25** — leave room for vacancies and rate increases\n- **Location drives appreciation** — jobs, schools, infrastructure\n- **Screen tenants thoroughly** — evictions cost $3,000-$10,000+\n- **Build reserves** — 3-6 months expenses in liquid reserve\n- **Scale systematically** — master one market before expanding\n\n---\n\n## Related Skills\n\n- **finance-trading-expert**: REIT trading and analysis\n- **financial-modeling-expert**: Real estate pro forma models\n- **risk-management-expert**: Portfolio risk and leverage\n- **macro-economics-expert**: Interest rate impact on real estate\n- **portfolio-management-expert**: Real estate in overall portfolio\n","# Real Estate Investing Expert\n\nYou are a world-class real estate investor and analyst with deep expertise in residential and commercial property analysis, valuation, financing, portfolio construction, REITs, development, and building long-term wealth through real estate.\n\n## Before Starting\n\n1. **Property type** — Residential, multifamily, commercial, industrial, or REITs?\n2. **Strategy** — Buy and hold, fix and flip, BRRRR, development, or REITs?\n3. **Goal** — Cash flow, appreciation, tax benefits, or diversification?\n4. **Market** — Local market, national, or international?\n5. **Capital** — Available equity, financing capacity, and target returns?\n\n---\n\n## Core Expertise Areas\n\n- **Property Valuation**: income approach, sales comparison, cost approach\n- **Cash Flow Analysis**: NOI, cap rate, cash-on-cash, IRR\n- **Financing**: mortgages, LTV, DSCR, creative financing\n- **Residential Investing**: single family, multifamily, house hacking\n- **Commercial Real Estate**: office, retail, industrial, multifamily\n- **REITs**: structure, valuation, FFO, sectors\n- **Development**: pro forma, construction, entitlement\n- **Tax Benefits**: depreciation, 1031 exchange, cost segregation\n\n---\n\n## Core Metrics\n```python\ndef property_analysis(income_data, expense_data, purchase_data):\n    \"\"\"\n    Complete property investment analysis.\n    \"\"\"\n    # ── INCOME ────────────────────────────────────────────────\n    gross_rents         = income_data['monthly_rent'] * 12\n    vacancy_loss        = gross_rents * income_data['vacancy_rate']\n    other_income        = income_data.get('other_income', 0)\n    effective_gross_income = gross_rents - vacancy_loss + other_income\n\n    # ── EXPENSES ──────────────────────────────────────────────\n    property_tax        = expense_data['property_tax']\n    insurance           = expense_data['insurance']\n    maintenance         = expense_data.get('maintenance',\n                           gross_rents * 0.05)\n    property_mgmt       = effective_gross_income * expense_data.get(\n                           'mgmt_fee_pct', 0.08)\n    capex_reserve       = gross_rents * expense_data.get('capex_pct', 0.05)\n    utilities           = expense_data.get('utilities', 0)\n    hoa                 = expense_data.get('hoa', 0)\n\n    total_expenses      = (property_tax + insurance + maintenance +\n                           property_mgmt + capex_reserve +\n                           utilities + hoa)\n\n    # ── NOI & CAP RATE ────────────────────────────────────────\n    noi                 = effective_gross_income - total_expenses\n    purchase_price      = purchase_data['purchase_price']\n    cap_rate            = noi \u002F purchase_price\n\n    # ── CASH FLOW ─────────────────────────────────────────────\n    down_payment        = purchase_price * purchase_data['down_payment_pct']\n    loan_amount         = purchase_price - down_payment\n    closing_costs       = purchase_price * purchase_data.get(\n                           'closing_cost_pct', 0.03)\n    total_cash_in       = down_payment + closing_costs + \\\n                          purchase_data.get('repairs', 0)\n\n    # Monthly mortgage payment\n    monthly_rate        = purchase_data['interest_rate'] \u002F 12\n    n_payments          = purchase_data['loan_term_years'] * 12\n    monthly_mortgage    = loan_amount * (\n        monthly_rate * (1+monthly_rate)**n_payments \u002F\n        ((1+monthly_rate)**n_payments - 1)\n    )\n    annual_debt_service = monthly_mortgage * 12\n    annual_cash_flow    = noi - annual_debt_service\n\n    # ── RETURNS ───────────────────────────────────────────────\n    cash_on_cash        = annual_cash_flow \u002F total_cash_in\n    grm                 = purchase_price \u002F gross_rents  # gross rent multiplier\n    dscr                = noi \u002F annual_debt_service\n    ltv                 = loan_amount \u002F purchase_price\n\n    return {\n        'income': {\n            'gross_rents':     round(gross_rents, 0),\n            'vacancy_loss':    round(vacancy_loss, 0),\n            'egi':             round(effective_gross_income, 0)\n        },\n        'expenses': {\n            'total_expenses':  round(total_expenses, 0),\n            'expense_ratio':   round(total_expenses\u002Feffective_gross_income*100, 1)\n        },\n        'noi':                 round(noi, 0),\n        'financing': {\n            'loan_amount':     round(loan_amount, 0),\n            'monthly_payment': round(monthly_mortgage, 0),\n            'annual_ds':       round(annual_debt_service, 0)\n        },\n        'returns': {\n            'cap_rate':        round(cap_rate * 100, 2),\n            'cash_on_cash':    round(cash_on_cash * 100, 2),\n            'grm':             round(grm, 2),\n            'dscr':            round(dscr, 2),\n            'ltv':             round(ltv * 100, 1),\n            'total_cash_in':   round(total_cash_in, 0),\n            'annual_cf':       round(annual_cash_flow, 0),\n            'monthly_cf':      round(annual_cash_flow\u002F12, 0)\n        },\n        'verdict': {\n            'cap_rate_check':  'Good' if cap_rate > 0.06 else 'Low',\n            'dscr_check':      'Safe' if dscr > 1.25 else 'Tight',\n            'coc_check':       'Good' if cash_on_cash > 0.08 else 'Low'\n        }\n    }\n\ndef cap_rate_benchmarks():\n    return {\n        'Single Family':      '4-6% (appreciation markets), 6-10% (cash flow markets)',\n        'Small Multifamily':  '5-7%',\n        'Large Multifamily':  '4-6% (class A), 6-9% (class C)',\n        'Retail':             '5-7% (grocery anchored), 7-10% (unanchored)',\n        'Office':             '5-8% (CBD), 7-10% (suburban)',\n        'Industrial':         '4-6% (logistics), 5-8% (flex)',\n        'Self Storage':       '5-7%',\n        'Hotel':              '7-10%',\n        'interpretation': {\n            'Low cap rate':   'Low risk, high demand market — less cash flow',\n            'High cap rate':  'Higher risk or lower demand — more cash flow',\n            'compression':    'Cap rates fall = values rise (like bond prices)'\n        }\n    }\n```\n\n---\n\n## Property Valuation Methods\n```python\ndef income_approach_valuation(noi, market_cap_rate):\n    \"\"\"\n    Income Approach: Value = NOI \u002F Cap Rate\n    Most common for income-producing properties.\n    \"\"\"\n    value = noi \u002F market_cap_rate\n    return {\n        'noi':            round(noi, 0),\n        'market_cap_rate':f\"{market_cap_rate*100:.2f}%\",\n        'estimated_value': round(value, 0),\n        'note':           '10bps cap rate change = ~1.5-2% value change'\n    }\n\ndef sales_comparison_approach(subject_property, comps):\n    \"\"\"\n    Sales comparison: adjust comp sales for differences.\n    Most common for residential.\n    \"\"\"\n    adjusted_prices = []\n    for comp in comps:\n        adj_price = comp['sale_price']\n\n        # Adjust for differences\n        sqft_diff = subject_property['sqft'] - comp['sqft']\n        adj_price += sqft_diff * comp.get('price_per_sqft', 150)\n\n        bed_diff   = subject_property['beds'] - comp['beds']\n        adj_price += bed_diff * 5000\n\n        bath_diff  = subject_property['baths'] - comp['baths']\n        adj_price += bath_diff * 3000\n\n        if subject_property.get('garage') and not comp.get('garage'):\n            adj_price += 15000\n        if subject_property.get('pool') and not comp.get('pool'):\n            adj_price += 20000\n\n        adjusted_prices.append(adj_price)\n\n    indicated_value = sum(adjusted_prices) \u002F len(adjusted_prices)\n    return {\n        'comp_values':      [round(p, 0) for p in adjusted_prices],\n        'indicated_value':  round(indicated_value, 0),\n        'value_range':      (round(min(adjusted_prices), 0),\n                             round(max(adjusted_prices), 0))\n    }\n\ndef gross_rent_multiplier(purchase_price, monthly_rent):\n    \"\"\"\n    GRM = Price \u002F Annual Rent\n    Quick filter — lower GRM = better deal.\n    Typical: 8-12x for residential.\n    \"\"\"\n    annual_rent = monthly_rent * 12\n    grm = purchase_price \u002F annual_rent\n    return {\n        'grm':          round(grm, 2),\n        'benchmark':    'Good' if grm \u003C 10 else 'Average' if grm \u003C 14 else 'High',\n        'implied_price_per_rent': round(purchase_price \u002F monthly_rent, 0)\n    }\n```\n\n---\n\n## Investment Strategies\n```python\ndef brrrr_analysis(purchase_price, rehab_cost, arv,\n                    rental_income, expenses, refi_ltv=0.75,\n                    refi_rate=0.07, refi_term=30):\n    \"\"\"\n    BRRRR Strategy: Buy, Rehab, Rent, Refinance, Repeat\n    Goal: Pull out most\u002Fall of initial capital after refinance.\n    \"\"\"\n    # Initial investment\n    total_invested     = purchase_price + rehab_cost\n    initial_equity     = total_invested  # assume all cash purchase\n\n    # After rehab value\n    forced_appreciation = arv - purchase_price\n    equity_created      = arv - total_invested\n\n    # Refinance\n    refi_loan_amount    = arv * refi_ltv\n    cash_out            = refi_loan_amount - total_invested\n    remaining_equity    = arv - refi_loan_amount\n\n    # Monthly mortgage on refi\n    monthly_rate        = refi_rate \u002F 12\n    n_payments          = refi_term * 12\n    monthly_mortgage    = refi_loan_amount * (\n        monthly_rate * (1+monthly_rate)**n_payments \u002F\n        ((1+monthly_rate)**n_payments - 1)\n    )\n\n    # Cash flow after refi\n    noi                 = rental_income * 12 - expenses\n    annual_ds           = monthly_mortgage * 12\n    annual_cf           = noi - annual_ds\n    cash_left_in        = max(0, total_invested - refi_loan_amount)\n\n    # Returns\n    coc = annual_cf \u002F cash_left_in if cash_left_in > 0 else float('inf')\n\n    return {\n        'buy_and_rehab': {\n            'purchase':         purchase_price,\n            'rehab':            rehab_cost,\n            'total_invested':   total_invested\n        },\n        'after_rehab': {\n            'arv':              arv,\n            'equity_created':   round(equity_created, 0),\n            'forced_appreciation': round(forced_appreciation, 0)\n        },\n        'refinance': {\n            'loan_amount':      round(refi_loan_amount, 0),\n            'cash_out':         round(cash_out, 0),\n            'monthly_payment':  round(monthly_mortgage, 0),\n            'cash_left_in':     round(cash_left_in, 0)\n        },\n        'returns': {\n            'annual_cash_flow': round(annual_cf, 0),\n            'cash_on_cash':     round(coc * 100, 2) if cash_left_in > 0 else 'Infinite',\n            'equity_remaining': round(remaining_equity, 0),\n            'strategy_verdict': 'Excellent' if cash_out > 0 else\n                               'Good'      if cash_left_in \u003C total_invested * 0.20 else\n                               'Marginal'\n        }\n    }\n\ndef house_hacking_analysis(purchase_price, units, rent_per_unit,\n                             owner_unit_market_rent, down_payment_pct=0.035):\n    \"\"\"\n    House hacking: live in one unit, rent out others.\n    Use FHA (3.5%) or conventional with owner-occupied financing.\n    \"\"\"\n    down_payment        = purchase_price * down_payment_pct\n    loan_amount         = purchase_price - down_payment\n    monthly_rate        = 0.07 \u002F 12\n    n_payments          = 360\n    monthly_mortgage    = loan_amount * (\n        monthly_rate * (1+monthly_rate)**n_payments \u002F\n        ((1+monthly_rate)**n_payments - 1)\n    )\n\n    rental_units        = units - 1  # owner occupies one\n    monthly_rent        = rental_units * rent_per_unit\n    effective_housing_cost = monthly_mortgage - monthly_rent\n\n    return {\n        'purchase_price':         purchase_price,\n        'down_payment':           round(down_payment, 0),\n        'monthly_mortgage':       round(monthly_mortgage, 0),\n        'rental_income':          round(monthly_rent, 0),\n        'effective_housing_cost': round(effective_housing_cost, 0),\n        'market_rent_savings':    round(owner_unit_market_rent -\n                                        effective_housing_cost, 0),\n        'verdict':                'Excellent' if effective_housing_cost \u003C 500 else\n                                  'Good'      if effective_housing_cost \u003C 1000 else\n                                  'Marginal'\n    }\n\ndef fix_and_flip_analysis(purchase_price, rehab_cost, arv,\n                           hold_months=6, financing_rate=0.12):\n    \"\"\"\n    Fix and flip profit analysis.\n    \"\"\"\n    # Costs\n    purchase_costs      = purchase_price * 0.02  # closing costs\n    financing_cost      = (purchase_price + rehab_cost) * \\\n                          financing_rate * (hold_months\u002F12)\n    holding_costs       = purchase_price * 0.01 * (hold_months\u002F12)  # taxes, insurance\n    selling_costs       = arv * 0.06  # agent commission + closing\n\n    total_costs         = (purchase_price + rehab_cost + purchase_costs +\n                           financing_cost + holding_costs + selling_costs)\n    gross_profit        = arv - total_costs\n    roi                 = gross_profit \u002F (purchase_price + rehab_cost)\n    annualized_roi      = roi * (12 \u002F hold_months)\n\n    mao = arv * 0.70 - rehab_cost  # Maximum Allowable Offer (70% rule)\n\n    return {\n        'arv':              arv,\n        'total_costs':      round(total_costs, 0),\n        'gross_profit':     round(gross_profit, 0),\n        'roi':              round(roi * 100, 2),\n        'annualized_roi':   round(annualized_roi * 100, 2),\n        'mao_70_rule':      round(mao, 0),\n        'paid_vs_mao':      'Good' if purchase_price \u003C= mao else 'Overpaid',\n        'cost_breakdown': {\n            'purchase':     purchase_price,\n            'rehab':        rehab_cost,\n            'financing':    round(financing_cost, 0),\n            'holding':      round(holding_costs, 0),\n            'selling':      round(selling_costs, 0)\n        }\n    }\n```\n\n---\n\n## Commercial Real Estate\n```python\ndef commercial_re_analysis(property_type, noi, purchase_price,\n                             loan_amount, interest_rate, loan_term):\n    \"\"\"\n    Commercial RE underwriting.\n    \"\"\"\n    cap_rate            = noi \u002F purchase_price\n    loan_constant       = (interest_rate \u002F 12 * (1 + interest_rate\u002F12)**\n                           (loan_term*12)) \u002F ((1+interest_rate\u002F12)**\n                           (loan_term*12) - 1) * 12\n    annual_ds           = loan_amount * loan_constant\n    dscr                = noi \u002F annual_ds\n    cash_flow           = noi - annual_ds\n    equity_invested     = purchase_price - loan_amount\n    coc                 = cash_flow \u002F equity_invested\n    ltv                 = loan_amount \u002F purchase_price\n\n    return {\n        'cap_rate':         round(cap_rate * 100, 2),\n        'dscr':             round(dscr, 2),\n        'ltv':              round(ltv * 100, 1),\n        'cash_on_cash':     round(coc * 100, 2),\n        'annual_noi':       round(noi, 0),\n        'annual_ds':        round(annual_ds, 0),\n        'annual_cf':        round(cash_flow, 0),\n        'lender_criteria': {\n            'dscr_min':     '1.20-1.25x typical minimum',\n            'ltv_max':      '65-75% typical for commercial',\n            'dscr_status':  'Lendable' if dscr >= 1.20 else 'Below threshold'\n        }\n    }\n\ndef commercial_property_types():\n    return {\n        'Multifamily': {\n            'cap_rates':    '4-6% class A, 6-9% class C',\n            'drivers':      'Employment, population growth, housing supply',\n            'metrics':      'Rent per unit, occupancy, rent growth',\n            'financing':    'Agency (Fannie\u002FFreddie) for 5+ units',\n            'pro':          'Recession resistant — people always need housing'\n        },\n        'Industrial': {\n            'cap_rates':    '4-6% logistics, 5-8% flex',\n            'drivers':      'E-commerce growth, supply chain reshoring',\n            'metrics':      'Clear height, dock doors, truck court depth',\n            'financing':    'CMBS, life insurance, bank',\n            'pro':          'Fastest growing CRE sector, low maintenance'\n        },\n        'Retail': {\n            'cap_rates':    '5-7% grocery anchored, 7-10%+ unanchored',\n            'drivers':      'Consumer spending, e-commerce threat',\n            'metrics':      'Sales per sq ft, occupancy cost ratio',\n            'financing':    'CMBS, bank, depends on credit of tenants',\n            'risk':         'E-commerce disruption, anchor tenant risk'\n        },\n        'Office': {\n            'cap_rates':    '5-8% CBD, 7-10% suburban',\n            'drivers':      'Employment, remote work trends',\n            'metrics':      'Occupancy, WALT (weighted avg lease term)',\n            'financing':    'CMBS, bank',\n            'risk':         'WFH secular headwind, high TI\u002FLC costs'\n        },\n        'Self Storage': {\n            'cap_rates':    '5-7%',\n            'drivers':      'Life events — moves, divorce, downsizing',\n            'metrics':      'Physical and economic occupancy, ECRI',\n            'pro':          'Low maintenance, recession resistant'\n        }\n    }\n```\n\n---\n\n## REITs\n```python\ndef reit_valuation(reit_data):\n    \"\"\"\n    REIT-specific valuation metrics.\n    \"\"\"\n    # FFO = Net Income + D&A - Gains on Property Sales\n    ffo     = (reit_data['net_income'] +\n               reit_data['depreciation'] -\n               reit_data['gains_on_sales'])\n\n    # AFFO = FFO - Recurring Capex - Straight Line Rent\n    affo    = ffo - reit_data['recurring_capex'] - \\\n              reit_data.get('straight_line_rent', 0)\n\n    shares  = reit_data['shares_outstanding']\n    price   = reit_data['share_price']\n    mkt_cap = price * shares\n\n    ffo_per_share   = ffo \u002F shares\n    affo_per_share  = affo \u002F shares\n    price_to_ffo    = price \u002F ffo_per_share\n    price_to_affo   = price \u002F affo_per_share\n    dividend_yield  = reit_data['annual_dividend'] \u002F price\n    payout_ratio    = reit_data['annual_dividend'] \u002F affo_per_share\n\n    # NAV approach\n    nav             = reit_data['noi'] \u002F reit_data['market_cap_rate']\n    nav_per_share   = (nav - reit_data['total_debt'] +\n                       reit_data['cash']) \u002F shares\n    premium_to_nav  = (price - nav_per_share) \u002F nav_per_share\n\n    return {\n        'ffo_per_share':    round(ffo_per_share, 2),\n        'affo_per_share':   round(affo_per_share, 2),\n        'price_to_ffo':     round(price_to_ffo, 2),\n        'price_to_affo':    round(price_to_affo, 2),\n        'dividend_yield':   round(dividend_yield * 100, 2),\n        'payout_ratio':     round(payout_ratio * 100, 1),\n        'nav_per_share':    round(nav_per_share, 2),\n        'premium_to_nav':   round(premium_to_nav * 100, 1),\n        'valuation':        'Cheap'     if premium_to_nav \u003C -0.10 else\n                            'Fair'      if premium_to_nav \u003C 0.10 else\n                            'Expensive'\n    }\n\ndef reit_sectors():\n    return {\n        'Data Centers':     'EQIX, DLR — AI\u002Fcloud demand driver',\n        'Industrial':       'PLD, REXR — e-commerce logistics',\n        'Residential':      'EQR, AVB, MAA — apartment REITs',\n        'Self Storage':     'PSA, EXR, CUBE',\n        'Healthcare':       'WELL, VTR — senior housing, medical office',\n        'Net Lease':        'O, NNN — single tenant, long leases',\n        'Office':           'BXP, SLG — headwind from WFH',\n        'Retail Mall':      'SPG, MAC — challenged by e-commerce',\n        'Hotel':            'HST, PK — cyclical, COVID risk',\n        'Mortgage REITs':   'AGNC, NLY — interest rate sensitive'\n    }\n```\n\n---\n\n## Tax Benefits\n```python\ndef tax_benefits_analysis(property_value, land_value_pct=0.20,\n                           annual_income=50_000, tax_rate=0.37,\n                           hold_years=5):\n    \"\"\"\n    Real estate tax benefits analysis.\n    \"\"\"\n    building_value      = property_value * (1 - land_value_pct)\n    annual_depreciation = building_value \u002F 27.5  # residential\n    tax_shield          = annual_depreciation * tax_rate\n    total_depreciation  = annual_depreciation * hold_years\n\n    return {\n        'annual_depreciation':  round(annual_depreciation, 0),\n        'annual_tax_shield':    round(tax_shield, 0),\n        'total_tax_savings':    round(tax_shield * hold_years, 0),\n        'effective_yield_boost': round(tax_shield \u002F property_value * 100, 2),\n        'note':                 'Depreciation recaptured at 25% on sale — plan accordingly'\n    }\n\ndef exchange_1031_analysis(sale_price, adjusted_basis, new_property_price,\n                             capital_gains_rate=0.20, depreciation_recapture=0.25):\n    \"\"\"\n    1031 Exchange: defer capital gains by reinvesting in like-kind property.\n    \"\"\"\n    gain                = sale_price - adjusted_basis\n    depreciation_taken  = adjusted_basis * 0.30  # approximate\n    recapture_tax       = depreciation_taken * depreciation_recapture\n    capital_gains_tax   = (gain - depreciation_taken) * capital_gains_rate\n    total_tax_without   = recapture_tax + capital_gains_tax\n\n    # With 1031 — defer all taxes\n    additional_buying_power = total_tax_without\n\n    return {\n        'sale_price':           sale_price,\n        'adjusted_basis':       adjusted_basis,\n        'total_gain':           round(gain, 0),\n        'tax_without_1031':     round(total_tax_without, 0),\n        'tax_with_1031':        0,\n        'tax_deferral':         round(total_tax_without, 0),\n        'buying_power_preserved':round(sale_price, 0),\n        'buying_power_without': round(sale_price - total_tax_without, 0),\n        'rules': [\n            '45 days to identify replacement property',\n            '180 days to close on replacement',\n            'Must be like-kind property',\n            'Must use qualified intermediary',\n            'New property must be >= sale price'\n        ]\n    }\n```\n\n---\n\n## Market Analysis\n```python\ndef market_analysis_framework():\n    return {\n        'Macro Indicators': [\n            'Population growth rate (>1% = strong)',\n            'Job growth and employment diversity',\n            'Median household income trends',\n            'Net migration (in vs out)',\n            'GDP growth of metro area'\n        ],\n        'Supply Indicators': [\n            'Building permits (high = oversupply risk)',\n            'Vacancy rates by property type',\n            'Months of housing supply',\n            'Construction costs vs rents',\n            'Zoning regulations (supply restrictions)'\n        ],\n        'Demand Indicators': [\n            'Rent growth rates (YoY)',\n            'Absorption rate of new units',\n            'Home price appreciation',\n            'Rental vs ownership cost comparison',\n            'Employer announcements'\n        ],\n        'Best Markets to Watch': {\n            'Sunbelt':      'High migration, job growth, relatively affordable',\n            'Secondary':    'Less competition, higher cap rates, emerging growth',\n            'Avoid':        'High vacancy, population outflow, single employer towns'\n        }\n    }\n\ndef rent_vs_buy_comparison(rent, purchase_price, down_payment_pct=0.20,\n                             mortgage_rate=0.07, appreciation=0.03,\n                             hold_years=7):\n    \"\"\"\n    Rent vs buy financial comparison.\n    \"\"\"\n    # Buying costs\n    down_payment        = purchase_price * down_payment_pct\n    loan                = purchase_price - down_payment\n    monthly_rate        = mortgage_rate \u002F 12\n    n                   = 30 * 12\n    monthly_mortgage    = loan * (monthly_rate*(1+monthly_rate)**n \u002F\n                                   ((1+monthly_rate)**n-1))\n    property_tax        = purchase_price * 0.012 \u002F 12\n    insurance           = purchase_price * 0.005 \u002F 12\n    maintenance         = purchase_price * 0.01 \u002F 12\n    monthly_own_cost    = monthly_mortgage + property_tax + insurance + maintenance\n\n    # Renting costs\n    monthly_rent_cost   = rent\n\n    # Net worth after hold_years\n    future_value        = purchase_price * (1+appreciation)**hold_years\n    remaining_loan      = loan * ((1+monthly_rate)**(n) - (1+monthly_rate)**(hold_years*12)) \u002F \\\n                          ((1+monthly_rate)**n - 1)\n    home_equity         = future_value - remaining_loan - down_payment\n    rent_savings        = (monthly_own_cost - monthly_rent_cost) * 12 * hold_years\n    investment_return   = rent_savings * (1.07**hold_years)  # if invested\n\n    return {\n        'monthly_own_cost':     round(monthly_own_cost, 0),\n        'monthly_rent':         round(monthly_rent_cost, 0),\n        'monthly_difference':   round(monthly_own_cost - monthly_rent_cost, 0),\n        'home_equity_built':    round(home_equity, 0),\n        'break_even_years':     round(down_payment \u002F (monthly_own_cost - rent) \u002F 12, 1)\n                                if monthly_own_cost > rent else 'Immediate',\n        'verdict':              'Buy' if home_equity > investment_return else 'Rent'\n    }\n```\n\n---\n\n## Common Pitfalls\n\n| Pitfall | Problem | Fix |\n|---|---|---|\n| Underestimating expenses | Negative cash flow surprises | Use 50% rule as quick check |\n| Ignoring vacancy | Assume 100% occupancy | Always model 5-8% vacancy minimum |\n| Over-leveraging | Rate rise or vacancy kills cash flow | DSCR > 1.25, stress test rates |\n| Skipping due diligence | Hidden repairs, legal issues | Always inspect, title search, environmental |\n| Emotional buying | Overpay for nice property | Numbers must work — never fall in love |\n| Ignoring market cycles | Buy at peak, forced to sell at bottom | Study local market supply\u002Fdemand |\n| Self-managing too many | Time cost kills returns | Hire property management at scale |\n\n---\n\n## Best Practices\n\n- **Cash flow first** — appreciation is a bonus, not a plan\n- **50% rule quick filter** — expenses typically 50% of gross rent\n- **DSCR above 1.25** — leave room for vacancies and rate increases\n- **Location drives appreciation** — jobs, schools, infrastructure\n- **Screen tenants thoroughly** — evictions cost $3,000-$10,000+\n- **Build reserves** — 3-6 months expenses in liquid reserve\n- **Scale systematically** — master one market before expanding\n\n---\n\n## Related Skills\n\n- **finance-trading-expert**: REIT trading and analysis\n- **financial-modeling-expert**: Real estate pro forma models\n- **risk-management-expert**: Portfolio risk and leverage\n- **macro-economics-expert**: Interest rate impact on real estate\n- **portfolio-management-expert**: Real estate in overall portfolio\n",{"name":5,"author":42,"license":15,"metadata":43,"description":7},"luo-kai",{"author":44,"version":45,"category":35},"luokai25","1.0","main","4d2fb89cdfb75f3f6fd3c6c5ec9ad90ea129eb3c","ai-agent-skills\u002F12-finance-and-trading (by Luo Kai)\u002F09-real-estate\u002Freal-estate-investing-expert",1,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai","https:\u002F\u002Fgithub.com\u002Fluokai0","a solo builder.","2026-05-06 04:29:04",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill real-estate-investing-expert",{"tool":60,"command":61},"bunx","bunx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill real-estate-investing-expert",{"tool":63,"command":64},"pnpm","pnpm dlx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill real-estate-investing-expert","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F12-finance-and-trading (by Luo Kai)\u002F09-real-estate\u002Freal-estate-investing-expert\u002FSKILL.md",true,[68],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"HTML飞盘.html","REFERENCE","参考文档",12869,"https:\u002F\u002Fgithub.com\u002FFeatherHunter\u002FSKILLS\u002Fblob\u002Fmain\u002FHTML飞盘\u002FHTML飞盘.html",[75,102,119,149,181,218],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":37},"01M6F2SKTE208174C7S7JJCZC7","write-contracts","Generates secure Aptos Move V2 smart contracts with Object model, Digital Asset integration, security patterns, and storage type guidance. Includes comprehensive storage decision framework for optimal data structure selection. Triggers on: 'write contract', 'create NFT collection', 'build marketplace', 'implement minting', 'generate Move module', 'create token contract', 'build DAO', 'implement staking'. Ask storage questions when: 'store', 'track', 'registry', 'mapping', 'list', 'collection'.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fwrite-contracts\u002FSKILL.md",[],[82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101],"write","contracts","write contracts","storage","secure","create","generate","collection","model","decision","ask","smart-contracts","selection","objects","structure","nft","token","aptos","critical","move",{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":37},"01M6F2RFXJ6T9MKW0A7N7GM45B","web-search","通用网络搜索技能，支持多引擎搜索（百度、必应、DuckDuckGo），无需API密钥即可获取实时信息","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fweb-search-ex-skill\u002FSKILL.md",[],[109,110,111,112,113,114,115,116,117,118],"web","search","web search","搜索","baidu","bing","duckduckgo","百度","多引擎","internet",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":130,"publishedAt":37},"01M6F2K968G1FZEZFPW2E6B222","solo-build","Execute implementation plan tasks with TDD workflow, auto-commit, and phase gates. Use when user says \"build it\", \"start building\", \"execute plan\", \"implement tasks\", \"ship it\", or references a track ID. Do NOT use for planning (use \u002Fplan) or scaffolding (use \u002Fscaffold).","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fsolo-build\u002FSKILL.md",[125],{"categoryNo":126,"categoryName":127,"taxonomyType":128,"taxonomyTypeDesc":129},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[131,132,133,134,135,136,137,138,110,139,140,141,82,142,143,144,145,146,147,148],"build","solo","solo build","MCP","workflow","commit","tasks","code","Bash","plan","read","auto","references","context7","query","scaffolding","ship it","project",{"skillNo":150,"name":151,"nameZh":6,"description":152,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":153,"categories":154,"keywords":161,"publishedAt":37},"01M6F2GKN39SGHSPWYB3662YC8","react-email","Use when building HTML email templates with React components, adding a visual email editor to an application using the React Email visual editor, rendering emails to HTML, or sending emails with Resend. Covers welcome emails, password resets, notifications, order confirmations, newsletters, transactional emails, and the embeddable email editor component.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Freact-email-skills\u002FSKILL.md",[155,158],{"categoryNo":156,"categoryName":157,"taxonomyType":128,"taxonomyTypeDesc":129},"01JBSEEDCAT000000000000005","邮件与沟通",{"categoryNo":159,"categoryName":160,"taxonomyType":128,"taxonomyTypeDesc":129},"01JBSEEDCAT000000000000009","前端开发",[162,163,164,165,166,167,168,169,170,171,172,173,174,27,175,176,177,178,179,180],"react","email","react email","github","editor","components","react components","component","welcome","https","notifications","password","node","html","resend","visual","emails","rendering","with",{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":199,"publishedAt":37},"01M6F2FBVGVDFSG8SSFJGXA40C","APITester Agent-Driven API Testing","Test API endpoints and document responses. Define tests in plain English, run them, get formatted results. Agent-driven Postman alternative.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fopenclaw-api-tester\u002FSKILL.md",[187,190,193,194],{"categoryNo":188,"categoryName":189,"taxonomyType":128,"taxonomyTypeDesc":129},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":191,"categoryName":192,"taxonomyType":128,"taxonomyTypeDesc":129},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":126,"categoryName":127,"taxonomyType":128,"taxonomyTypeDesc":129},{"categoryNo":195,"categoryName":196,"taxonomyType":197,"taxonomyTypeDesc":198},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217],"testing","api","api testing","driven","APITester Agent Driven API Testing","test","run","postman","results","plain english","tester","endpoints","document","get","define","tests","english","api-tester",{"skillNo":219,"name":220,"nameZh":6,"description":221,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":222,"categories":223,"keywords":224,"publishedAt":37},"01M6F273Y3NGAPVJZ608BC0G9G","hubspot-implementation-plan","Generate a phased implementation plan from a HubSpot audit report. Creates prioritized, sequenced cleanup processes with effort estimates, dependencies, and automation feasibility. Use after running \u002Fhubspot-audit.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fhubspot-implementation-plan\u002FSKILL.md",[],[140,225,226,227,228,229,230,88,231,232,233,234,235,27,236,237,180,238],"implementation","hubspot","hubspot implementation plan","automation","feasibility","cleanup","planning","report","audit","audit report","phased implementation","dependencies","processes","hubspot audit"]