Skip to content
Back to skills

Excess Baggage

ASecurity

Use this skill when you need to work out airline check-in excess baggage fees: extra checked pieces beyond the cabin allowance and overweight bags charged per started 5 kg, for each passenger, and produce a list of who owes what, largest fee first. Applies to an input.json with allowances, extraPieceCents, overweightCents and passengers. Not for carry-on, ticket fares or currency conversion.

  • 24 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 6, 2026
toolsgitapi

Works with

  • api

Security analysis

A100/100

Scanned December 6, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill excess-baggage --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Excess Baggage?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Excess Baggage
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-excess-baggage-8211b769/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-excess-baggage-8211b769)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: excess-baggage
description: "Use this skill when you need to work out airline check-in excess baggage fees: extra checked pieces beyond the cabin allowance and overweight bags charged per started 5 kg, for each passenger, and produce a list of who owes what, largest fee first. Applies to an input.json with allowances, extraPieceCents, overweightCents and passengers. Not for carry-on, ticket fares or currency conversion."
---

# Excess baggage fees

Compute per-passenger excess baggage fees from `input.json` and write `excess-baggage.csv` beside it. Do it by careful hand calculation; no commands are needed.

## Inputs
`input.json` in the working folder:
- `allowances`: object cabin -> `{pieces, kg}` (included bag count, per-bag weight limit).
- `extraPieceCents`, `overweightCents`: integers (cents).
- `passengers`: array of `{booking, name, cabin, bags}`; `bags` is a list of whole-kg weights in belt order. Names are unique.

If the file is missing, say so and stop. If a passenger's cabin is not in `allowances`, do not guess: skip no one silently; treat it as an error, report it to the user, and still write the CSV for the others only if the user's intent is clear (note the exclusion in your reply).

## Rules (per passenger; P = pieces, L = kg limit, n = number of bags, w_i = weight of bag i, 1-based in listed order)
1. Extra pieces: `extraCount = max(0, n - P)`. The bags at positions P+1..n are the extra ones. Charge `extraCount * extraPieceCents`.
2. Every bag (included and extra) is judged alone: `over_i = w_i - L`.
   - If `over_i <= 0`: steps = 0 (no credit carried to other bags; negative values never reduce a fee).
   - Else `steps_i = ceil(over_i / 5)` = `(over_i + 4) div 5` (integer division). 1–5 over → 1, 6–10 → 2, 11–15 → 3.
   - Charge `steps_i * overweightCents`.
3. `feeCents = extra charge + sum of overweight charges`. Empty `bags` → 0. P = 0 means every bag is extra.
4. A bag exactly at the limit is free of weight charge.

## Output
1. Keep only passengers with `feeCents > 0`.
2. Sort by `feeCents` descending, ties by `name` ascending in ASCII (byte) order: uppercase before lowercase, space before letters; compare character by character, a shorter prefix first.
3. Write `excess-baggage.csv` beside `input.json`, header exactly `booking,name,bags,fee`, one row per passenger, `bags` = n (count of all checked bags), `fee` = dollars with exactly two decimals, no sign: `feeCents div 100`, "." , `feeCents mod 100` zero-padded to 2 digits (e.g. 10500 → `105.00`, 650 → `6.50`, 5 → `0.05`). No thousands separators.
4. If a field contains a comma, quote, or newline, wrap it in double quotes and double inner quotes (CSV). Use `\n` line endings, trailing newline. If nobody owes anything, the file holds only the header line.

## Procedure
1. Read `input.json`.
2. For each passenger write down n, P, L, extra charge, each bag's steps, and the total in cents. Re-check the sums.
3. Filter, sort, format, write the file. Re-read it to verify header, ordering and decimals.

## Example
economy = {pieces 1, kg 23}, extraPieceCents 6500, overweightCents 2000. Bags [29, 12]: bag 1 is 6 over → 2 steps = 4000; bag 2 is an extra piece = 6500, weight fine → 0. Total 10500 → row `B1,Ann Lee,2,105.00`.

## Limits
Cannot run code; verify arithmetic manually, especially for long passenger lists.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.