Skip to content
Back to skills

Loyalty Points

ASecurity

Use this skill when a user wants weekly loyalty or points-card points totalled per card holder from a list of purchases (member and cents paid, e.g. input.json) and written to loyalty-points.csv, ranked highest first. Not for discounts, refunds reports or other CSV summaries.

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

Security analysis

A100/100

Scanned December 6, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill loyalty-points --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Loyalty Points?

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

Security grade badge for Loyalty Points
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-loyalty-points-8d47cc72/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-loyalty-points-8d47cc72)

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: loyalty-points
description: "Use this skill when a user wants weekly loyalty or points-card points totalled per card holder from a list of purchases (member and cents paid, e.g. input.json) and written to loyalty-points.csv, ranked highest first. Not for discounts, refunds reports or other CSV summaries."
---

# Loyalty points

Turn this week's purchases into a per-member points table.

## Inputs
- `input.json` in the working folder: `{"purchases": [{"member": "Ana", "cents": 1299}, ...]}`.
- If the file or the `purchases` array is missing or malformed, stop and tell the user; do not invent data.

## Rules (exact)
For each purchase, with `c` = cents (integer):
- `dollars = floor(c / 100)` (whole dollars; cents are dropped, never rounded up).
- If `c >= 5000` (exactly 5000 counts): `points = 2 * dollars`. Otherwise `points = dollars`.
- If `c <= 0` (zero or negative): `points = 0`. Don't subtract anything.
- Points are computed **per purchase**, then summed per member. Never total cents first.
  Example: 1299 and 4250 give 12 + 42 = 54, not floor(5549/100) = 55.
- A member's total is the sum of their purchase points. Members with total 0 are still listed.
- Member names match exactly (case-sensitive, after trimming surrounding whitespace). One row per distinct member.

## Steps
1. Read `input.json`.
2. Compute points for every purchase using the rules above, working them out carefully by hand, one line each.
3. Sum per member.
4. Sort by points descending; break ties by member name ascending (plain character order, uppercase before lowercase).
5. Write `loyalty-points.csv` beside `input.json`.

## Output format
- First line exactly `member,points`, then one line per member: `name,total`.
- Lines end with `\n`; no blank line or extra columns. Points are plain integers.
- If a name contains a comma, quote, or newline, wrap it in double quotes and double any inner quotes.
- No purchases: the file contains only the header line.

## Worked example
Purchases: Eve 1050, Gus 99, Dee 2075, Fay 7500, Eve 1099.
- Eve 10 + 10 = 20; Gus 0; Dee 20; Fay 2 * 75 = 150.
- Sorted (Dee before Eve on the tie):

```csv
member,points
Fay,150
Dee,20
Eve,20
Gus,0
```

Another check: Hal 5099 and 450 give 2 * 50 + 4 = 104; Kai 4999 gives 49 (below the 5000 threshold).

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.