Use this skill when you need to work out airline check-in excess baggage fees for passengers: extra checked pieces beyond the cabin allowance and overweight bags charged per started 5 kg, then produce a fee list (excess-baggage.csv) from the booking data in input.json. Not for carry-on, seat, or ticket fare pricing.
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-d2e36ca5)
---
name: excess-baggage
description: "Use this skill when you need to work out airline check-in excess baggage fees for passengers: extra checked pieces beyond the cabin allowance and overweight bags charged per started 5 kg, then produce a fee list (excess-baggage.csv) from the booking data in input.json. Not for carry-on, seat, or ticket fare pricing."
---
# Excess baggage fees
## Inputs
Read `input.json` in the working folder (the folder that holds it is where the output goes):
- `allowances`: object, cabin -> `{pieces, kg}` (included bags, weight limit per bag).
- `extraPieceCents`, `overweightCents`: integers (cents).
- `passengers`: array of `{booking, name, cabin, bags}`; `bags` = whole-kg weights in belt order (do NOT sort them).
If a passenger's cabin is missing from `allowances`, do not guess: treat it as an error, skip nothing silently, and mention it in your final reply (use the closest exact-case match only if the difference is just letter case/whitespace).
## Rules (per passenger, bags indexed i = 1..n in listed order)
1. Extra pieces: `extra = max(0, n - pieces)`. Bags i > pieces are the extra pieces (the later ones). Charge `extra * extraPieceCents`. If pieces is 0, every bag is extra.
2. Weight, for EVERY bag including extra ones, independently: `over = w - kg`.
- `over <= 0` -> steps = 0.
- `over >= 1` -> `steps = ceil(over / 5) = floor((over + 4) / 5)` (1-5 -> 1, 6-10 -> 2, 11-15 -> 3).
- Never pool or net unused weight across bags. Charge `steps * overweightCents`.
3. `fee_cents = extra*extraPieceCents + sum(steps)*overweightCents`.
4. A passenger with no bags has n = 0 and fee 0.
## Steps
1. Read input.json; compute fee_cents for every passenger as integers (no floats).
2. Keep only passengers with `fee_cents > 0`.
3. Sort by `fee_cents` descending, ties by `name` ascending in plain ASCII/code-point order (uppercase before lowercase, "Z" < "a"; space < letters). Not locale or case-insensitive.
4. Write `excess-baggage.csv` beside input.json:
- Header line exactly `booking,name,bags,fee`.
- One row per kept passenger: `booking,name,n,fee` where n = number of bags and fee = `fee_cents/100` with exactly two decimals, no currency sign (e.g. `105.00`, `0.50`, `1234.05`). Compute as integer dollars = fee_cents div 100, cents = fee_cents mod 100 padded to 2 digits.
- If a booking or name contains a comma, quote, or newline, wrap the field in double quotes and double inner quotes.
- Newline-separated rows, final newline at end. If nobody owes anything, the file contains only the header.
5. Re-check: recompute two or three passengers by hand, confirm row count, order, and decimals.
## Worked example
economy: 1 piece, 23 kg; extraPieceCents 6500; overweightCents 2000. Bags [29, 12]:
- Bag 1: 29-23 = 6 over -> 2 steps -> 4000. Bag 2 is an extra piece: 6500; 12 kg is within limit -> 0 weight charge.
- fee_cents 10500 -> row `B1,Ann,2,105.00`.
## Edge notes
- Included pieces are the earliest on the belt, so an extra piece's weight is judged against the same kg limit, and a heavy bag within the included pieces is still only an overweight charge.
- Bags exactly at the limit cost nothing.
- Names are unique, so the sort is total.