[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M713EH2RZCSC20PH2W5YBB6B":3,"skill-same:01M713EH2RZCSC20PH2W5YBB6B":102},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":6,"ownerDescription":50,"updatedAt":51,"install":52,"resources":65},"01M713EH2RZCSC20PH2W5YBB6B","policyengine-uk",null,"ALWAYS LOAD THIS SKILL FIRST before writing any PolicyEngine-UK code.\nContains the correct API patterns for household calculations and population simulations\nusing the new policyengine package (not policyengine_uk directly).\nTriggers: \"what would\", \"how much would a\", \"benefit be\", \"eligible for\", \"qualify for\",\n\"single parent\", \"married couple\", \"family of\", \"household of\", \"if they earn\", \"with income of\",\n\"earning £\", \"making £\", \"calculate benefits\", \"calculate taxes\", \"benefit for a\", \"tax for a\",\n\"what would I get\", \"what would they get\", \"what is the rate\", \"what is the threshold\",\n\"personal allowance\", \"maximum benefit\", \"income limit\", \"benefit amount\", \"how much is\",\n\"Universal Credit\", \"child benefit\", \"pension credit\", \"housing benefit\", \"council tax\",\n\"income tax\", \"national insurance\", \"JSA\", \"ESA\", \"PIP\", \"disability living allowance\",\n\"working tax credit\", \"child tax credit\", \"Scotland\", \"Wales\", \"UK\",\n\"microsimulation\", \"population\", \"reform\", \"policy impact\", \"budgetary\", \"decile\".","FDU-INS\u002FInsurance-Skills","FDU-INS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F167067594?v=4","01M6XEYMRS4CVJMZ834YWE66BV","FDU-Insurance","01M6XEYMXPDA34HFM0ZE6AY78G",82,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fpolicyengine-uk\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"policyengine uk","impact","new","Simulations","insurance","rate","child","limit","benefits","qualify","writing","get","patterns","calculate","how","api","api patterns","code","council","personal","2026-11-10 10:12:30",false,"---\nname: policyengine-uk\ndescription: |\n  ALWAYS LOAD THIS SKILL FIRST before writing any PolicyEngine-UK code.\n  Contains the correct API patterns for household calculations and population simulations\n  using the new policyengine package (not policyengine_uk directly).\n  Triggers: \"what would\", \"how much would a\", \"benefit be\", \"eligible for\", \"qualify for\",\n  \"single parent\", \"married couple\", \"family of\", \"household of\", \"if they earn\", \"with income of\",\n  \"earning £\", \"making £\", \"calculate benefits\", \"calculate taxes\", \"benefit for a\", \"tax for a\",\n  \"what would I get\", \"what would they get\", \"what is the rate\", \"what is the threshold\",\n  \"personal allowance\", \"maximum benefit\", \"income limit\", \"benefit amount\", \"how much is\",\n  \"Universal Credit\", \"child benefit\", \"pension credit\", \"housing benefit\", \"council tax\",\n  \"income tax\", \"national insurance\", \"JSA\", \"ESA\", \"PIP\", \"disability living allowance\",\n  \"working tax credit\", \"child tax credit\", \"Scotland\", \"Wales\", \"UK\",\n  \"microsimulation\", \"population\", \"reform\", \"policy impact\", \"budgetary\", \"decile\".\n---\n\n# PolicyEngine-UK\n\n> **IMPORTANT: Always use the current year (2026) in calculations, not 2024 or 2025.**\n\nPolicyEngine-UK models the UK tax and benefit system, including devolved variations for Scotland and Wales.\n\n## For Users\n\n### What is PolicyEngine-UK?\n\nPolicyEngine-UK is the \"calculator\" for UK taxes and benefits. When you use policyengine.org\u002Fuk, PolicyEngine-UK runs behind the scenes.\n\n**What it models:**\n\n**Direct taxes:**\n- Income tax (UK-wide, Scottish, and Welsh variations)\n- National Insurance (Classes 1, 2, 4)\n- Capital gains tax, Dividend tax\n\n**Property and transaction taxes:**\n- Council Tax\n- Stamp Duty Land Tax (England\u002FNI)\n- Land and Buildings Transaction Tax (Scotland)\n- Land Transaction Tax (Wales)\n\n**Universal Credit:**\n- Standard allowance, Child elements, Housing cost element\n- Childcare costs element, Carer element, Work capability elements\n\n**Legacy benefits (being phased out):**\n- Working Tax Credit, Child Tax Credit, Income Support\n- Income-based JSA\u002FESA, Housing Benefit\n\n**Other benefits:**\n- Child Benefit, Pension Credit, PIP, DLA, Attendance Allowance, State Pension\n\n**See full list:** https:\u002F\u002Fpolicyengine.org\u002Fuk\u002Fparameters\n\n### Understanding Variables\n\n**Income variables:**\n- `employment_income` - Gross employment earnings\u002Fsalary\n- `self_employment_income` - Self-employment profits\n- `pension_income` - Private pension income\n- `property_income` - Rental income\n- `savings_interest_income` - Interest from savings\n- `dividend_income` - Dividend income\n\n**Tax variables:**\n- `income_tax` - Total income tax liability\n- `national_insurance` - Total NI contributions\n- `council_tax` - Council tax liability\n\n**Benefit variables:**\n- `universal_credit` - Universal Credit amount\n- `child_benefit` - Child Benefit amount\n- `pension_credit` - Pension Credit amount\n\n**Summary variables:**\n- `household_net_income` - Income after taxes and benefits\n- `hbai_household_net_income` - HBAI-definition net income\n\n## For Analysts\n\n### Installation\n\n```bash\nuv pip install policyengine\n```\n\n### Two Modes of Analysis\n\nPolicyEngine provides two main ways to analyze the UK tax-benefit system:\n\n1. **Household Calculations** - Single household, quick answers\n2. **Population Simulations** - Microsimulation, policy analysis at scale\n\n---\n\n## 1. Household Calculations\n\nUse `calculate_household_impact()` with `UKHouseholdInput` for quick single-household calculations.\n\n### Basic Pattern\n\n```python\nfrom policyengine.tax_benefit_models.uk import (\n    UKHouseholdInput,\n    calculate_household_impact,\n)\n\nhousehold = UKHouseholdInput(\n    people=[\n        {\"age\": 35, \"employment_income\": 50_000},\n    ],\n    year=2026,\n)\nresult = calculate_household_impact(household)\n\n# Access results\nprint(f\"Income tax: £{result.person[0]['income_tax']:,.0f}\")\nprint(f\"Net income: £{result.household['hbai_household_net_income']:,.0f}\")\n```\n\n### Single Person\n\n```python\nhousehold = UKHouseholdInput(\n    people=[{\"age\": 30, \"employment_income\": 30_000}],\n    household={\"region\": \"LONDON\"},\n    year=2026,\n)\nresult = calculate_household_impact(household)\n```\n\n### Couple with Children\n\n```python\nhousehold = UKHouseholdInput(\n    people=[\n        {\"age\": 35, \"employment_income\": 50_000},\n        {\"age\": 33, \"employment_income\": 25_000},\n        {\"age\": 8},\n        {\"age\": 5},\n    ],\n    benunit={\"would_claim_uc\": True},\n    household={\"region\": \"NORTH_WEST\"},\n    year=2026,\n)\nresult = calculate_household_impact(household)\n\nprint(f\"Child Benefit: £{result.benunit[0]['child_benefit']:,.0f}\")\nprint(f\"Universal Credit: £{result.benunit[0]['universal_credit']:,.0f}\")\n```\n\n### With Housing Costs\n\n```python\nhousehold = UKHouseholdInput(\n    people=[{\"age\": 28, \"employment_income\": 25_000}],\n    benunit={\"would_claim_uc\": True},\n    household={\"region\": \"LONDON\", \"rent\": 15_000},\n    year=2026,\n)\nresult = calculate_household_impact(household)\n```\n\n### Accessing Results\n\nResults are organized by entity level:\n- `result.person[i]` - Person-level variables (indexed by person order)\n- `result.benunit[i]` - Benefit unit variables\n- `result.household` - Household-level variables\n\n```python\n# Person-level (returns dict for each person)\nincome_tax = result.person[0]['income_tax']\nni = result.person[0]['national_insurance']\n\n# Benefit unit level\nuc = result.benunit[0]['universal_credit']\nchild_benefit = result.benunit[0]['child_benefit']\n\n# Household level\nnet_income = result.household['hbai_household_net_income']\n```\n\n---\n\n## 2. Population Simulations\n\nUse `Simulation` with datasets for population-level microsimulation analysis.\n\n### Loading Data\n\n```python\nfrom policyengine.tax_benefit_models.uk import (\n    uk_latest,\n    ensure_datasets,\n    PolicyEngineUKDataset,\n)\n\n# Load pre-prepared datasets\ndatasets = ensure_datasets(\n    data_folder=\".\u002Fdata\",\n    years=[2026, 2027, 2028, 2029, 2030],\n)\ndataset = datasets[\"enhanced_frs_2023_24_2026\"]\n```\n\n### Running Simulations\n\n```python\nfrom policyengine.core import Simulation\n\nsimulation = Simulation(\n    dataset=dataset,\n    tax_benefit_model_version=uk_latest,\n)\nsimulation.ensure()  # Runs if not cached, loads if cached\n\n# Access output data (weighted MicroDataFrames)\noutput = simulation.output_dataset.data\nincome_tax_total = output.household['household_tax'].sum()\nmean_net_income = output.household['household_net_income'].mean()\n```\n\n### Key Points for Population Simulations\n\n- `simulation.ensure()` runs the simulation if not cached, or loads from cache\n- Output data in `simulation.output_dataset.data` contains weighted MicroDataFrames\n- **Never strip weights** - keep results as MicroSeries and use `.sum()`, `.mean()` directly\n- Access by entity: `output.person`, `output.benunit`, `output.household`\n\n---\n\n## Policy Reforms\n\n### Parametric Reforms (ParameterValue)\n\nFor simple parameter changes:\n\n```python\nfrom policyengine.core import Policy, ParameterValue\nfrom datetime import datetime\n\n# Get parameter from model\nparam = uk_latest.get_parameter(\"gov.hmrc.income_tax.rates.uk[0].rate\")\n\npolicy = Policy(\n    name=\"Basic rate 25%\",\n    parameter_values=[\n        ParameterValue(\n            parameter=param,\n            value=0.25,\n            start_date=datetime(2026, 1, 1),\n        )\n    ],\n)\n\n# Run reform simulation\nreform_sim = Simulation(\n    dataset=dataset,\n    tax_benefit_model_version=uk_latest,\n    policy=policy,\n)\nreform_sim.ensure()\n```\n\n### Simulation Modifier Reforms (Complex\u002FProgrammatic)\n\nFor complex reforms that need programmatic control:\n\n```python\ndef my_reform_modifier(sim):\n    \"\"\"Modify the underlying policyengine_uk Microsimulation.\"\"\"\n    # Modify parameters\n    sim.tax_benefit_system.parameters.get_child(\n        \"gov.dwp.universal_credit.elements.child.limit.child_count\"\n    ).update(period=\"year:2026:10\", value=float('inf'))\n\n    # Or modify inputs\n    employment_income = sim.calculate(\"employment_income\", 2026)\n    sim.set_input(\"employment_income\", 2026, employment_income * 1.05)\n\n    sim.tax_benefit_system.reset_parameter_caches()\n\npolicy = Policy(\n    name=\"Complex reform\",\n    simulation_modifier=my_reform_modifier,\n)\n```\n\n### Combining Policies\n\n```python\npolicy_combined = policy_a + policy_b  # Chains modifiers\n```\n\n---\n\n## Analysis Patterns\n\n### Decile Impacts\n\n```python\nfrom policyengine.outputs.decile_impact import calculate_decile_impacts\n\nresults = calculate_decile_impacts(\n    dataset=dataset,\n    tax_benefit_model_version=uk_latest,\n    baseline_policy=None,  # Current law\n    reform_policy=my_policy,\n)\n# Returns OutputCollection with .dataframe and .outputs\n```\n\n### Economic Impact Analysis\n\n```python\nfrom policyengine.tax_benefit_models.uk.analysis import economic_impact_analysis\n\nanalysis = economic_impact_analysis(\n    baseline_simulation=baseline_sim,\n    reform_simulation=reform_sim,\n)\n# Returns PolicyReformAnalysis with:\n# - decile_impacts\n# - programme_statistics\n# - baseline_poverty \u002F reform_poverty\n# - baseline_inequality \u002F reform_inequality\n```\n\n### Aggregate Statistics\n\n```python\nfrom policyengine.outputs.aggregate import Aggregate, AggregateType\n\nagg = Aggregate(\n    simulation=simulation,\n    variable=\"universal_credit\",\n    aggregate_type=AggregateType.SUM,\n    entity=\"benunit\",\n)\nagg.run()\nprint(f\"Total UC spending: £{agg.result \u002F 1e9:.1f}bn\")\n```\n\n---\n\n## Parameter Lookup\n\nFor quick parameter lookups (rates, thresholds), use the old API directly:\n\n```python\nfrom policyengine_uk import CountryTaxBenefitSystem\n\nparams = CountryTaxBenefitSystem().parameters\n\n# Personal allowance\npa = params.gov.hmrc.income_tax.allowances.personal_allowance.amount(\"2026-01-01\")\n\n# Basic rate (use .children[\"N\"] for brackets)\nbasic_rate = params.gov.hmrc.income_tax.rates.uk.brackets.children[\"0\"].rate(\"2026-01-01\")\n\n# UC standard allowance\nuc_standard = params.gov.dwp.universal_credit.elements.standard_allowance.amount.single.over_25(\"2026-01-01\")\n```\n\n**When to use parameter lookup vs simulation:**\n- **Parameter lookup**: \"What is the personal allowance?\", \"What is the basic rate?\"\n- **Simulation**: \"What would my tax be if I earn £30k?\", \"Am I eligible for UC?\"\n\n---\n\n## Regions\n\nUK uses ITL 1 regions:\n- `NORTH_EAST`, `NORTH_WEST`, `YORKSHIRE`, `EAST_MIDLANDS`, `WEST_MIDLANDS`\n- `EAST_OF_ENGLAND`, `LONDON`, `SOUTH_EAST`, `SOUTH_WEST`\n- `WALES`, `SCOTLAND`, `NORTHERN_IRELAND`\n\n**Regional Tax Variations:**\n- **Scotland:** 6 bands (starter 19%, basic 20%, intermediate 21%, higher 42%, advanced 45%, top 47%)\n- **Wales:** Welsh Rate of Income Tax (WRIT), currently at parity with England\n- **England\u002FNI:** Standard UK rates (20%, 40%, 45%)\n\n---\n\n## Common Pitfalls\n\n### 1. Don't Strip Weights from MicroSeries\n```python\n# WRONG - strips weights\nvalues = output.household['income_tax'].values\nmean = values.mean()  # Unweighted!\n\n# CORRECT - keep as MicroSeries\nmean = output.household['income_tax'].mean()  # Weighted\n```\n\n### 2. Use .ensure() for Cached Runs\n```python\nsimulation.ensure()  # Loads from cache if available\n# NOT simulation.run() unless you want to force re-run\n```\n\n### 3. Parameter Paths Use Bracket Notation\n```python\n# New API uses brackets: uk[0].rate\nparam = uk_latest.get_parameter(\"gov.hmrc.income_tax.rates.uk[0].rate\")\n\n# Old API uses .children[\"N\"]\nparams.gov.hmrc.income_tax.rates.uk.brackets.children[\"0\"].rate(\"2026-01-01\")\n```\n\n### 4. Household Input Uses List of Dicts\n```python\n# New API - list of person dicts\nUKHouseholdInput(people=[{\"age\": 35}, {\"age\": 8}], ...)\n\n# Old API - nested situation dict (still works for old Simulation)\n{\"people\": {\"person1\": {\"age\": {2026: 35}}, ...}}\n```\n\n---\n\n## For Contributors\n\n### Repository\n\n**Location:** PolicyEngine\u002Fpolicyengine-uk\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FPolicyEngine\u002Fpolicyengine-uk\ncd policyengine-uk\n```\n\n**Key directories:**\n- `policyengine_uk\u002Fvariables\u002F` - Tax and benefit calculations\n- `policyengine_uk\u002Fparameters\u002F` - Policy rules (YAML)\n- `policyengine_uk\u002Freforms\u002F` - Pre-defined reforms\n- `policyengine_uk\u002Ftests\u002F` - Test cases\n\n### UK Legislation References\n\nAll UK parameters MUST have legislation.gov.uk references with exact section links.\n\n**Primary legislation:**\n- Welfare Reform Act 2012 - Universal Credit\n- Social Security Contributions and Benefits Act 1992\n- Income Tax Act 2007\n\n**Secondary legislation:**\n- Universal Credit Regulations 2013 (SI 2013\u002F376)\n- Income Tax (Earnings and Pensions) Act 2003\n\n**Reference format:**\n```yaml\nmetadata:\n  reference:\n    - title: Universal Credit Regulations 2013, Schedule 4, Table 3\n      href: https:\u002F\u002Fwww.legislation.gov.uk\u002Fuksi\u002F2013\u002F376\u002Fschedule\u002F4\n```\n\n---\n\n## Additional Resources\n\n- **Documentation:** https:\u002F\u002Fpolicyengine.org\u002Fuk\u002Fdocs\n- **Variable Explorer:** https:\u002F\u002Fpolicyengine.org\u002Fuk\u002Fvariables\n- **Parameter Explorer:** https:\u002F\u002Fpolicyengine.org\u002Fuk\u002Fparameters\n- **API Reference:** https:\u002F\u002Fgithub.com\u002FPolicyEngine\u002Fpolicyengine-uk\n","# PolicyEngine-UK\n\n> **IMPORTANT: Always use the current year (2026) in calculations, not 2024 or 2025.**\n\nPolicyEngine-UK models the UK tax and benefit system, including devolved variations for Scotland and Wales.\n\n## For Users\n\n### What is PolicyEngine-UK?\n\nPolicyEngine-UK is the \"calculator\" for UK taxes and benefits. When you use policyengine.org\u002Fuk, PolicyEngine-UK runs behind the scenes.\n\n**What it models:**\n\n**Direct taxes:**\n- Income tax (UK-wide, Scottish, and Welsh variations)\n- National Insurance (Classes 1, 2, 4)\n- Capital gains tax, Dividend tax\n\n**Property and transaction taxes:**\n- Council Tax\n- Stamp Duty Land Tax (England\u002FNI)\n- Land and Buildings Transaction Tax (Scotland)\n- Land Transaction Tax (Wales)\n\n**Universal Credit:**\n- Standard allowance, Child elements, Housing cost element\n- Childcare costs element, Carer element, Work capability elements\n\n**Legacy benefits (being phased out):**\n- Working Tax Credit, Child Tax Credit, Income Support\n- Income-based JSA\u002FESA, Housing Benefit\n\n**Other benefits:**\n- Child Benefit, Pension Credit, PIP, DLA, Attendance Allowance, State Pension\n\n**See full list:** https:\u002F\u002Fpolicyengine.org\u002Fuk\u002Fparameters\n\n### Understanding Variables\n\n**Income variables:**\n- `employment_income` - Gross employment earnings\u002Fsalary\n- `self_employment_income` - Self-employment profits\n- `pension_income` - Private pension income\n- `property_income` - Rental income\n- `savings_interest_income` - Interest from savings\n- `dividend_income` - Dividend income\n\n**Tax variables:**\n- `income_tax` - Total income tax liability\n- `national_insurance` - Total NI contributions\n- `council_tax` - Council tax liability\n\n**Benefit variables:**\n- `universal_credit` - Universal Credit amount\n- `child_benefit` - Child Benefit amount\n- `pension_credit` - Pension Credit amount\n\n**Summary variables:**\n- `household_net_income` - Income after taxes and benefits\n- `hbai_household_net_income` - HBAI-definition net income\n\n## For Analysts\n\n### Installation\n\n```bash\nuv pip install policyengine\n```\n\n### Two Modes of Analysis\n\nPolicyEngine provides two main ways to analyze the UK tax-benefit system:\n\n1. **Household Calculations** - Single household, quick answers\n2. **Population Simulations** - Microsimulation, policy analysis at scale\n\n---\n\n## 1. Household Calculations\n\nUse `calculate_household_impact()` with `UKHouseholdInput` for quick single-household calculations.\n\n### Basic Pattern\n\n```python\nfrom policyengine.tax_benefit_models.uk import (\n    UKHouseholdInput,\n    calculate_household_impact,\n)\n\nhousehold = UKHouseholdInput(\n    people=[\n        {\"age\": 35, \"employment_income\": 50_000},\n    ],\n    year=2026,\n)\nresult = calculate_household_impact(household)\n\n# Access results\nprint(f\"Income tax: £{result.person[0]['income_tax']:,.0f}\")\nprint(f\"Net income: £{result.household['hbai_household_net_income']:,.0f}\")\n```\n\n### Single Person\n\n```python\nhousehold = UKHouseholdInput(\n    people=[{\"age\": 30, \"employment_income\": 30_000}],\n    household={\"region\": \"LONDON\"},\n    year=2026,\n)\nresult = calculate_household_impact(household)\n```\n\n### Couple with Children\n\n```python\nhousehold = UKHouseholdInput(\n    people=[\n        {\"age\": 35, \"employment_income\": 50_000},\n        {\"age\": 33, \"employment_income\": 25_000},\n        {\"age\": 8},\n        {\"age\": 5},\n    ],\n    benunit={\"would_claim_uc\": True},\n    household={\"region\": \"NORTH_WEST\"},\n    year=2026,\n)\nresult = calculate_household_impact(household)\n\nprint(f\"Child Benefit: £{result.benunit[0]['child_benefit']:,.0f}\")\nprint(f\"Universal Credit: £{result.benunit[0]['universal_credit']:,.0f}\")\n```\n\n### With Housing Costs\n\n```python\nhousehold = UKHouseholdInput(\n    people=[{\"age\": 28, \"employment_income\": 25_000}],\n    benunit={\"would_claim_uc\": True},\n    household={\"region\": \"LONDON\", \"rent\": 15_000},\n    year=2026,\n)\nresult = calculate_household_impact(household)\n```\n\n### Accessing Results\n\nResults are organized by entity level:\n- `result.person[i]` - Person-level variables (indexed by person order)\n- `result.benunit[i]` - Benefit unit variables\n- `result.household` - Household-level variables\n\n```python\n# Person-level (returns dict for each person)\nincome_tax = result.person[0]['income_tax']\nni = result.person[0]['national_insurance']\n\n# Benefit unit level\nuc = result.benunit[0]['universal_credit']\nchild_benefit = result.benunit[0]['child_benefit']\n\n# Household level\nnet_income = result.household['hbai_household_net_income']\n```\n\n---\n\n## 2. Population Simulations\n\nUse `Simulation` with datasets for population-level microsimulation analysis.\n\n### Loading Data\n\n```python\nfrom policyengine.tax_benefit_models.uk import (\n    uk_latest,\n    ensure_datasets,\n    PolicyEngineUKDataset,\n)\n\n# Load pre-prepared datasets\ndatasets = ensure_datasets(\n    data_folder=\".\u002Fdata\",\n    years=[2026, 2027, 2028, 2029, 2030],\n)\ndataset = datasets[\"enhanced_frs_2023_24_2026\"]\n```\n\n### Running Simulations\n\n```python\nfrom policyengine.core import Simulation\n\nsimulation = Simulation(\n    dataset=dataset,\n    tax_benefit_model_version=uk_latest,\n)\nsimulation.ensure()  # Runs if not cached, loads if cached\n\n# Access output data (weighted MicroDataFrames)\noutput = simulation.output_dataset.data\nincome_tax_total = output.household['household_tax'].sum()\nmean_net_income = output.household['household_net_income'].mean()\n```\n\n### Key Points for Population Simulations\n\n- `simulation.ensure()` runs the simulation if not cached, or loads from cache\n- Output data in `simulation.output_dataset.data` contains weighted MicroDataFrames\n- **Never strip weights** - keep results as MicroSeries and use `.sum()`, `.mean()` directly\n- Access by entity: `output.person`, `output.benunit`, `output.household`\n\n---\n\n## Policy Reforms\n\n### Parametric Reforms (ParameterValue)\n\nFor simple parameter changes:\n\n```python\nfrom policyengine.core import Policy, ParameterValue\nfrom datetime import datetime\n\n# Get parameter from model\nparam = uk_latest.get_parameter(\"gov.hmrc.income_tax.rates.uk[0].rate\")\n\npolicy = Policy(\n    name=\"Basic rate 25%\",\n    parameter_values=[\n        ParameterValue(\n            parameter=param,\n            value=0.25,\n            start_date=datetime(2026, 1, 1),\n        )\n    ],\n)\n\n# Run reform simulation\nreform_sim = Simulation(\n    dataset=dataset,\n    tax_benefit_model_version=uk_latest,\n    policy=policy,\n)\nreform_sim.ensure()\n```\n\n### Simulation Modifier Reforms (Complex\u002FProgrammatic)\n\nFor complex reforms that need programmatic control:\n\n```python\ndef my_reform_modifier(sim):\n    \"\"\"Modify the underlying policyengine_uk Microsimulation.\"\"\"\n    # Modify parameters\n    sim.tax_benefit_system.parameters.get_child(\n        \"gov.dwp.universal_credit.elements.child.limit.child_count\"\n    ).update(period=\"year:2026:10\", value=float('inf'))\n\n    # Or modify inputs\n    employment_income = sim.calculate(\"employment_income\", 2026)\n    sim.set_input(\"employment_income\", 2026, employment_income * 1.05)\n\n    sim.tax_benefit_system.reset_parameter_caches()\n\npolicy = Policy(\n    name=\"Complex reform\",\n    simulation_modifier=my_reform_modifier,\n)\n```\n\n### Combining Policies\n\n```python\npolicy_combined = policy_a + policy_b  # Chains modifiers\n```\n\n---\n\n## Analysis Patterns\n\n### Decile Impacts\n\n```python\nfrom policyengine.outputs.decile_impact import calculate_decile_impacts\n\nresults = calculate_decile_impacts(\n    dataset=dataset,\n    tax_benefit_model_version=uk_latest,\n    baseline_policy=None,  # Current law\n    reform_policy=my_policy,\n)\n# Returns OutputCollection with .dataframe and .outputs\n```\n\n### Economic Impact Analysis\n\n```python\nfrom policyengine.tax_benefit_models.uk.analysis import economic_impact_analysis\n\nanalysis = economic_impact_analysis(\n    baseline_simulation=baseline_sim,\n    reform_simulation=reform_sim,\n)\n# Returns PolicyReformAnalysis with:\n# - decile_impacts\n# - programme_statistics\n# - baseline_poverty \u002F reform_poverty\n# - baseline_inequality \u002F reform_inequality\n```\n\n### Aggregate Statistics\n\n```python\nfrom policyengine.outputs.aggregate import Aggregate, AggregateType\n\nagg = Aggregate(\n    simulation=simulation,\n    variable=\"universal_credit\",\n    aggregate_type=AggregateType.SUM,\n    entity=\"benunit\",\n)\nagg.run()\nprint(f\"Total UC spending: £{agg.result \u002F 1e9:.1f}bn\")\n```\n\n---\n\n## Parameter Lookup\n\nFor quick parameter lookups (rates, thresholds), use the old API directly:\n\n```python\nfrom policyengine_uk import CountryTaxBenefitSystem\n\nparams = CountryTaxBenefitSystem().parameters\n\n# Personal allowance\npa = params.gov.hmrc.income_tax.allowances.personal_allowance.amount(\"2026-01-01\")\n\n# Basic rate (use .children[\"N\"] for brackets)\nbasic_rate = params.gov.hmrc.income_tax.rates.uk.brackets.children[\"0\"].rate(\"2026-01-01\")\n\n# UC standard allowance\nuc_standard = params.gov.dwp.universal_credit.elements.standard_allowance.amount.single.over_25(\"2026-01-01\")\n```\n\n**When to use parameter lookup vs simulation:**\n- **Parameter lookup**: \"What is the personal allowance?\", \"What is the basic rate?\"\n- **Simulation**: \"What would my tax be if I earn £30k?\", \"Am I eligible for UC?\"\n\n---\n\n## Regions\n\nUK uses ITL 1 regions:\n- `NORTH_EAST`, `NORTH_WEST`, `YORKSHIRE`, `EAST_MIDLANDS`, `WEST_MIDLANDS`\n- `EAST_OF_ENGLAND`, `LONDON`, `SOUTH_EAST`, `SOUTH_WEST`\n- `WALES`, `SCOTLAND`, `NORTHERN_IRELAND`\n\n**Regional Tax Variations:**\n- **Scotland:** 6 bands (starter 19%, basic 20%, intermediate 21%, higher 42%, advanced 45%, top 47%)\n- **Wales:** Welsh Rate of Income Tax (WRIT), currently at parity with England\n- **England\u002FNI:** Standard UK rates (20%, 40%, 45%)\n\n---\n\n## Common Pitfalls\n\n### 1. Don't Strip Weights from MicroSeries\n```python\n# WRONG - strips weights\nvalues = output.household['income_tax'].values\nmean = values.mean()  # Unweighted!\n\n# CORRECT - keep as MicroSeries\nmean = output.household['income_tax'].mean()  # Weighted\n```\n\n### 2. Use .ensure() for Cached Runs\n```python\nsimulation.ensure()  # Loads from cache if available\n# NOT simulation.run() unless you want to force re-run\n```\n\n### 3. Parameter Paths Use Bracket Notation\n```python\n# New API uses brackets: uk[0].rate\nparam = uk_latest.get_parameter(\"gov.hmrc.income_tax.rates.uk[0].rate\")\n\n# Old API uses .children[\"N\"]\nparams.gov.hmrc.income_tax.rates.uk.brackets.children[\"0\"].rate(\"2026-01-01\")\n```\n\n### 4. Household Input Uses List of Dicts\n```python\n# New API - list of person dicts\nUKHouseholdInput(people=[{\"age\": 35}, {\"age\": 8}], ...)\n\n# Old API - nested situation dict (still works for old Simulation)\n{\"people\": {\"person1\": {\"age\": {2026: 35}}, ...}}\n```\n\n---\n\n## For Contributors\n\n### Repository\n\n**Location:** PolicyEngine\u002Fpolicyengine-uk\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FPolicyEngine\u002Fpolicyengine-uk\ncd policyengine-uk\n```\n\n**Key directories:**\n- `policyengine_uk\u002Fvariables\u002F` - Tax and benefit calculations\n- `policyengine_uk\u002Fparameters\u002F` - Policy rules (YAML)\n- `policyengine_uk\u002Freforms\u002F` - Pre-defined reforms\n- `policyengine_uk\u002Ftests\u002F` - Test cases\n\n### UK Legislation References\n\nAll UK parameters MUST have legislation.gov.uk references with exact section links.\n\n**Primary legislation:**\n- Welfare Reform Act 2012 - Universal Credit\n- Social Security Contributions and Benefits Act 1992\n- Income Tax Act 2007\n\n**Secondary legislation:**\n- Universal Credit Regulations 2013 (SI 2013\u002F376)\n- Income Tax (Earnings and Pensions) Act 2003\n\n**Reference format:**\n```yaml\nmetadata:\n  reference:\n    - title: Universal Credit Regulations 2013, Schedule 4, Table 3\n      href: https:\u002F\u002Fwww.legislation.gov.uk\u002Fuksi\u002F2013\u002F376\u002Fschedule\u002F4\n```\n\n---\n\n## Additional Resources\n\n- **Documentation:** https:\u002F\u002Fpolicyengine.org\u002Fuk\u002Fdocs\n- **Variable Explorer:** https:\u002F\u002Fpolicyengine.org\u002Fuk\u002Fvariables\n- **Parameter Explorer:** https:\u002F\u002Fpolicyengine.org\u002Fuk\u002Fparameters\n- **API Reference:** https:\u002F\u002Fgithub.com\u002FPolicyEngine\u002Fpolicyengine-uk\n",{"name":5,"description":7},"main","b22eca2e974f918ce591c5b2bd829fb7510e0191","Skills\u002Fpolicyengine-uk",18,"https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills","https:\u002F\u002Fgithub.com\u002FFDU-INS","Fudan University Department of Risk Management and Insurance","2026-07-12 12:54:34",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add FDU-INS\u002FInsurance-Skills --skill policyengine-uk",{"tool":58,"command":59},"bunx","bunx skills add FDU-INS\u002FInsurance-Skills --skill policyengine-uk",{"tool":61,"command":62},"pnpm","pnpm dlx skills add FDU-INS\u002FInsurance-Skills --skill policyengine-uk","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fpolicyengine-uk\u002FSKILL.md",true,[66,72,76,82,86,90,94,98],{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},"examples\u002Fcouple.yaml","REFERENCE","参考文档",445,"https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fpolicyengine-uk\u002Fexamples\u002Fcouple.yaml",{"path":73,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":74,"sourceHtmlUrl":75},"examples\u002Ffamily_with_children.yaml",602,"https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fpolicyengine-uk\u002Fexamples\u002Ffamily_with_children.yaml",{"path":77,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":81},"examples\u002Fhousehold_calculation.py","SCRIPT","脚本",1579,"https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fpolicyengine-uk\u002Fexamples\u002Fhousehold_calculation.py",{"path":83,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":84,"sourceHtmlUrl":85},"examples\u002Fpolicy_reform.py",2642,"https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fpolicyengine-uk\u002Fexamples\u002Fpolicy_reform.py",{"path":87,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":88,"sourceHtmlUrl":89},"examples\u002Fpopulation_simulation.py",1387,"https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fpolicyengine-uk\u002Fexamples\u002Fpopulation_simulation.py",{"path":91,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":92,"sourceHtmlUrl":93},"examples\u002Fsingle_person.yaml",292,"https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fpolicyengine-uk\u002Fexamples\u002Fsingle_person.yaml",{"path":95,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":96,"sourceHtmlUrl":97},"examples\u002Funiversal_credit_sweep.yaml",624,"https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fpolicyengine-uk\u002Fexamples\u002Funiversal_credit_sweep.yaml",{"path":99,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":100,"sourceHtmlUrl":101},"scripts\u002Fsituation_helpers.py",9593,"https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fpolicyengine-uk\u002Fscripts\u002Fsituation_helpers.py",[103,128,153,178,200,224],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":39},"01M713QW6EGEG0YAD75440GSD0","로인장 (Roinjiang)","Activates when the user needs legal advice, contract review, insurance law consultation, startup legal support, or any legal\u002Fregulatory matter. She is a top-tier in-house lawyer with absolute loyalty to the CEO, specializing in insurance law, financial consumer protection, privacy, contracts, labor law, family law, civil and criminal matters.","https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002F로인장 (Roinjiang)\u002FSKILL.md",[],[105,110,23,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127],"insurance law","civil","contract","family","when","review","loyalty","with","top","contract review","ceo","support","advice","consultation","regulatory","privacy","protection","startup",{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":39},"01M713QRN8VFMA9VKS6R4DJ2WS","zocdoc-doctor-finder","Use when a user needs to find a doctor, dentist, specialist, therapist, or healthcare provider — especially when they mention insurance, in-network, availability, location, appointments, or booking. Also use for browsing provider reviews, comparing doctors by specialty, or checking if a provider takes their insurance.","https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fzocdoc-doctor-finder\u002FSKILL.md",[],[135,136,137,138,23,139,140,114,141,142,143,144,145,146,147,148,149,150,151,152],"zocdoc doctor finder","doctor","healthcare","reviews","browser automation","access","browsing","browser","booking","network","therapist","computer","availability","for","provider","tool","use","automation",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":39},"01M713QKGV3FTX7EEYWKDM8ENZ","zenmux-context","Answers any question about ZenMux by reading the latest official documentation. Use this skill whenever the user asks about ZenMux product features, API usage, configuration, integration, pricing, models, providers, routing, fallback, streaming, multimodal, structured output, tool calling, reasoning, prompt caching, image generation, video generation, web search, long context, observability, logs, cost tracking, usage analytics, insurance, subscription, pay-as-you-go, invoices, best practices for tools like Claude Code, Cursor, Cline, CodeX, Gemini CLI, opencode, Cherry Studio, Obsidian, Sider, Open-WebUI, Dify, Neovate, GitHub Copilot, OpenClaw, CC-Switch, Immersive Translate, Studio Chat, architecture, benchmarks, FAQ, contact, privacy, terms of service, compliance, or any other ZenMux-related topic. Also trigger when the user writes in Chinese about ZenMux: 文档, 使用指南, 快速开始, API 参考, 最佳实践, 模型路由, 供应商路由, 订阅, 按量计费, 可观测性, 帮助, 常见问题, 接入指南, 配置. Trigger on phrases like \"how to use ZenMux\", \"ZenMux docs\", \"ZenMux API\", \"ZenMux integration\", \"ZenMux 怎么用\", \"ZenMux 接入\", \"ZenMux 配置\". Even if the user doesn't say \"ZenMux\" explicitly but asks about LLM API aggregation, model routing, provider fallback in a context where ZenMux is the project being worked on, this skill should activate.","https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fzenmux-context\u002FSKILL.md",[],[160,161,162,163,23,164,165,166,167,168,169,170,171,172,173,174,175,176,177,33],"context","zenmux context","Video","chinese","project","web search","translate","search","open","question","pay","image","you","activate","architecture","logs","streaming","cherry studio",{"skillNo":179,"name":180,"nameZh":6,"description":181,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":182,"categories":183,"keywords":184,"publishedAt":39},"01M713QHWTBG634BCBV7NBJME1","workers-comp-guide","Guide workers compensation compliance and claims management.\nTRIGGERS - Use when user needs help with workers-comp-guide related tasks.","https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fworkers-comp-guide\u002FSKILL.md",[],[185,186,187,188,189,23,190,191,151,114,192,117,193,194,195,196,197,198,199],"workers","comp","workers comp","workers comp guide","guide","triggers","workers-comp","tasks","claims management","claims","compliance","help","compensation","management","user",{"skillNo":201,"name":202,"nameZh":6,"description":203,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":204,"categories":205,"keywords":206,"publishedAt":39},"01M713QF45VMV1685AFNF1GPMA","weekly-kpi-report","Generate McKinsey-style board presentation PPTs from weekly auto insurance data. Automatically calculates 16+ KPIs, creates executive-level slides with actionable insights, and supports week-over-week comparisons. Use when user uploads insurance cost data (Excel\u002FCSV) and requests board report, weekly presentation, executive briefing, or mentions keywords like 董事会汇报, 周报PPT, 经营分析演示, McKinsey-style reports.","https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fweekly-kpi-report\u002FSKILL.md",[],[207,208,209,210,211,23,212,213,214,215,114,216,217,218,219,220,221,222,151,223],"weekly","weekly kpi report","kpi","report","xlsx","actionable","insights","briefing","auto","board report","reports","generate","演示","data","presentation","slides","uploads",{"skillNo":225,"name":226,"nameZh":6,"description":227,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":228,"categories":229,"keywords":230,"publishedAt":39},"01M713QA9WJDHMNVTTY1ENRKVB","wealth-advisory","Wealth management and financial planning for HNW and UHNW clients. Activate when the user\nmentions wealth management, financial planning, retirement, estate planning, tax planning,\nGRAT, IDGT, trust, asset allocation, withdrawal rate, Monte Carlo simulation, goals-based\ninvesting, tax-loss harvesting, Roth conversion, insurance, annuity, mortgage strategy,\nconcentrated stock, family office, direct indexing, 529 plan, charitable giving, donor-advised\nfund, private foundation, or asks about personal finance strategy, inheritance, long-term\nfinancial planning, or UHNW advisory.","https:\u002F\u002Fgithub.com\u002FFDU-INS\u002FInsurance-Skills\u002Fblob\u002Fmain\u002FSkills\u002Fwealth-advisory\u002FSKILL.md",[],[231,232,23,233,234,114,173,235,236,237,238,239,24,240,241,242,38,243,244,245],"wealth advisory","advisory","stock","inheritance","conversion","indexing","plan","simulation","personal finance","allocation","asset","direct","investing","trust","planning"]