Communitygithub.com

aiagentwithdhruv/skills

Auto-label Gmail emails into Action Required, Waiting On, and Reference categories. Use when user asks to label emails, triage inbox, categorize emails, or organize Gmail.

skills 是什么?

skills is a Claude Code agent skill that auto-label Gmail emails into Action Required, Waiting On, and Reference categories. Use when user asks to label emails, triage inbox, categorize emails, or organize Gmail.

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/aiagentwithdhruv/skills/tree/HEAD/gmail-label

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Gmail Auto-Label

Goal

Fetch inbox emails, classify them via parallel subagents into Action Required / Waiting On / Reference, and apply labels in bulk via Gmail API.

Scripts

  • ./scripts/gmail_label_fetch.py - Fetch email summaries as compact JSON
  • ./scripts/gmail_label_split.py - Split emails into N chunks for parallel classification
  • ./scripts/gmail_label_merge.py - Merge classified chunks into single labels.json
  • ./scripts/gmail_label_apply.py - Apply label classifications in bulk

Subagent

  • email-classifier — defined in .claude/agents/email-classifier.md
  • Model: Sonnet 4.5 (fast, cost-efficient classification)
  • Each subagent reads one chunk, writes one classified output file

Flow (Parallel — default)

Step 1: Fetch emails

python3 .claude/skills/gmail-label/scripts/gmail_label_fetch.py \
  --account ACCOUNT --query "in:inbox" --limit 100 --output .tmp/emails.json

Step 2: Split into chunks

python3 .claude/skills/gmail-label/scripts/gmail_label_split.py \
  --input .tmp/emails.json --chunks 10 --output-dir .tmp/chunks

Step 3: Classify in parallel (spawn 10 subagents)

Spawn 10 email-classifier subagents in background, one per chunk. Each subagent:

  • Reads .tmp/chunks/chunk_N.json
  • Classifies each email
  • Writes .tmp/chunks/classified_N.json

Use the Task tool with run_in_background: true and model: "sonnet". Launch ALL 10 in a single message for true parallelism:

For each chunk 0-9, spawn a Task with:
  subagent_type: "email-classifier"
  model: "sonnet"
  run_in_background: true
  prompt: "Read /absolute/path/.tmp/chunks/chunk_N.json, classify each email, write results to /absolute/path/.tmp/chunks/classified_N.json"

CRITICAL: Do NOT use TaskOutput to read subagent results. The subagents write their results to files — the main agent never needs to see the classification data. Reading TaskOutput will flood the context window and cause "prompt too long" errors with large batches (500+ emails).

Instead, poll for file existence:

# Wait until all classified files exist (timeout after 120s)
for i in $(seq 0 9); do
  while [ ! -f ".tmp/chunks/classified_$i.json" ]; do sleep 2; done
done

Then proceed directly to Step 4 (merge).

Step 4: Merge classifications

python3 .claude/skills/gmail-label/scripts/gmail_label_merge.py \
  --input-dir .tmp/chunks --output .tmp/labels.json

Step 5: Apply labels

python3 .claude/skills/gmail-label/scripts/gmail_label_apply.py \
  --account ACCOUNT --input .tmp/labels.json

Classification Guidelines

Action Required:

  • Security alerts that need verification
  • Expiring credit cards / domain renewals with deadlines
  • Slack @mentions asking questions
  • New team members to greet (Slack join notifications)
  • Client emails needing response
  • Business listing updates (Google Business Profile, Bing Places)
  • Stripe action-required notices

Waiting On:

  • Outbound sales emails awaiting reply
  • Support tickets awaiting resolution
  • Proposals sent, pending response

Reference:

  • Marketing newsletters (DigitalMarketer, etc.)
  • Charity/nonprofit newsletters (RAPS, etc.)
  • Google Business Profile performance reports
  • Promotional offers (Blinkist, sales, etc.)
  • Platform update notifications (Google Play, Apify, etc.)
  • Confirmation codes (already used)
  • Real estate newsletters (Westbank, etc.)
  • Gaming account emails (Riot Games, etc.)
  • Informational security alerts (2FA turned on, etc.)
  • Health advisories
  • Legal/policy update notices

Account Registry

Accounts are stored in gmail_accounts.json at workspace root. Each account needs:

  • email - Gmail address
  • token_file - Path to OAuth token

Adding New Accounts

python3 .claude/skills/gmail-inbox/scripts/gmail_multi_auth.py --account ACCOUNT_NAME --email EMAIL

Performance

  • Serial flow: ~36s for 100 emails (fetch 1s + classify 34s + apply 1s)
  • Parallel flow: ~30s for 100 emails (classify 19s + merge <1s + apply ~10s)
  • Classification is the bottleneck; 10 parallel subagents cut it from 34s to 19s (~1.8x speedup)
  • Agent startup overhead (~4s stagger) limits theoretical gains
  • Apply step may vary due to Gmail API throttling

Schema

Inputs

NameTypeRequiredDescription
accountstringYesGmail account name from registry
querystringNoGmail search query (default: 'in:inbox')
limitintegerNoMax emails to classify (default: 100)
chunksintegerNoParallel classification chunks (default: 10)

Outputs

NameTypeDescription
labels_appliedobjectCount per category: Action Required, Waiting On, Reference

Credentials

NameSource
credentials.jsonfile
token_*.jsonfile (auto-generated)

Composable With

Skills that chain well with this one: gmail-inbox

Cost

Claude Sonnet API for classification

Individual skills in this repo

This repo contains 10 individual skills — each has its own dedicated page.

aiagentwithdhruv/skills

Add new Modal webhooks for event-driven execution. Use when user asks to create a webhook, add an endpoint, or set up event triggers.

aiagentwithdhruv/skills

Answer Euron Gen AI Bootcamp doubts instantly. Covers Euri API setup across all frameworks (Python, LangChain, OpenAI SDK, TypeScript, n8n, curl), MCP server setup, common errors, model recommendations, and token limits. Use when someone in the bootcamp asks a question.

aiagentwithdhruv/skills

Manage emails across multiple Gmail accounts with unified tooling. Use when user asks to check email, read inbox, label emails, archive messages, or manage Gmail across accounts.

aiagentwithdhruv/skills

Scrape Google Maps for B2B leads with deep website enrichment and contact extraction. Use when user asks to find local businesses, scrape Google Maps, generate contractor lists, or build local service business databases.

aiagentwithdhruv/skills

Run Claude orchestrator locally with Cloudflare tunneling. Use when user asks to run locally, start local server, or test webhooks locally.

aiagentwithdhruv/skills

MCP server for AI-powered macOS control — apps, display, audio, files, screenshots, clipboard

aiagentwithdhruv/skills

Deploy execution scripts to Modal cloud. Use when user asks to deploy to Modal, push code to cloud, or update Modal functions.

aiagentwithdhruv/skills

Scrape and verify business leads using Apify, classify with LLM, enrich emails, and save to Google Sheets. Use when user asks to find leads, scrape businesses, generate prospect lists, or build lead databases for any industry or location.

aiagentwithdhruv/skills

Query Skool community content using RAG pipeline with vector search. Use when user asks to search Skool knowledge, find community answers, or query Skool content.

aiagentwithdhruv/skills

Scrape Upwork jobs and generate personalized proposals with cover letters. Use when user asks to find Upwork jobs, create Upwork proposals, or apply to Upwork listings.

相关技能