Provides UK-specific PolicyEngine facts: entity model (person/benunit/household, no tax_unit), household calculations, income tax (Scottish/Welsh), National Insurance, Universal Credit, benefits, and poverty analysis. Load before writing PolicyEngine-UK code.
Ships in essential. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
UK-specific facts for the PolicyEngine Python stack. Read the policyengine skill first for
the canonical import policyengine as pe interface, the population flow
(ensure_datasets / Simulation / economic_impact_analysis), the MicroSeries discipline,
and dataset handling — this skill only carries what is different about the UK.
Verified against policyengine 4.21.0 + policyengine-uk 2.89.2 + policyengine-core 3.30.0
(2026-07). UK examples are not in the [us]-only CI verify set, so they carry no fast
<!-- verify --> marker; each was run manually in a policyengine[uk] environment.
Population examples may carry <!-- verify: slow -->.
The UK model is an extra — bare policyengine installs no country model:
uv pip install "policyengine[uk]" # UK model + certified UK data bundle metadata
Household calculations need no data download. Population runs need the UK dataset, which is a private Hugging Face repo — see "Population data" below.
UK entities are person → benunit → household. There is no tax_unit and no
spm_unit / marital_unit / family — those are US entities. The single most common UK
mistake is reaching for result.tax_unit out of US habit; on a UK result it raises
AttributeError (verified: a UK result has person, benunit, household and no tax_unit).
| Concept | US entity | UK entity |
|---|---|---|
| Means-tested assessment unit | tax_unit (+ spm_unit) | benunit (benefit unit) |
| Statistical unit for poverty | spm_unit / household | household |
| Individual | person | person |
A benefit unit is a single adult or a couple plus their dependent children — the DWP assessment unit for means-tested benefits (Universal Credit, Pension Credit, etc.). One household can contain several benunits (e.g. adult children living with parents). Read means-tested benefits at the benunit level, income tax and NI at the person level, and net income and poverty at the household level.
pe.uk.calculate_household mirrors the US call (keyword-only, year defaults to 2026), but
results are read on UK entities. Access is dot-attribute on singular entities; only
result.person is a list.
import policyengine as pe
r = pe.uk.calculate_household(
people=[{"age": 35, "employment_income": 50_000}],
year=2026,
)
assert round(r.person[0].income_tax) == 7_486
assert round(r.person[0].national_insurance) == 2_994
assert round(r.household.hbai_household_net_income) == 39_520
Net income comes in two conventions: hbai_household_net_income follows the DWP
Households Below Average Income definition (the one PolicyEngine reports, and what the poverty
measures below use); household_net_income is the plain accounting definition. Prefer the
HBAI variable for anything compared against official UK statistics.
Benefit-unit variables read off benunit (a family with two children on £30k gross):
r = pe.uk.calculate_household(
people=[
{"age": 35, "employment_income": 30_000},
{"age": 33},
{"age": 8},
{"age": 5},
],
household={"region": "NORTH_WEST"},
year=2026,
)
r.benunit.universal_credit # 6029.82
r.benunit.child_benefit # 2337.40
Reforms are the same flat {parameter_path: value} dict as the US package surface:
reformed = pe.uk.calculate_household(
people=[{"age": 35, "employment_income": 50_000}],
year=2026,
reform={"gov.hmrc.income_tax.allowances.personal_allowance.amount": 15_000},
)
assert round(reformed.person[0].income_tax) == 7_000 # 2,430 more allowance x 20%
UK poverty is reported at the household level under two measures, and they can disagree for the same household:
in_poverty_bhc — Before Housing Costs.in_poverty_ahc — After Housing Costs.fam = pe.uk.calculate_household(
people=[{"age": 35, "employment_income": 16_000}, {"age": 33}, {"age": 4}, {"age": 2}],
household={"region": "WALES"},
year=2026,
)
fam.household.in_poverty_bhc # 1.0 (in poverty before housing costs)
fam.household.in_poverty_ahc # 0.0 (NOT in poverty after housing costs)
That verified split — same household, BHC in poverty, AHC not — is why a UK poverty figure is
meaningless without its measure. Name BHC or AHC in every result, and match whichever the
source you compare against used (DWP HBAI headline child-poverty figures are AHC). Deep-poverty
variants (in_deep_poverty_bhc / in_deep_poverty_ahc) follow the same convention. At
population scale these are the poverty variables behind compute_uk_* breakdowns and the
Poverty outputs described in the policyengine skill.
For "what is the rate/threshold?" questions, read the parameter tree directly (no simulation). Print the live value in your working year rather than trusting a hardcoded rate — UK rates and thresholds move at every fiscal event.
from policyengine_uk import CountryTaxBenefitSystem
p = CountryTaxBenefitSystem().parameters
p.gov.hmrc.income_tax.allowances.personal_allowance.amount("2026-01-01") # 12570
Bracket/scale parameters index the scale node with [i] (no .brackets in the reform-dict
path, same convention as US):
"gov.hmrc.income_tax.rates.uk[0].rate" # basic-rate node in a reform dict
When browsing the tree object (not a reform path), a ParameterScale exposes .brackets as a
Python list of ParameterScaleBracket, each with .rate(date) / .threshold(date).
Income tax rates live under gov.hmrc.income_tax.rates, whose children are
dividends, property, savings, savings_starter_rate, scotland, uk. Verify band counts and
values live (below is the verified 2026 structure, but treat the parameter tree as the source
of truth — do not hardcode rates into analysis):
gov.hmrc.income_tax.rates.uk is a
ParameterScale. Verified 4 brackets / 3 distinct statutory rates — basic 20%, higher
40%, additional 45% (the 4th bracket is a technical top node repeating the additional rate).gov.hmrc.income_tax.rates.scotland.rates is a separate ParameterScale
with 6 bands (verified 2026: starter, basic, intermediate, higher, advanced, top).
Scotland's extra bands are why a UK income-tax analysis must branch on nation rather than
assume the rest-of-UK schedule.WALES
parameter anywhere under gov.hmrc is in business_rates). The Welsh Rate of Income Tax is
set at parity, so Wales is computed on the rest-of-UK rates.uk schedule. Model Wales via
the WALES region, not a separate rate table.p.gov.hmrc.income_tax.rates.uk.brackets # verified len 4 (3 distinct rates)
p.gov.hmrc.income_tax.rates.scotland.rates.brackets # verified len 6
region is a household-level enum. The Region enum
(policyengine_uk/variables/household/demographic/geography.py) is the 12 ITL1 regions plus
UNKNOWN:
NORTH_EAST, NORTH_WEST, YORKSHIRE, EAST_MIDLANDS, WEST_MIDLANDS, EAST_OF_ENGLAND,
LONDON, SOUTH_EAST, SOUTH_WEST, WALES, SCOTLAND, NORTHERN_IRELAND (+ UNKNOWN)
Pass the enum member name as a string: household={"region": "SCOTLAND"}. YORKSHIRE is the
key for "Yorkshire and the Humber". UK constituency-level distributional analysis uses the
dataset's constituency_code_oa column via compute_uk_constituency_impacts /
compute_uk_local_authority_impacts — see the policyengine skill.
The UK default dataset is microcosm_uk_2024_25, pinned by the certified bundle in
policyengine 6.16.0 (checked 2026-11-06); constituency and local-authority runs use
microcosm_uk_2024_25_dense (the manifest's region_datasets). Both live in a private
Hugging Face repo, so population runs require a HUGGING_FACE_TOKEN with access:
export HUGGING_FACE_TOKEN=hf_... # required for UK population data; household calcs do NOT need it
Do not hardcode a raw hf:// dataset URI — the certified default resolves by name through the
bundle. policyengine.py also serves the Enhanced FRS and FRS files that policyengine-uk-data
builds (enhanced_frs_2024_25, frs_2024_25, and their 2023-24 and _tiny siblings), but only
when you name one. It downloads them from the gated policyengine/policyengine-uk-data-private
repo, so your token needs access there too. Say in your results when a run used one. See the
policyengine-data skill for how Microcosm builds and calibrates its UK datasets (FRS + WAS
imputation), and the policyengine skill for the ensure_datasets / Simulation population
flow, which works the same way in both countries.
A macro path goes in through the growth series in gov.economic_assumptions.yoy_growth.obr
(consumer_price_index, average_earnings; move rpi and cpih with CPI if prices move).
Pass it to managed_microsimulation as a Scenario applied before the data load, as
below, so the dataset is projected on the new path along with the parameters derived from
it. Don't send a macro path through the pe.uk Simulation, Policy/Dynamic or
economic_impact_analysis interfaces: they hand parameter values to policyengine-uk as a
reform when it builds the simulation, on each year's data as the dataset was already
projected.
from policyengine.tax_benefit_models.uk import managed_microsimulation
from policyengine_uk.utils.scenario import Scenario
OBR = "gov.economic_assumptions.yoy_growth.obr"
base = managed_microsimulation()
p = base.tax_benefit_system.parameters
changes = {
f"{OBR}.{series}": {
f"year:{y}-01-01:1": float(p.get_child(f"{OBR}.{series}")(f"{y}-01-01")) + 0.01
for y in range(2027, 2034)
}
for series in ("consumer_price_index", "average_earnings")
}
macro = managed_microsimulation(
scenario=Scenario(parameter_changes=changes, applied_before_data_load=True)
)
for year in (2029, 2034): # inside and beyond the dataset's own years
assert macro.calculate("employment_income", year).sum() > base.calculate("employment_income", year).sum()
This example last ran on policyengine 5.3.0 / policyengine-uk 2.90.2 (2026-09), on the
then-default enhanced_frs_2024_25: +1pp CPI and earnings in 2027-2033 raised 2034 employment
income from £1,662.6bn to £1,779.4bn. policyengine-uk has since changed how reforms and
scenarios reach the parameters (policyengine_uk.utils.dated_reforms), so check any other
route, period key or series horizon against the installed version before relying on it, and
measure again on the current bundle before you quote a figure. policyengine downloads the
dataset to ./data/ under the working directory, so run parallel processes from separate
working directories.
To combine a macro path with a policy, build a macro baseline and a macro reform on the same
macro Scenario, check on the installed version that the policy reaches the reform's
parameters for every year you report, and compare the two. Don't compare against
sim.baseline, which policyengine-uk builds on the default macro path.
Everything above uses the managed pe.uk surface. When you work inside the UK country model
(new variables, structural reforms, debugging formulas), you use policyengine_uk directly, and
the reform surface there is the Scenario object, verified importable:
from policyengine_uk.model_api import Scenario # -> policyengine_uk.utils.scenario.Scenario
Scenario is a Pydantic model with two fields — parameter_changes ({path: {period: value}})
and simulation_modifier (a Callable[[Simulation], None]) — and scenarios compose with +
(parameter dicts merge, modifiers chain). The country-package Microsimulation(reform=...)
accepts either a plain dict or a Reform class (its verified signature is
reform: Union[Dict, Type[Reform]]) and internally calls Scenario.from_reform(reform).
Reform.from_dict(dict, country_id="uk") also works and applies correctly for both flat and
date-ranged dicts — there is no UK-specific from_dict failure. (Note: the UK baseline bakes in
the July-2025 Universal Credit reform, so a bare Microsimulation() is already post-July-2025
UC law.)
Reform patterns for country-model work (from the analysis skill's
MICROSIMULATION_REFORM_GUIDE.md):
Parameter-change scenario, with period syntax "year:START:COUNT" or an ISO date:
reform = Scenario(parameter_changes={
"gov.hmrc.income_tax.rates.uk[0].rate": {"year:2026:10": 0.21}, # 21% for 2026..2035
})
Structural or multi-year edits go through a simulation_modifier. The safe
parameter-freeze recipe avoids corrupting shared parameter caches — clone, edit the clone,
process, copy the values_list back, then reset caches:
def freeze_higher_threshold(sim):
clone = sim.clone()
clone.tax_benefit_system.reset_parameters()
node = clone.tax_benefit_system.parameters.gov.hmrc.income_tax.rates.uk[1].threshold
current = node("2026-01-01")
for year in range(2026, 2031):
node.update(period=str(year), value=current, remove_after=True)
clone.tax_benefit_system.process_parameters()
sim.tax_benefit_system.parameters.gov.hmrc.income_tax.rates.uk[1].threshold.values_list = (
node.values_list
)
sim.tax_benefit_system.reset_parameter_caches()
reform = Scenario(simulation_modifier=freeze_higher_threshold)
Two gotchas from that recipe:
remove_after=True on .update(...) is mandatory when you mean to change only one
period — without it the edit propagates to every later year....rates.uk[0].rate, never
...rates.uk.rate.Every UK parameter YAML carries legislation.gov.uk references with exact section links.
Distinguish primary legislation (Acts) from secondary legislation (Statutory Instruments, cited
by SI year/number):
SI YYYY/NNNN, e.g. the Universal Credit
Regulations 2013 (SI 2013/376). SI URLs use the /uksi/ path; Acts use /ukpga/.metadata:
reference:
- title: Universal Credit Regulations 2013, Schedule 4
href: https://www.legislation.gov.uk/uksi/2013/376/schedule/4
- title: Income Tax Act 2007, Section 10
href: https://www.legislation.gov.uk/ukpga/2007/3/section/10
Uprating usually tracks a statutory index (CPI/RPI or a benefit-specific order) rather than a fixed value — cite the uprating order, not just the base Act, when a value changes annually.
policyengine — the canonical pe.* interface, population flow, MicroSeries rules, and
regional impacts. Read it first.policyengine-data — how Microcosm UK (FRS + WAS) is built and calibrated.policyengine-model-development — implementing new UK variables and parameters.policyengine-us — the US counterpart (and the source of the tax_unit habit to unlearn).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
5 skills in this plugin
/policyengine-canadaHow to compute Canadian household tax/benefit outcomes with PolicyEngine, and the hard limits.
Load when a task involves Canadian taxes or benefits (CCB, GST/HST credit, CWB, OAS, provincial
tax) at the household level. Key facts: pe.ca does NOT exist — Canada is not in the policyengine
wrapper; use the policyengine_canada package directly via Simulation(situation=...); there is no
representative microdata (only a synthetic template), so population microsimulation, national
costs, and poverty rates are NOT possible — household-level only.
Triggers: Canada, Canadian, CCB, Canada Child Benefit, GST credit, HST, GST/HST credit, CWB,
Canada Workers Benefit, OAS, GIS, Ontario, Quebec, province, provincial tax, AFNI, full custody,
policyengine canada, policyengine_canada.
NOT for: US or UK analysis (use policyengine-us / policyengine-uk); anything population-scale
for Canada (not supported).
/policyengine-usUS tax-benefit domain knowledge for analysts computing household or population impacts
with the policyengine package (pe.us). Load for: which entity a US program attaches to
(tax_unit vs spm_unit vs person), tax-unit role flags and filing status, post-OBBBA
current-law values (2026 CTC, standard deduction, SALT cap), the parameter tree
(gov.irs / gov.states.{xx} / gov.usda.snap / gov.ssa), state income-tax and credit
coverage, and SNAP monthly/FPL semantics.
Triggers: EITC, CTC, SNAP, TANF, SSI, income tax, state income tax, standard deduction,
SALT cap, federal poverty level, spm_unit, tax_unit, filing status, is_tax_unit_dependent,
household_net_income, in_poverty, state credit, CalEITC, ca_eitc, ny_eitc, OBBBA.
NOT for: implementing new US variables/parameters (use policyengine-model-development);
Medicaid/ACA/CHIP/Medicare (use policyengine-healthcare); the core calculate_household /
Simulation / reform mechanics shared across countries (use the policyengine skill).
/essential:policyengine-ukfrom essential
npx claudepluginhub policyengine/policyengine-claude --plugin essentialOther plugins' skills for the same job