Skip to content
Back to skills

Excess Baggage

ASecurity

Compute airline check-in excess baggage fees from an input.json (allowances per cabin, extraPieceCents, overweightCents, passengers with bag weights) and write excess-baggage.csv (booking,name,bags,fee). Use whenever asked to work out excess baggage, extra-piece or overweight bag charges, or baggage fees from such a file, even if the file or output is named differently.

  • 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-adb11f8e/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-excess-baggage-adb11f8e)

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: Compute airline check-in excess baggage fees from an input.json (allowances per cabin, extraPieceCents, overweightCents, passengers with bag weights) and write excess-baggage.csv (booking,name,bags,fee). Use whenever asked to work out excess baggage, extra-piece or overweight bag charges, or baggage fees from such a file, even if the file or output is named differently.
---

# Excess baggage fees

You cannot run code, so do the arithmetic by hand, carefully, and write the CSV with the file-writing tool. Work in integer cents until the very end; this avoids rounding mistakes.

## 1. Read input.json
Fields: `allowances` (cabin -> `{pieces, kg}`), `extraPieceCents`, `overweightCents`, `passengers` (each `{booking, name, cabin, bags}`). `bags` is an ordered list of whole-kg weights; order matters. Look up each passenger's cabin in `allowances` exactly as spelled (case-sensitive key).

## 2. Fee per passenger
Let `P` = cabin pieces, `L` = cabin kg limit, `n` = number of bags.

1. **Extra pieces**: bags at positions 1..P (list order) are included. Every bag at position P+1 onward is an extra piece. Extra count = `max(0, n - P)`. Charge = extra count x `extraPieceCents`. (If P is 0, every bag is extra.)
2. **Overweight**: check EVERY bag, included or extra, on its own against L. `over = weight - L`. If `over <= 0`, charge 0 (spare capacity never transfers between bags). Otherwise `steps = ceil(over / 5)`, i.e. 1-5 over = 1, 6-10 = 2, 11-15 = 3, 16-20 = 4 ... Compute as `(over + 4)` integer-divided by 5. Charge = steps x `overweightCents`. A bag exactly at the limit is free; a bag exactly 5 over is one step, 10 over is two.
3. **Fee (cents)** = extra-piece charge + sum of overweight charges. An extra bag that is also overweight pays both.

Check with the worked example: limit 23, 1 piece, bags [29, 12]: 29 is 6 over -> 2 steps = 4000; bag 2 is extra = 6500; 12 kg is under limit. Total 10500 = 105.00.

Write down per-passenger working (bag by bag) before moving on; recheck any large fee.

## 3. Select and sort
- Keep only passengers with fee > 0 (a passenger with no bags, or all bags within allowance, is omitted).
- Sort by fee descending (compare cents as integers). Ties: ascending ASCII order of `name`, compared character by character by code: space < digits < uppercase letters < lowercase letters (so "Zed" comes before "adam"; "Li" before "Li-Wei"... a shorter prefix comes first). Do not use case-insensitive or locale ordering. Names are unique, so the order is total.

## 4. Write excess-baggage.csv
Place it in the same folder as input.json.
- First line exactly: `booking,name,bags,fee`
- One line per kept passenger: `booking,name,n,fee`
  - `booking` and `name` copied verbatim from the input (keep leading zeros etc.). If a value contains a comma, double quote or newline, wrap it in double quotes and double any inner quotes; otherwise leave it unquoted.
  - `n` = total number of bags the passenger checked (all bags, not just extra ones).
  - `fee` = cents / 100 with exactly two decimals, no currency sign, no thousands separators (e.g. 10500 -> `105.00`, 6500 -> `65.00`, 2050 -> `20.50`, 5 -> `0.05`, 123456 -> `1234.56`). Build it from the integer: dollars = cents div 100, remainder padded to two digits.
- Use `\n` line endings and end the file with a trailing newline.
- If nobody owes anything, the file contains only the header line.

## 5. Final check
Re-read the written file: header correct, rows only for fee > 0, order is fee descending then name ASCII, every fee has two decimals, passenger count of rows matches your working. Then tell the user briefly how many passengers were charged.

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.