AI/ML

recipe-label-and-archive-emails

googleworkspace/cli · updated Apr 8, 2026

$npx skills add https://github.com/googleworkspace/cli --skill recipe-label-and-archive-emails
summary

Automatically label and archive Gmail messages matching custom search criteria.

  • Requires the gws-gmail skill to execute Gmail API operations
  • Three-step workflow: search for matching emails using query syntax, apply custom labels, and remove messages from inbox
  • Supports flexible filtering through Gmail's query language (e.g., sender, subject, date ranges)
  • Designed as a recipe template for building inbox automation workflows
skill.md

1d:["$","div",null,{"className":"prose prose-invert max-w-none prose-headings:font-semibold prose-headings:tracking-tight prose-h1:text-4xl prose-h1:mb-2 prose-h2:text-2xl prose-h2:mb-2 prose-h3:text-lg prose-h3:mb-2 prose-p:text-muted-foreground prose-li:text-muted-foreground prose-code:bg-muted prose-code:text-foreground prose-code:px-1 prose-code:py-0.5 prose-code:rounded-sm prose-code:text-sm prose-code:before:content-none prose-code:after:content-none prose-pre:bg-muted prose-pre:text-foreground prose-pre:border prose-pre:border-border prose-pre:rounded-md [&_table]:!border-[color:var(--border)] [&_th]:!border-[color:var(--border)] [&_td]:!border-[color:var(--border)]","dangerouslySetInnerHTML":{"__html":"<h1>Label and Archive Gmail Threads</h1>\n<blockquote>\n<p><strong>PREREQUISITE:</strong> Load the following skills to execute this recipe: <code>gws-gmail</code></p>\n</blockquote>\n<p>Apply Gmail labels to matching messages and archive them to keep your inbox clean.</p>\n<h2>Steps</h2>\n<ol>\n<li>Search for matching emails: <code>gws gmail users messages list --params '{"userId": "me", "q": "from:notifications@service.com"}' --format table</code></li>\n<li>Apply a label: <code>gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"addLabelIds": ["LABEL_ID"]}'</code></li>\n<li>Archive (remove from inbox): <code>gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"removeLabelIds": ["INBOX"]}'</code></li>\n</ol>"}}]