Use this skill when you need to work out airline check-in excess baggage fees: extra checked pieces beyond a cabin's allowance plus per-bag overweight charges, for a list of passengers, and produce a fee report of who owes what (e.g. from input.json to excess-baggage.csv). Not for carry-on rules, flight pricing or refunds.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Excess Baggage?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-excess-baggage-68d35003)
---
name: excess-baggage
description: "Use this skill when you need to work out airline check-in excess baggage fees: extra checked pieces beyond a cabin's allowance plus per-bag overweight charges, for a list of passengers, and produce a fee report of who owes what (e.g. from input.json to excess-baggage.csv). Not for carry-on rules, flight pricing or refunds."
---
# Excess baggage fees
## Inputs
Read `input.json` in the working folder (the folder that holds it is where output goes):
- `allowances`: object, cabin -> `{pieces, kg}` (included checked bags; weight limit per bag).
- `extraPieceCents`: cents per extra piece.
- `overweightCents`: cents per started 5 kg over the limit.
- `passengers`: array of `{booking, name, cabin, bags}`; `bags` = integer kg per bag, in belt order.
## Rules (per passenger)
Let `P` = allowance pieces, `L` = allowance kg for the passenger's cabin, `n` = length of `bags`.
1. Extra pieces: `extra = max(0, n - P)`; the bags at index `P` onward (0-based, belt order) are the extra ones. Charge `extra * extraPieceCents`.
2. Overweight, for EVERY bag (included and extra), independently: `over = w - L`; `steps = 0` if `over <= 0`, else `ceil(over / 5)` = `(over + 4) div 5` (integer division). Charge `steps * overweightCents`. Never pool or carry unused weight between bags.
3. `feeCents = extra*extraPieceCents + sum(steps)*overweightCents`.
4. Zero bags -> fee 0. `P = 0` -> every bag is an extra piece.
Do the arithmetic in integer cents. Check each bag explicitly; do not estimate.
## Steps
1. Read input.json. For each passenger, list each bag with its index, steps and whether it is extra; compute `feeCents`.
2. Keep only passengers with `feeCents > 0`.
3. Sort by `feeCents` descending; ties by `name` ascending in plain ASCII byte order (uppercase before lowercase, space before letters; not locale or case-insensitive).
4. Write `excess-baggage.csv` beside input.json: header `booking,name,bags,fee`, one row per kept passenger, `bags` = n, `fee` = `feeCents/100` with exactly two decimals, no currency sign or thousands separators (e.g. `105.00`, `0.50`). Use newline line endings with a final newline. If no one qualifies, the file contains only the header.
5. If a value contains a comma or double quote (e.g. name), quote the field CSV-style, doubling inner quotes.
## Missing or odd data
- Cabin not in `allowances`: do not guess; match case-insensitively only if unambiguous, otherwise skip no one silently — state the problem to the user and treat nothing as free.
- Missing `bags`: treat as empty. Do not invent data.
- Do not edit input.json.
## Example
economy: 1 piece, 23 kg; extra 6500; step 2000. Bags `[29, 12]`: bag 29 -> over 6 -> 2 steps = 4000; bag 12 is extra = 6500, no overweight. Fee 10500 -> `B1,Ann,2,105.00`.
Before finishing, re-open the CSV and verify the order, row count and decimals.