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".
What this skill does
# 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
```bash
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
```python
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
```python
household = UKHouseholdInput(
people=[{"age": 30, "employment_income": 30_000}],
household={"region": "LONDON"},
year=2026,
)
result = calculate_household_impact(household)
```
### Couple with Children
```python
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
```python
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
```python
# 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
```python
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
```python
from policyengine.core import Simulation
simulation = Simulation(
dataset=dataset,
tax_benefit_model_version=uk_latest,
)
simulation.ensure() # Runs if not cached, loads if cached
# Access output data (weighted MicroDataFrames)
output = simulation.output_dataset.data
income_tax_total = output.household['household_tax'].sum()
mean_net_income = output.household['household_net_income'].mean()
```
### Key Points for Population Simulations
- `simulation.ensure()` runs the simulation if not cached, or loads from cache
- Output data in `simulation.output_dataset.data` contains weighted MicroDataFrames
- **Never strip weights** - keep results as MicroSeries and use `.sum()`, `.mean()` directly
- Access by entity: `output.person`, `output.benunit`, `output.household`
---
## Policy Reforms
### Parametric Reforms (ParameterValue)
For simple parameter changes:
```python
from policyengine.core import Policy, ParameterValue
from datetime import datetime
# Get parameter from model
param = uk_latest.get_parameter("gov.hmrc.income_tax.rates.uk[0].rate")
policy = Policy(
name="Basic rate 25%",
parameter_values=[
ParameterValue(
parameter=param,
value=0.25,
start_date=datetime(2026, 1, 1),
)
],
)
# Run reform simulation
reform_sim = Simulation(
dataset=dataset,
tax_benefit_model_version=uk_latest,
policy=policy,
)
reform_sim.ensure()
```
### Simulation Modifier Reforms (Complex/Programmatic)
For complex reforms that need programmatic control:
```python
def my_reform_modifier(sim):
"""Modify the underlying policyengine_uk Microsimulation."""
# Modify parameters
sim.tax_benefit_system.parameters.get_child(
"gov.dwp.universal_credit.elements.child.limit.child_count"
).update(period="year:2026:10", value=float('inf'))
# Or modify inputs
employment_income = sim.calculate("employment_income", 2026)
sim.set_input("employment_income", 2026, employment_income * 1.05)
sim.tax_benefit_system.reset_parameter_caches()
policy = Policy(
name="Complex reform",
simulation_modifier=my_reform_modifier,
)
```
### Combining Policies
```python
policy_combined = policy_a + policy_b # Chains modifiers
```
---
## Analysis Patterns
### Decile Impacts
```python
from policyengine.outputs.decile_impact import calculate_decile_impacts
results = calculate_decile_impacts(
dataset=dataset,
tax_benefit_model_version=uk_latest,
baseline_policy=None, # Current law
reform_policy=my_policy,
)
# Returns OutputCollection with .dataframe and .outputs
```
### Economic Impact Analysis
```python
from policyengine.tax_benefit_models.uk.analysis import economic_impact_analysis
analysis = economic_impact_analysis(
baseline_simulation=baseline_sim,
reform_simulation=reform_sim,
)
# Returns PolicyReformAnalysis with:
# - decile_impacts
# - programme_statistics
# - baseline_poverty / reform_poverty
# - baseline_inequality / reform_inequality
```
### Aggregate Statistics
```python
from policyengine.oRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.