Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

policyengine-uk

БесплатноЗапускает вложенные скриптыНе проверен

ALWAYS LOAD THIS SKILL FIRST before writing any PolicyEngine-UK code. Contains the correct API patterns for household calculations and population simulations…

FDU-INSот FDU-INS★ 84 звезды на GitHub

Об этом скилле

PolicyEngine-UK

IMPORTANT: Always use the current year (2026) in calculations, not 2024 or 2025.

PolicyEngine-UK models the UK tax and benefit system, including devolved variations for Scotland and Wales.

For Users

What is PolicyEngine-UK?

PolicyEngine-UK is the "calculator" for UK taxes and benefits. When you use policyengine.org/uk, PolicyEngine-UK runs behind the scenes.

What it models:

Direct taxes:

  • Income tax (UK-wide, Scottish, and Welsh variations)
  • National Insurance (Classes 1, 2, 4)
  • Capital gains tax, Dividend tax

Property and transaction taxes:

  • Council Tax
  • Stamp Duty Land Tax (England/NI)
  • Land and Buildings Transaction Tax (Scotland)
  • Land Transaction Tax (Wales)

Universal Credit:

  • Standard allowance, Child elements, Housing cost element
  • Childcare costs element, Carer element, Work capability elements

Legacy benefits (being phased out):

  • Working Tax Credit, Child Tax Credit, Income Support
  • Income-based JSA/ESA, Housing Benefit

Other benefits:

  • Child Benefit, Pension Credit, PIP, DLA, Attendance Allowance, State Pension

See full list: https://policyengine.org/uk/parameters

Understanding Variables

Income variables:

  • employment_income - Gross employment earnings/salary
  • self_employment_income - Self-employment profits
  • pension_income - Private pension income
  • property_income - Rental income
  • savings_interest_income - Interest from savings
  • dividend_income - Dividend income

Tax variables:

  • income_tax - Total income tax liability
  • national_insurance - Total NI contributions
  • council_tax - Council tax liability

Benefit variables:

  • universal_credit - Universal Credit amount
  • child_benefit - Child Benefit amount
  • pension_credit - Pension Credit amount

Summary variables:

  • household_net_income - Income after taxes and benefits
  • hbai_household_net_income - HBAI-definition net income

For Analysts

Installation

uv pip install policyengine

Two Modes of Analysis

PolicyEngine provides two main ways to analyze the UK tax-benefit system:

  1. Household Calculations - Single household, quick answers
  2. Population Simulations - Microsimulation, policy analysis at scale

1. Household Calculations

Use calculate_household_impact() with UKHouseholdInput for quick single-household calculations.

Basic Pattern

from policyengine.tax_benefit_models.uk import (
    UKHouseholdInput,
    calculate_household_impact,
)

household = UKHouseholdInput(
    people=[
        {"age": 35, "employment_income": 50_000},
    ],
    year=2026,
)
result = calculate_household_impact(household)

# Access results
print(f"Income tax: £{result.person[0]['income_tax']:,.0f}")
print(f"Net income: £{result.household['hbai_household_net_income']:,.0f}")

Single Person

household = UKHouseholdInput(
    people=[{"age": 30, "employment_income": 30_000}],
    household={"region": "LONDON"},
    year=2026,
)
result = calculate_household_impact(household)

Couple with Children

household = UKHouseholdInput(
    people=[
        {"age": 35, "employment_income": 50_000},
        {"age": 33, "employment_income": 25_000},
        {"age": 8},
        {"age": 5},
    ],
    benunit={"would_claim_uc": True},
    household={"region": "NORTH_WEST"},
    year=2026,
)
result = calculate_household_impact(household)

print(f"Child Benefit: £{result.benunit[0]['child_benefit']:,.0f}")
print(f"Universal Credit: £{result.benunit[0]['universal_credit']:,.0f}")

With Housing Costs

household = UKHouseholdInput(
    people=[{"age": 28, "employment_income": 25_000}],
    benunit={"would_claim_uc": True},
    household={"region": "LONDON", "rent": 15_000},
    year=2026,
)
result = calculate_household_impact(household)

Accessing Results

Results are organized by entity level:

  • result.person[i] - Person-level variables (indexed by person order)
  • result.benunit[i] - Benefit unit variables
  • result.household - Household-level variables
# Person-level (returns dict for each person)
income_tax = result.person[0]['income_tax']
ni = result.person[0]['national_insurance']

# Benefit unit level
uc = result.benunit[0]['universal_credit']
child_benefit = result.benunit[0]['child_benefit']

# Household level
net_income = result.household['hbai_household_net_income']

2. Population Simulations

Use Simulation with datasets for population-level microsimulation analysis.

Loading Data

from policyengine.tax_benefit_models.uk import (
    uk_latest,
    ensure_datasets,
    PolicyEngineUKDataset,
)

# Load pre-prepared datasets
datasets = ensure_datasets(
    data_folder="./data",
    years=[2026, 2027, 2028, 2029, 2030],
)
dataset = datasets["enhanced_frs_2023_24_2026"]

Running Simulations

from policyengine.core import Simulation

simulation = Simulation(
    da
Полный SKILL.md на GitHub

Установить policyengine-uk в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

examples/couple.yamlexamples/family_with_children.yamlexamples/household_calculation.pyexamples/policy_reform.pyexamples/population_simulation.pyexamples/single_person.yamlexamples/universal_credit_sweep.yamlscripts/situation_helpers.py

FAQ

Что делает скилл policyengine-uk?

ALWAYS LOAD THIS SKILL FIRST before writing any PolicyEngine-UK code. Contains the correct API patterns for household calculations and population simulations using the new policyengine package (not policyengine_uk directly). Triggers: "what would", "how much would a", "benefit be", "eligible for", "qualify for", "single parent", "married couple", "family of", "household of", "if they earn", "with income of", "earning £", "making £", "calculate benefits", "calculate taxes", "benefit for a", "tax for a", "what would I get", "what would they get", "what is the rate", "what is the threshold", "personal allowance", "maximum benefit", "income limit", "benefit amount", "how much is", "Universal Credit", "child benefit", "pension credit", "housing benefit", "council tax", "income tax", "national insurance", "JSA", "ESA", "PIP", "disability living allowance", "working tax credit", "child tax credit", "Scotland", "Wales", "UK", "microsimulation", "population", "reform", "policy impact", "budgetary", "decile".

Как установить скилл policyengine-uk?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл policyengine-uk запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить policyengine-uk с