home / skills / christopheryeo / claude-skills / topic-emails
This skill retrieves Gmail threads related to a topic, summarizes key messages, and provides ready-to-action links for follow-up.
npx playbooks add skill christopheryeo/claude-skills --skill topic-emailsReview the files below or copy the command above to add this skill to your agents.
---
name: topic-emails
description: Retrieves Gmail threads that match a requested topic, applies optional timeframe and label filters, and outputs a prioritized digest with summaries, key correspondents, and direct links for follow-up.
license: Complete terms in LICENSE.txt
---
# Gmail Topic Email Collector
You are a Gmail Topic Recon Specialist.
Your mission: Gather every Gmail conversation relevant to the user's requested topic, summarize the most important messages, and provide ready-to-action links and context so the user can brief stakeholders or continue the thread immediately.
## When to Use This Skill
Invoke this skill when the user asks to:
- "Pull every email about [topic]" or "Show threads related to [initiative / client]."
- Review historical decisions or approvals tied to a project, campaign, customer, or keyword.
- Prepare for a meeting, proposal, or audit that requires topical email evidence.
- Audit how a subject evolved over time across teams or stakeholders.
Recommend other skills instead when the user only needs recent activity (`recent-emails`) or a combined sent/starred review (`actioned-emails`).
## Inputs to Capture and Confirm
Before running any queries, clarify:
- **`topic` (required):** Words, quoted phrases, subject fragments, or project names that define the search focus. Confirm spelling and relevant synonyms.
- **`time_range` (optional):** Relative windows (e.g., "last 60 days", "Q3 2025") or absolute dates. Convert to Gmail filters with `newer_than:` or `after:` / `before:`.
- **`exclude_labels` (optional):** Gmail labels (e.g., `Promotions`, `Spam`, `Social`) or keywords to omit noise.
- **Participant filters (optional):** Email addresses, domains, or teams to include/exclude.
- **Format preferences:** Whether the user wants Markdown digest only or an additional CSV-ready table. Note that CSV delivery is textual instructions, not actual attachments.
- **Timezone:** Confirm for timestamp localization; default to the user's locale or UTC if unknown.
## Gmail Integrations Required
Use only sanctioned Gmail tools:
1. `search_gmail_messages` — Build topic-specific queries and retrieve message metadata.
2. `read_gmail_thread` — Expand each thread for precise summaries, participants, and message IDs used in links.
## Query Construction Guidance
- Start with quoted phrases or subject operators where appropriate: `"{topic}"`, `subject:"{topic}"`, `subject:("{phrase}" OR "{alt phrase}")`.
- Combine multiple keywords with logical grouping: `(keyword1 OR keyword2) AND (projectX OR clientY)`.
- Apply timeframe filters:
- Relative: `newer_than:60d`, `older_than:1y` as needed.
- Absolute: `after:2025/07/01 before:2025/10/01`.
- Layer participant filters: `from:[email protected]`, `to:[email protected]`, `cc:[email protected]`.
- Respect exclusions: `-label:Promotions`, `-from:noreply`, `-subject:"unsubscribe"`.
- Request sorting by most recent when calling the search API to align highlights chronologically.
## Execution Steps
1. **Clarify request:** Confirm topic spelling, timeframe, exclusions, participants, and desired output format.
2. **Plan the query:** Draft search strings that combine topic keywords, timeframe filters, and exclusions. Document the final query in the response for transparency.
3. **Run search:** Invoke `search_gmail_messages` with the constructed query and retrieve sufficient results (default 50; ask if more are needed). Capture thread IDs and snippet metadata.
4. **Expand threads:** For each unique thread ID, call `read_gmail_thread` to gather:
- Subject line, snippet, and first/last message timestamps.
- Participants (from/to/cc) and message count.
- Message IDs for deep links.
5. **De-duplicate and score:**
- Merge duplicate hits across the same thread.
- Prioritize emails where the topic appears in the subject or most recent message body.
- Flag decision points (approvals, blockers, action items) and high-signal correspondents.
6. **Summarize results:**
- Produce a topic overview summarizing scope, volume, and key correspondents.
- Highlight the top three messages/threads with succinct ≤40-word summaries and why they matter.
7. **Assemble final output:**
- Sort threads chronologically (newest first) or by relevance if the user prefers. Note the ordering choice explicitly.
- Build the structured table and any requested export-friendly sections.
8. **Address edge cases:** Note if the query returned partial results, no matches, or exceeded limits; suggest refinements or follow-up actions.
## Output Format
Respond with a professional, scannable brief:
```markdown
# 📂 TOPIC EMAIL DIGEST — {Topic}
**Query:** `{documented Gmail query}` | **Timeframe:** {Window used} | **Threads reviewed:** {count}
## Snapshot
- **Top correspondents:** [Name/Email], [Name/Email], ...
- **Total messages:** {number of messages across all threads}
- **Coverage period:** {Oldest message date → Newest message date}
- **Data filters applied:** [Timeframe], [Exclusions], [Participants]
## Spotlight Threads
1. **[Subject]** — [Sender → Recipients] ([Date, Timezone])
*Why it matters:* [≤40-word summary with decision, deliverable, or blocker].
**Link:** [📧 Open Thread]
2. ...
3. ...
## Full Topic Log
| # | Date (Timezone) | Subject | Participants | Relevance Notes | Link |
|---|-----------------|---------|--------------|-----------------|------|
| 1 | 2025-09-12 09:14 (PST) | [Exact subject] | [Key correspondents] | [≤30-word summary or status] | [📧 Open Thread] |
| ... | ... | ... | ... | ... | ... |
## Suggested Next Steps
- [Action or follow-up derived from emails]
- [Reminders about pending approvals or unanswered questions]
## Optional Export Guidance
To create a CSV, copy the **Full Topic Log** table into Sheets or Excel. Columns: `date`, `subject`, `from_to`, `summary`, `gmail_link`. No automatic file attachment is generated.
## If No Matches
"No Gmail threads matched `{topic}` within {window}. Try broader keywords, extend the timeframe, or remove exclusions."
```
## Handling Special Cases
- **High-volume topics:** If results exceed practical limits (e.g., >100 threads), summarize the top segment and state how many additional threads exist. Offer to refine by subtopic or participant.
- **Partially matching threads:** Note when the topic appears only in older messages and explain relevance.
- **Confidential content:** Mask or paraphrase sensitive figures while preserving intent. Respect any corporate confidentiality tags.
- **Integration failures:** Provide clear error messaging, suggest re-authentication, and do not fabricate data.
## Guard Rails
- Never invent messages, timestamps, or participants—only report Gmail tool outputs.
- Maintain read-only behavior; do not modify labels, archive items, or mark as read.
- Localize timestamps to the confirmed timezone and include the offset.
- Cite Gmail deep links with the correct message or thread IDs.
- If the topic is ambiguous, ask for clarification before running broad queries.
## Related Skills
- `recent-emails` — for general activity across folders without topical filtering.
- `starred-email` — for priority follow-ups regardless of subject.
- `actioned-emails` — to combine recent sent and starred items.
This skill retrieves Gmail threads that match a requested topic and delivers a prioritized digest with concise summaries, key correspondents, and direct deep links for follow-up. It supports optional timeframe, label, and participant filters and formats results for quick briefing or action. The output is designed for fast stakeholder handoffs and immediate follow-up.
The skill builds precise Gmail search queries from the confirmed topic, timeframe, exclusions, and participant filters, then calls search_gmail_messages to gather matching threads. It expands each thread with read_gmail_thread to extract subjects, timestamps, participants, and message IDs, de-duplicates results, scores relevance, and flags decisions or action items. Finally, it produces a scannable digest that includes a snapshot, spotlight threads, a full log for export, and suggested next steps.
What inputs do you need before running the search?
Confirm the topic phrase, desired timeframe, any labels or participants to exclude, and preferred output format (digest only or digest plus CSV-ready table). Also confirm timezone for timestamp localization.
How do you handle high-volume results?
If results exceed practical limits, I summarize the top segment (by recency or relevance), report total counts, and offer refinements by subtopic, participant, or narrower date ranges.