IMAP
Read, search, and sync IMAP mailboxes with UID-safe fetches, precise filters, and attachment-aware workflows.
by clawic★ 23 GitHub stars
Install IMAP in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
When to Use
Use this skill when the user needs to inspect or operate an IMAP mailbox across Gmail, Fastmail, ProtonMail Bridge, Exchange-compatible gateways, or self-hosted mail servers.
Activate it for inbox search, unread triage, header and body fetches, attachment handling, folder mapping, or incremental mailbox sync when correctness matters more than quick ad hoc scraping.
Architecture
Memory lives in ~/Clawic/data/imap/. If ~/Clawic/data/imap/ does not exist, run setup.md. See memory-template.md for the default structure and file templates.
~/Clawic/data/imap/
├── memory.md # activation defaults, mutation policy, preferred reporting style
├── accounts.md # mailbox-specific endpoints, auth notes, and server capabilities
├── folder-map.md # canonical folder mapping and provider quirks
├── sync-state.md # UIDVALIDITY, last UID, MODSEQ, and sync checkpoints
└── playbooks.md # saved mailbox workflows and reusable search recipes
Quick Reference
Use these files when the current mailbox task needs more detail than the core rules provide.
| Topic | File |
|---|---|
| Setup and activation defaults | setup.md |
| Memory and file templates | memory-template.md |
| Session planning and discovery | session-strategy.md |
| Search and fetch patterns | search-and-fetch.md |
| State, flags, and sync rules | state-and-flags.md |
| Attachment and MIME handling | attachments.md |
| Failure diagnosis and provider quirks | troubleshooting.md |
Core Rules
1. Discover mailbox capabilities before making assumptions
- Identify server capabilities, namespace layout, delimiter behavior, and special-use folders before building commands or interpreting results.
- Check whether the server supports features such as
UIDPLUS,CONDSTORE,QRESYNC,MOVE, orXLISTreplacements. - Folder names, archives, and flag behavior vary by provider, so do not hard-code Gmail semantics onto every mailbox.
2. Default to read-safe operations unless the user clearly wants mutation
- Start with safe inspection patterns such as capability discovery, folder listing,
EXAMINE, header fetches, and targeted body retrieval. - Treat delete, move, copy, expunge, and bulk flag updates as mutating actions that require either explicit user approval or a previously confirmed standing policy.
- If the user only asked to inspect or summarize mail, do not silently mark messages seen or alter mailbox state.
3. Use UIDs and durable sync markers, not volatile sequence numbers
- Sequence numbers shift as mail arrives or is removed, so they are unsafe for persistent tracking.
- For repeatable workflows, store
UIDVALIDITY, last processed UID, and when availableHIGHESTMODSEQor related sync checkpoints in~/Clawic/data/imap/sync-state.md. - If
UIDVALIDITYchanges, treat prior cursors as invalid and rescan instead of trusting stale state.
4. Fetch the minimum data that answers the question
- Start with folder listing, counts, flags, and envelope or header data before downloading full bodies or attachments.
- Escalate to body sections, MIME structure, or attachments only when the user actually needs that detail.
- Smaller fetches reduce latency, bandwidth, and the chance of dragging sensitive content into unnecessary downstream processing.
5. Search with explicit server-side filters and report what they mean
- Prefer precise IMAP search constraints such as date ranges, sender, subject fragments, flags, size limits, or UID windows over broad mailbox scans.
- Be clear about whether the server search is header-only, text-oriented, charset-sensitive, or provider-specific in its matching behavior.
- When search semantics are ambiguous, explain the limitation and offer a narrower or confirmatory pass.
6. Treat MIME and attachments as structured data, not opaque blobs
- Read
BODYSTRUCTUREor equivalent metadata before assuming where text lives or which parts are attachments. - Distinguish inline parts from downloadable attachments, decode filenames safely, and preserve charset and transfer-encoding details.
- Avoid downloading large attachments unless needed, and report part identifiers, sizes, and media types first when triaging.
7. Keep credentials out of skill memory and scope network use tightly
- Store only non-secret connection notes, capabilities, and workflow preferences under
~/Clawic/data/imap/. - Never ask the user to paste account passwords into memory files; use existing local auth flows, app passwords, OAuth-backed bridges, or other secure runtime mechanisms the environment already supports.
- Restrict network activity to the user-configured IMAP endpoint needed for the mailbox task at hand.
IMAP Traps
- Treating message sequence numbers as stable identifiers -> follow-up fetches hit the wrong message after mailbox changes.
- Marking mail seen during a read-only review -> the user loses unread state without asking for it.
- Downloading
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- _meta.json
- attachments.md
- memory-template.md
- search-and-fetch.md
- session-strategy.md
- setup.md
- state-and-flags.md
- troubleshooting.md
FAQ
What does the IMAP skill do?
Read, search, and sync IMAP mailboxes with UID-safe fetches, precise filters, and attachment-aware workflows.
How do I install the IMAP skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the IMAP skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
agent-skill-stack
GitHubFind, evaluate, and assemble the smallest compatible set of AI Agent Skills for an end-to-end natural-language goal. Use when a user wants Skills for a…
build-evidence-map
GitHubBuild an auditable evidence map for a contested technical choice, research synthesis, proposal review, or consequential decision. Use when Copilot must…
pinecone-rag
GitHubBuild production RAG pipelines and persistent agent memory using Pinecone as the vector database backend. ALWAYS USE THIS SKILL when the user mentions…
qdrant-monitoring-debugging
GitHubDiagnoses Qdrant production issues using metrics and observability tools. Use when someone reports 'optimizer stuck', 'indexing too slow', 'memory too high'…