{"slug": "build-your-first-claude-skill-an-gmail-to-gdrive-receipt-filer-in-20-minutes", "title": "Build Your First Claude Skill: An Gmail-to-GDrive Receipt Filer in 20 Minutes", "summary": "A developer built a Claude skill that automatically files Gmail receipts into Google Drive, organized by year, month, and vendor, with a CSV log entry for each transaction. The skill, stored as a `SKILL.md` file in a local directory, instructs Claude to search Gmail for receipt-related emails, download PDF attachments, and save them to a structured folder path like `/Receipts/{YYYY}/{MM}/{vendor}-{YYYY-MM-DD}.pdf`. The project demonstrates how to create a reusable, file-based skill that can be built from scratch in about 20 minutes using Claude's Gmail and Google Drive MCP connectors.", "body_md": "A hands-on tutorial for developers who want to extend Claude with a reusable, file-based skill that triages Gmail receipts and files them in Google Drive.\n\nI lose receipts. Not paper ones — digital ones. Stripe invoices, AWS bills, the Apple developer renewal, the random SaaS subscription I forgot I had. They sit in Gmail forever, then in March I spend a Saturday rummaging through search queries trying to assemble a year of expenses for my accountant.\n\nThis year I decided to fix it with a **Claude skill**. The result: I type \"file my receipts from last month\" and Claude reaches into Gmail, pulls PDFs, drops them in the right Google Drive folder, and appends a row to a CSV log. It works because the skill *tells Claude exactly how I want this done* — once, in a file, forever.\n\nThis post walks through building that skill from scratch. If you've never made one before, this is the gentlest possible on-ramp. By the end you'll have a working skill you can adapt to whatever email-and-Drive pipeline you actually need.\n\nA skill is just a folder with a `SKILL.md`\n\nfile inside. That file has YAML frontmatter (name + description) and a markdown body that's a prompt — a set of instructions Claude will load *only when relevant*.\n\n```\n~/.claude/skills/receipt-filer/\n├── SKILL.md          # the instructions\n└── scripts/          # optional helpers Claude can run\n    └── log.py\n```\n\nThe crucial detail: skills are **discovered by description**. When you ask Claude something, it scans skill descriptions and pulls the matching one into context. That means the `description:`\n\nfield is doing real work — it's not documentation, it's a retrieval target. Write it like a search query someone might use, not like a README intro.\n\nSkills beat \"just stuff it in a system prompt\" for three reasons:\n\nSpecifically:\n\n`/Receipts/{YYYY}/{MM}/{vendor}-{YYYY-MM-DD}.pdf`\n\n.`/Receipts/log.csv`\n\nwith `date, vendor, amount, currency, drive_link, gmail_link`\n\n.The skill is going to encode all of that.\n\nYou need Claude with the Gmail and Google Drive MCP connectors enabled. In Claude Code or the desktop app this is a one-time auth flow per connector — search the settings for \"Connectors\" and toggle them on. The connector names you'll see Claude use in tool calls are things like `search_threads`\n\n, `get_thread`\n\n, `download_file_content`\n\n, `create_file`\n\n. You don't need to memorize them; the skill will reference them in plain English and Claude figures out which tool to call.\n\n```\nmkdir -p ~/.claude/skills/receipt-filer/scripts\ntouch ~/.claude/skills/receipt-filer/SKILL.md\n```\n\nThat's the whole scaffolding step. There is no CLI, no init command, no package.json. A skill is a directory.\n\nOpen `~/.claude/skills/receipt-filer/SKILL.md`\n\nand start with the frontmatter:\n\n```\n---\nname: receipt-filer\ndescription: \"File receipts and invoices from Gmail into Google Drive, organized by year/month/vendor, and append rows to a tracking CSV. Use when the user asks to \\\"file receipts\\\", \\\"archive invoices\\\", \\\"organize my Gmail receipts\\\", \\\"save receipts to Drive\\\", or mentions tax prep, expense reports, or monthly bookkeeping. Handles PDF attachments, linked PDFs, and HTML-only receipts.\"\n---\n```\n\nTwo things to notice. The description is **long and trigger-rich on purpose** — every phrase a user might use to ask for this is in there. And it ends by clarifying what the skill *handles*, which helps Claude not over-trigger on, say, a forwarded recipe email.\n\nNow the body. This is the actual instruction set Claude follows. I'll show it in pieces, then assemble.\n\n```\n## Goal\n\nFor each receipt/invoice email the user asks about, produce exactly one PDF in Google Drive\nunder `/Receipts/{YYYY}/{MM}/` named `{vendor-slug}-{YYYY-MM-DD}.pdf`, and exactly one\nappended row in `/Receipts/log.csv`. Never modify the Gmail thread. Never overwrite an\nexisting Drive file — append `-1`, `-2`, etc. if there's a collision.\n```\n\nConcrete invariants beat fuzzy \"be careful.\" Claude will follow them.\n\n```\n## What counts as a receipt\n\nInclude:\n- Emails with a PDF attachment whose filename or body mentions \"invoice\", \"receipt\",\n  \"statement\", or \"billing\".\n- Senders matching: `billing@`, `invoice@`, `receipts@`, `no-reply@stripe.com`,\n  `do-not-reply@amazon.com`, `invoice+statements@mail.anthropic.com`, AWS marketing\n  mail flagged \"Your AWS Invoice\".\n- HTML-only emails from the above senders even when there's no attachment — render the\n  email body to PDF before filing.\n\nExclude:\n- Order confirmations that aren't paid yet (\"Your order has been placed\" without a\n  charge amount).\n- Shipping notifications.\n- Marketing emails. If the body has no monetary total, skip it.\n```\n\nThis is the heuristic layer. You'll refine this list over time as you find weird cases the skill misclassifies.\n\n```\n## Procedure\n\n1. **Scope the search.** Default to the last 35 days unless the user specifies a range.\n   Use Gmail search: `(invoice OR receipt OR statement) has:attachment OR from:(stripe.com OR amazon.com OR anthropic.com)`.\n\n2. **Fetch threads, not messages.** Receipts sometimes arrive as replies to earlier\n   threads. Use `get_thread` and inspect each message.\n\n3. **For each candidate, extract:**\n   - `vendor` — slug of the sending domain (e.g. `stripe`, `aws`, `anthropic`)\n   - `date` — the message's Date header in `YYYY-MM-DD`\n   - `amount` and `currency` — parse from the PDF text or email body. If you can't find\n     an amount with confidence, surface it to the user before filing.\n\n4. **Build the Drive path.** `/Receipts/{date.year}/{date.month:02d}/`. Create folders\n   if missing.\n\n5. **Upload.** Filename: `{vendor}-{date}.pdf`. If a file with that name exists, suffix\n   `-1`, `-2`, ... until unique. Never overwrite.\n\n6. **Log.** Append one row to `/Receipts/log.csv`:\n   `date,vendor,amount,currency,drive_link,gmail_link`. If the CSV doesn't exist, create\n   it with that header row.\n\n7. **Report.** When done, print a table of what was filed, what was skipped, and why.\n```\n\nNumbered procedures are the bread and butter of skills. Claude follows them with surprising fidelity, and when something goes wrong you can point at the exact step that needs tightening.\n\n```\n## Safety\n\n- Never delete or archive the Gmail message.\n- Never overwrite a Drive file — always suffix on collision.\n- If `amount` extraction is ambiguous (two plausible totals, or none), stop and ask\n  the user before filing that specific receipt. Continue with the unambiguous ones.\n- If the user asks to file >50 receipts in one go, confirm before proceeding.\n```\n\nThe 50-receipt confirmation is the kind of detail you only add after the skill once tried to file 800 things at 2am.\n\nYou don't *need* scripts. But for things Claude can't do well from instructions alone — say, CSV writing with proper quoting — a small Python helper is nice. Skills can reference scripts in their own directory and Claude will execute them via its shell tool.\n\n``` python\n# ~/.claude/skills/receipt-filer/scripts/log.py\nimport csv, sys, pathlib\n\npath = pathlib.Path(sys.argv[1])\nrow = sys.argv[2:]\nnew = not path.exists()\nwith path.open(\"a\", newline=\"\") as f:\n    w = csv.writer(f)\n    if new:\n        w.writerow([\"date\", \"vendor\", \"amount\", \"currency\", \"drive_link\", \"gmail_link\"])\n    w.writerow(row)\n```\n\nThen in `SKILL.md`\n\nadd:\n\n```\n## Helpers\n\nFor writing CSV rows, prefer `scripts/log.py` (in this skill's directory) over crafting\nCSV by hand — it handles quoting correctly.\n```\n\nRestart your Claude client so it rescans the skills folder, then type:\n\nfile my receipts from the last 30 days\n\nYou should see Claude announce that it's using the `receipt-filer`\n\nskill (Claude Code prints this; the desktop app shows a chip). Watch what it does. The first run is where the skill earns its keep — or shows you the gaps in your instructions.\n\nIn mine, the first run:\n\nThree iterations, each one a one-line edit to `SKILL.md`\n\n, and the skill has been quietly reliable since.\n\nAfter building a few of these I've internalized a short list:\n\nThe pattern generalizes. A few skills I've built on the same template:\n\n`pr-digest`\n\n`vendor-onboarding`\n\n`weekly-newsletter-roundup`\n\nAll of them are the same shape: a folder, a `SKILL.md`\n\n, optional scripts, a clear procedure, named safety rails. Once you've built one, the second one takes ten minutes.\n\nThe receipt filer is mine. Steal it, fork it, replace \"Receipts\" with whatever Gmail-shaped chaos you'd like to delegate.", "url": "https://wpnews.pro/news/build-your-first-claude-skill-an-gmail-to-gdrive-receipt-filer-in-20-minutes", "canonical_source": "https://dev.to/devpato/build-your-first-claude-skill-an-gmail-to-gdrive-receipt-filer-in-20-minutes-2fn7", "published_at": "2026-05-27 18:50:56+00:00", "updated_at": "2026-05-27 19:11:03.551774+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "large-language-models", "generative-ai", "artificial-intelligence"], "entities": ["Claude", "Gmail", "Google Drive", "Stripe", "AWS", "Apple"], "alternates": {"html": "https://wpnews.pro/news/build-your-first-claude-skill-an-gmail-to-gdrive-receipt-filer-in-20-minutes", "markdown": "https://wpnews.pro/news/build-your-first-claude-skill-an-gmail-to-gdrive-receipt-filer-in-20-minutes.md", "text": "https://wpnews.pro/news/build-your-first-claude-skill-an-gmail-to-gdrive-receipt-filer-in-20-minutes.txt", "jsonld": "https://wpnews.pro/news/build-your-first-claude-skill-an-gmail-to-gdrive-receipt-filer-in-20-minutes.jsonld"}}