Agent skill

Performance Patterns

by s-morgan-jeffries in s-morgan-jeffries/apple-mail-fast-mcp

A skill your agent uses when optimizing Apple Mail MCP operations, diagnosing slow queries, adding new filtering logic, or modifying how data is fetched from Mail.app.

MITAuto-check passedProductivity & Automation

Install Performance Patterns

skills CLI
$ npx skills add s-morgan-jeffries/apple-mail-fast-mcp --skill performance-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install s-morgan-jeffries/apple-mail-fast-mcp performance-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/s-morgan-jeffries/apple-mail-fast-mcp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/performance-patterns .claude/skills/performance-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
performance-patterns
GitHub stars
104
Token cost
~1.5k tokens
SKILL.md length
698 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when optimizing Apple Mail MCP operations, diagnosing slow queries, adding new filtering logic, or modifying how data is fetched from Mail.app.

  • Optimizing Apple Mail MCP operations
  • SKILL.md covers The Core Insight, Known Operation Timings, Pattern 1: Use whose Clauses… and Pattern 2: Single Script Per…, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Diagnosing slow queries

What it does

Performance Patterns is an agent skill from s-morgan-jeffries/apple-mail-fast-mcp. Use when optimizing Apple Mail MCP operations, diagnosing slow queries, adding new filtering logic, or modifying how data is fetched from Mail.app. Covers osascript overhead, whose clause optimization, batch operation patterns, and known operation timings.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Productivity & Automation, covering Email management, Query optimization and MCP servers. It works with Model Context Protocol, Gmail and Python. The repository describes itself as: 🤖 MCP server for Apple Mail - Manage emails with AI using Claude Desktop. Search, send, organize mail with natural language. The licence is MIT.

When your agent uses it

  • Optimizing Apple Mail MCP operations
  • Diagnosing slow queries
  • Adding new filtering logic
  • Modifying how data is fetched from Mail.app

Example prompts

  • “/performance-patterns”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit ed0cfbc. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are applescript and python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Performance Patterns loads about 1.5k tokens when it runs. Until then it costs about 69 tokens; SKILL.md has 698 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~69
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from s-morgan-jeffries/apple-mail-fast-mcp at commit ed0cfbc, republished under its MIT licence (© s-morgan-jeffries). 698 words, ~1,499 tokens.

Download SKILL.mdSave it as .claude/skills/performance-patterns/SKILL.md (or your agent's skills folder).
name
performance-patterns
description
Use when optimizing Apple Mail MCP operations, diagnosing slow queries, adding new filtering logic, or modifying how data is fetched from Mail.app. Covers osascript overhead, whose clause optimization, batch operation patterns, and known operation timings.

Apple Mail MCP Performance Patterns

The Core Insight

The bottleneck is per-subprocess overhead. Each osascript call costs 100-300ms regardless of what it does. All performance work reduces the number of subprocess calls.

Known Operation Timings

OperationTimeNotes
Single osascript call overhead100-300msMinimum cost per subprocess
search_messages (typical INBOX)~1-5sDepends on mailbox size and filter count
get_message (single)<1sDirect ID lookup
create_draft (with send_now=True)~1-2sIncludes Mail.app compose + send
update_message (bulk read/flag)~1-2sSingle script for N messages via _bulk_repeat_block
update_message (move)~1-3sVaries by account type (Gmail slower)
save_attachments~2-5sDepends on attachment count/size

Pattern 1: Use whose Clauses for Server-Side Filtering

applescript
-- GOOD: Server-side filter (fast, Mail.app evaluates internally)
set msgs to (messages of mbox whose sender contains "user@example.com")

-- BAD: Fetch all then filter in Python (slow, transfers all data)
set msgs to every message of mbox
-- then filter in Python loop

whose clauses let Mail.app filter internally without transferring unmatched messages over IPC. This is 10-50x faster for large mailboxes.

Pattern 2: Single Script Per Batch Operation

python
# GOOD: One osascript call for N messages (near-constant time)
script = """
tell application "Mail"
    repeat with msgId in {id1, id2, id3}
        set read status of (first message whose id is msgId) to true
    end repeat
end tell
"""
self._run_applescript(script)

# BAD: N osascript calls for N messages (linear time)
for msg_id in message_ids:
    self._run_applescript(f'tell application "Mail" ...')

Batch operations should always build a single AppleScript that handles all items.

Pattern 3: Use limit for Pagination

The search_messages tool accepts a limit parameter (default: 50). AppleScript uses items 1 thru N of for server-side limiting. Always pass a reasonable limit — fetching 10,000 messages when the user wants the latest 10 wastes time.

Pattern 4: Accept Optional Account/Mailbox Parameters

Message ID lookup is O(accounts x mailboxes) when searching globally. Always accept optional account and mailbox parameters to narrow the search scope. If the caller knows which account, the search is dramatically faster.

Anti-Patterns

  • Repeated subprocess calls in loops — Build one script, execute once
  • Fetching all properties when only some are needed — Scripts currently fetch a fixed set of fields; when adding a new field, consider whether every caller needs it
  • Not using whose clauses — Manual filtering in Python transfers all data first
  • Default timeout too low for large operations — Increase from 60s for bulk operations on large mailboxes

Gmail Performance Notes

Gmail operations are inherently slower than IMAP because:

  • Move requires copy + delete (two operations instead of one)
  • Label operations don't map cleanly to folder operations
  • Search across Gmail labels may scan differently than IMAP folders

Threading cost scales with folder count (not account size). IMAP SEARCH runs against one selected mailbox at a time — there is no cross-folder search — so get_thread's member collection probes each candidate folder in turn. Gmail exposes every label as an IMAP folder and copies each message into every label it carries, so a thread's members are scattered across many folders. The mitigation is All Mail: enable Gmail Settings → Labels → "All Mail" → Show in IMAP, and _find_all_mail_folder (\All SPECIAL-USE, RFC 6154) collapses the probe to that single mailbox holding one copy of everything. Without it, threading falls back to per-label probing. This is not Gmail-specific in principle: any IMAP account with dozens of folders pays the same per-folder cost — non-Gmail accounts are usually fast only because their mail is concentrated in a handful of folders (INBOX/Sent). See #415 and the get_thread performance callout in docs/reference/TOOLS.md.

Show full SKILL.md (225 more words)Show less

Bound the mailbox set on the AppleScript side too — with the unified mailboxes. The same "don't visit every mailbox" rule applies to AppleScript lookups, and Mail.app gives you ready-made bounds: the application-level inbox, sent mailbox, and drafts mailbox aggregate the corresponding folder across every account, so probing them needs no per-account mailbox iteration and no name matching (which would break on localized names). whose id is N works against them, and account of (mailbox of msg) walks back to the owning account. _resolve_numeric_anchor_fast uses this to replace a repeat with acc in accounts / repeat with mb in mailboxes of acc scan: ~1.3s vs ~3.0s on a 33k-message Gmail account (#419). Keep the full walk as a not-found backstop.

Don't assume IMAP is the fast side. Indexed does not mean instant at scale: on that same account SEARCH HEADER Message-ID over a 33k-message All Mail measured ~17s, so replacing the AppleScript anchor above with an IMAP lookup would have been ~13× slower, not faster. Measure per-phase against a real large account before moving work across the AppleScript/IMAP boundary — and re-measure, because Gmail's server-side latency swings by tens of seconds with throttling.

Profiling

No formal benchmarking infrastructure yet (see issue #31). When added:

  • Use 5 iterations per operation
  • Calculate mean, stdev, CV%
  • Set thresholds at 5x documented baseline
  • Detect cold starts (first run > 2x median of remaining)

© s-morgan-jeffries, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/performance-patterns of s-morgan-jeffries/apple-mail-fast-mcp.

Open the folder on GitHubat commit ed0cfbc

Compare with similar skills

Performance Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Performance Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Performance Patterns this skills-morgan-jeffries/apple-mail-fast-mcp104—~1.5kAutomated safety check: PassMIT
Bootstrap Google Toolsgoogle/adk-recipes10k—~5kAutomated safety check: WarnApache-2.0
ComposioComposioHQ/composio30k1 repos~1.7kAutomated safety check: PassMIT
Managing Google Workspacetaylorwilsdon/google_workspace_mcp3.3k—~2.9kAutomated safety check: PassMIT
Browser MCP Agentantibrow/anti-detect-browser-skills9141 repos~4.2kAutomated safety check: WarnMIT
Retinuejklthinking/retinue112—~279Automated safety check: PassMIT

Similar skills

  • Bootstrap Google Tools

    google/adk-recipes

    Official

    Install/auth CLIs the sandbox lacks - gws (Drive, Gmail, Sheets, Calendar), gcloud, agents-cli, mcp-cli (MCP servers).

    10k GitHub stars~5k tokensUpdated 2 days ago
    Agent WorkflowsAuto-check: warnings
  • Composio

    ComposioHQ/composio

    Route and complete Composio work across Composio For You and Composio Platform.

    30k GitHub starsUsed in 1 repo~1.7k tokens
    Productivity & AutomationAuto-check passed
  • Managing Google Workspace

    taylorwilsdon/google_workspace_mcp

    Manages Google Workspace operations across 12 services (Gmail, Drive, Calendar, Docs, Sheets, Slides, Forms, Tasks, Contacts, Chat, Apps Script, Custom Search).

    3.3k GitHub stars~2.9k tokensUpdated yesterday
    Documents & OfficeAuto-check passed
  • Browser MCP Agent

    antibrow/anti-detect-browser-skills

    Give an AI agent its own real browser over MCP tool calls - launch, navigate, click, fill, screenshot, extract text, run JS - with a kernel-level real-device fingerprint and a persistent profile, so…

    914 GitHub starsUsed in 1 repo~4.2k tokens
    Productivity & AutomationAuto-check: warnings
  • Retinue

    jklthinking/retinue

    Coordinate work through a local Retinue workspace using its MCP tools.

    112 GitHub stars~279 tokensUpdated 2 days ago
    Productivity & AutomationAuto-check passed
  • Gmail Query Syntax

    provos/ironcurtain

    Reference for Gmail's search query syntax — operators like is:sent, newerthan:, from:, has:attachment, label:, and how they compose.

    613 GitHub stars~971 tokensUpdated today
    Productivity & AutomationAuto-check passed

More from s-morgan-jeffries/apple-mail-fast-mcp

  • API Design

    s-morgan-jeffries/apple-mail-fast-mcp

    Use BEFORE adding any new tool, parameter, or endpoint to the Apple Mail MCP server.

    104 GitHub stars~876 tokensUpdated 28 days ago
    Auto-check passed
  • Applescript Mail

    s-morgan-jeffries/apple-mail-fast-mcp

    A skill your agent uses when writing, modifying, or debugging ANY AppleScript that interacts with Apple Mail.

    104 GitHub stars~2.5k tokensUpdated 28 days ago
    Auto-check passed
  • Integration Testing

    s-morgan-jeffries/apple-mail-fast-mcp

    A skill your agent uses when setting up, running, or debugging integration tests against real Apple Mail.

    104 GitHub stars~1.2k tokensUpdated 28 days ago
    Auto-check passed
  • Release

    s-morgan-jeffries/apple-mail-fast-mcp

    A skill your agent uses when the user wants to release a new version.

    104 GitHub stars~1.3k tokensUpdated 28 days ago
    Auto-check passed

Questions about Performance Patterns

What does Performance Patterns do?

A skill your agent uses when optimizing Apple Mail MCP operations, diagnosing slow queries, adding new filtering logic, or modifying how data is fetched from Mail.app. Performance Patterns is an agent skill from s-morgan-jeffries/apple-mail-fast-mcp.app.

When should I use Performance Patterns?

Performance Patterns fits situations like: optimizing Apple Mail MCP operations; diagnosing slow queries; adding new filtering logic; modifying how data is fetched from Mail.app.

How do I install Performance Patterns in Claude Code?

Run `npx skills add s-morgan-jeffries/apple-mail-fast-mcp --skill performance-patterns -a claude-code`. Or copy the skill folder (.claude/skills/performance-patterns in s-morgan-jeffries/apple-mail-fast-mcp) into .claude/skills/performance-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Performance Patterns in Codex?

Run `npx skills add s-morgan-jeffries/apple-mail-fast-mcp --skill performance-patterns -a codex`. Or copy the skill folder (.claude/skills/performance-patterns in s-morgan-jeffries/apple-mail-fast-mcp) into .agents/skills/performance-patterns in your project. Codex loads it when a task matches its description.

Can I use Performance Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add s-morgan-jeffries/apple-mail-fast-mcp --skill performance-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/performance-patterns, .gemini/skills/performance-patterns, .github/skills/performance-patterns and .opencode/skills/performance-patterns in your project.

What does Performance Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Performance Patterns is instructions for the agent only. Our summary lists: Python 3.

Does Performance Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Performance Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Performance Patterns use?

Performance Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Performance Patterns use?

About 1.5k tokens (SKILL.md is roughly 6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Performance Patterns?

Skills that share tags, products or a category with Performance Patterns: Bootstrap Google Tools (google/adk-recipes, 10k stars), Composio (ComposioHQ/composio, 30k stars), Managing Google Workspace (taylorwilsdon/google_workspace_mcp, 3.3k stars) and Browser MCP Agent (antibrow/anti-detect-browser-skills, 914 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Performance Patterns?

s-morgan-jeffries (a GitHub user) maintains it in s-morgan-jeffries/apple-mail-fast-mcp, which has 104 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on September 9, 2026.

Source: s-morgan-jeffries/apple-mail-fast-mcp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.