Skip to content
Back to skills

Loyalty Points

ASecurity

Compute weekly garden-centre loyalty card points from input.json (purchases array of {member, cents}) and write loyalty-points.csv beside it. Use whenever the user mentions loyalty points, points card, card holders' weekly points, or an input.json with purchases of member and cents, even if they don't name this skill.

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

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-b6a86b62/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-loyalty-points-b6a86b62)

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: Compute weekly garden-centre loyalty card points from input.json (purchases array of {member, cents}) and write loyalty-points.csv beside it. Use whenever the user mentions loyalty points, points card, card holders' weekly points, or an input.json with purchases of member and cents, even if they don't name this skill.
---

# Loyalty points

Read `input.json` in the working folder and write `loyalty-points.csv` in the same folder. You cannot run code, so do the arithmetic by hand, carefully, and show your work in your reasoning.

## Rules (derived from the worked examples)

Points are earned **per purchase**, never on a member's combined total:

1. Base points for a purchase = whole dollars = `cents` divided by 100, rounded **down** (1299 -> 12, 99 -> 0, 4999 -> 49). Do not round to nearest.
2. If that single purchase is **5000 cents or more** (exactly 5000 counts), its points are **doubled** (5000 -> 100, 7500 -> 150, 5099 -> 100, 12050 -> 240). 4999 is not doubled.
3. A member's points = sum of the points of all their purchases. Small purchases never combine to reach the double threshold (Ana 1299 + 4250 gets no doubling).

Check: Ben 5000 + 349 -> 100 + 3 = 103. Hal 5099 + 450 -> 100 + 4 = 104. Eve 1050 + 1099 -> 10 + 10 = 20.

## Steps

1. Read `input.json`; take every entry of `purchases`.
2. For each purchase compute its points with rules 1-2, writing one line per purchase (member, cents, points).
3. Group by `member` (exact name match) and sum. Every member who appears gets a row, including those with 0 points (e.g. a single 99-cent purchase -> `Gus,0`).
4. Sort rows by points **descending**; break ties by member name **ascending** (alphabetical), e.g. Dee before Eve at 20.
5. Write `loyalty-points.csv` beside `input.json`:
   - First line exactly `member,points`
   - One line per member: `name,points`, integers only, no quotes, no spaces, no extra columns
   - Newline after each line, no blank lines
6. Re-read the file once and recheck the sums and ordering against your per-purchase lines.

## Example

Purchases: Eve 1050, Gus 99, Dee 2075, Fay 7500, Eve 1099 ->

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

If a member name contains a comma or quote, wrap it in double quotes per standard CSV. If `purchases` is empty, write only the header line.

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 development →

Comments

Loading comments…

Newsletter

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