
This is a Gmail automation recipe that searches for emails matching your criteria, slaps a label on them, and archives them in one go. You'd use this to automatically organize recurring emails like notifications, newsletters, or automated reports without manually sorting through your inbox. It's essentially a poor man's Gmail filter built with command-line tools. The three-step process is straightforward: search with a Gmail query, apply your chosen label, then remove the INBOX label to archive. Works well for bulk cleanup operations or when you need more complex matching logic than Gmail's built-in filters provide.
$ npx -y skills add googleworkspace/cli --skill recipe-label-and-archive-emails --agent claude-codeInstalls into .claude/skills of the current project.
PREREQUISITE: Load the following skills to execute this recipe:
gws-gmail
Apply Gmail labels to matching messages and archive them to keep your inbox clean.
gws gmail users messages list --params '{"userId": "me", "q": "from:notifications@service.com"}' --format tablegws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"addLabelIds": ["LABEL_ID"]}'gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"removeLabelIds": ["INBOX"]}'Sponsors