agentleFS
scurryscurry/meals-agent/.claude/skills/meal-receipt/SKILL.md

meal-receipt

Skill0 starsChanged 8 months agoMITView on GitHub

Use when processing grocery receipt images for the Meal OS system. Triggered by "/meal-receipt" or "process receipts" or "scan receipts".

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. About 0 are common, 12 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the user provides image paths directly (e.g., /meal-receipt @mb-1.jpg @mb-2.jpg):

    line 27
  2. Distinctive:

    If multiple images, ask: "Are these all from the same receipt?"

    line 28
  3. Distinctive:

    If yes, treat as one set ordered by the filenames

    line 29
  4. Distinctive:

    If no, ask the user to clarify grouping

    line 30
  5. Very specific:

    If no images are found or provided, say: "No receipt images found.

    line 32
  6. Distinctive:

    Read these files in parallel:

    line 36
  7. Very specific:

    If canonical-ingredients.yaml does not exist: Stop and tell the user: "data/canonical-ingredients.yaml is missing.

    line 40
  8. Distinctive:

    If store or date cannot be determined from the receipt, ask the user.

    line 66
  9. Distinctive:

    After corrections, re-show the updated mapping for final confirmation

    line 108
  10. Very specific:

    Write confirmed items to data/receipts/price-history.yaml.

    line 112
  11. Distinctive:

    If the file doesn't exist yet, create it

    line 142
  12. Distinctive:

    If the file exists, read it first and append new entries

    line 143
  13. Very specific:

    Write any new alias mappings (from user corrections or high-confidence matches) to data/receipts/aliases.yaml.

    line 147
  14. Distinctive:

    If the file doesn't exist yet, create it with a header comment

    line 163
  15. Distinctive:

    Never overwrite existing aliases (if a conflict arises, keep the existing one and warn)

    line 165
  16. Distinctive:

    Only save aliases from user corrections (fix command) and high-confidence matches that the user confirmed

    line 166
  17. Very specific:

    After successful processing, move all images in the receipt set from data/receipts/images/ to data/receipts/images/processed/ to prevent …

    line 170
  18. Distinctive:

    If multiple receipt sets were processed, show a summary for each.

    line 190

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/meal-receipt — Receipt OCR & Price Tracker

Process grocery receipt images to build a price history ledger for cost estimates and loss leader detection.

Announce at start: "Processing grocery receipts..."

Step 1: Get Receipt Images

The user provides receipt images in one of two ways:

Option A: Folder Scan

Scan data/receipts/images/ for image files (.jpg, .jpeg, .png). Ignore files in the processed/ subfolder.

Group images into receipts by set ID — everything before the last -N in the filename:

  • mb-1.jpg, mb-2.jpg, mb-3.jpg → set "mb" (one receipt, 3 pages)
  • hannafords-1.jpg → set "hannafords" (one receipt, 1 page)
  • mb2-1.jpg, mb2-2.jpg → set "mb2" (second receipt, 2 pages)

The -N suffix determines page order within a set.

Option B: Chat

If the user provides image paths directly (e.g., /meal-receipt @mb-1.jpg @mb-2.jpg):

  • If multiple images, ask: "Are these all from the same receipt?"
  • If yes, treat as one set ordered by the filenames
  • If no, ask the user to clarify grouping

If no images are found or provided, say: "No receipt images found. Drop photos in data/receipts/images/ (e.g., mb-1.jpg, mb-2.jpg) or pass them directly: /meal-receipt @receipt.jpg"

Step 2: Load References

Read these files in parallel:

  • data/canonical-ingredients.yaml — for matching items to canonical IDs
  • data/receipts/aliases.yaml — for learned abbreviation mappings (if file exists)

If canonical-ingredients.yaml does not exist: Stop and tell the user: "data/canonical-ingredients.yaml is missing. Run /meal-setup first to initialize the project, then re-run /meal-receipt."

Step 3: OCR Receipt Images

For each receipt set, read the images in page order using the Read tool (Claude vision).

Extract from each receipt:

  • Store name — from the receipt header
  • Date — from the receipt header (fall back to file modification date if unreadable)
  • Line items — each with:
    • Item description (as printed)
    • Quantity (if weight-based, e.g., "2.13 lb")
    • Unit price (e.g., "$2.99/lb")
    • Total price

Lines to skip:

  • Tax lines, subtotals, totals, tender/payment, change
  • Savings summary lines, coupon lines, rewards/loyalty lines
  • Store header/footer info (address, phone, etc.)

Price normalization:

  • Weight-based: "2.13 lb @ $2.99/lb = $6.37" → extract per-unit price $2.99/lb
  • Multi-for: "2 @ 2/$5" → $2.50/each
  • Per-item: "$3.99" → $3.99/each

If store or date cannot be determined from the receipt, ask the user.

Step 4: Match Items to Canonical Ingredients

For each extracted line item, attempt to match to a canonical ingredient ID using this priority:

  1. Exact alias match — check data/receipts/aliases.yaml for the item description
  2. Fuzzy match against canonical-ingredients.yaml — compare to display names
  3. Common abbreviation patterns — apply known grocery shorthand:
    • CKN/CHKN = chicken, BRST = breast, THGH = thigh
    • EVOO = olive oil, EV OLV OIL = olive oil
    • GRK = greek, YOG = yogurt
    • ORG = organic (modifier, match base item)
    • FRSH = fresh (modifier, match base item)
    • GRND = ground
    • BKLS/BNLS = boneless, SKNLS = skinless
  4. No match — mark as ?

Step 5: Preview and Confirm

Show the full mapping before saving anything:

Receipt: [Store Name] — [YYYY-MM-DD] ([N] images)

  Matched items:
  1. [RECEIPT TEXT]    $[price]  →  [canonical_id] ($[unit_price]/[unit])
  2. [RECEIPT TEXT]    $[price]  →  [canonical_id] ($[unit_price]/[unit])
  ...

  Unmatched:
  N. [RECEIPT TEXT]    $[price]  →  ? ([suggestion or "non-food, skip"])
  ...

Confirm? (yes / fix [#] [canonical_id] / skip [#])

User corrections:

  • yes — save all matched items to the price ledger
  • fix 6 pasta — changes item 6's mapping to pasta; saves the abbreviation → canonical_id pair to data/receipts/aliases.yaml
  • skip 5 — marks item as non-food or irrelevant, excluded from ledger
  • Allow multiple corrections before final yes
  • After corrections, re-show the updated mapping for final confirmation

Step 6: Update Price Ledger

Write confirmed items to data/receipts/price-history.yaml.

Note: data/receipts/price-history.yaml is gitignored. See samples/receipts/price-history.yaml for a sanitized example.

Ledger format:

chicken_breast:
  - date: 2026-03-22
    store: Market Basket
    price: 2.99
    unit: /lb
    receipt: mb
  - date: 2026-03-15
    store: Hannaford's
    price: 4.49
    unit: /lb
    receipt: hannafords
olive_oil:
  - date: 2026-03-22
    store: Market Basket
    price: 9.99
    unit: /25 oz
    receipt: mb

Rules:

  • Append-only — never overwrite or remove previous entries
  • Organize by canonical ID (or human-readable name for non-canonical items)
  • Entries sorted by date descending within each ID
  • If the file doesn't exist yet, create it
  • If the file exists, read it first and append new entries

Step 7: Update Aliases

Write any new alias mappings (from user corrections or high-confidence matches) to data/receipts/aliases.yaml.

Aliases format:

# Learned receipt abbreviation → canonical ingredient ID
# Added automatically when user corrects a fuzzy match
'MB CKNBRST': chicken_breast
'PERDUE CKNBRST': chicken_breast
'MB GRAPE TOMATO': cherry_tomato
'EVOO 25OZ': olive_oil
'CHOBANI GREEK YOG': greek_yogurt

Rules:

  • Always single-quote alias keys — receipt text is unpredictable and may contain #, :, %, or other YAML-special characters
  • If the file doesn't exist yet, create it with a header comment
  • If the file exists, read it first and append new entries
  • Never overwrite existing aliases (if a conflict arises, keep the existing one and warn)
  • Only save aliases from user corrections (fix command) and high-confidence matches that the user confirmed

Step 8: Move Processed Images

After successful processing, move all images in the receipt set from data/receipts/images/ to data/receipts/images/processed/ to prevent re-processing while preserving originals.

Step 9: Confirm

Output a summary:

Receipt processed: [set ID] ([Store Name], [YYYY-MM-DD])

  Items matched: [N]
  Items skipped: [M] (non-food)
  New aliases learned: [K]
  Price ledger updated: data/receipts/price-history.yaml

  Notable prices vs. history:
  - [canonical_id]: $X.XX/unit (avg $Y.YY, ZZ% below/above average)
  - [canonical_id]: $X.XX/unit (first entry — no comparison yet)
  ...

If multiple receipt sets were processed, show a summary for each.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.