
Create Gmail Filter
Set up Gmail filters that automatically label, star, or sort incoming email via the gws CLI.
- Repository
- googleworkspace/cli
- Stars
- 32,059
- Licence
- Apache-2.0
- Files
- 1 file
What it does
Once installed, the agent can set up rules in your Gmail account that automatically apply labels, star, or move incoming messages out of the inbox based on criteria such as sender. It walks through the steps: listing your existing labels, creating a new label if needed, creating the filter, and then listing filters to confirm it was saved. It works by issuing commands through the gws command-line tool, which must be installed and connected to your Google account.
Great for
- People who want recurring emails such as receipts or newsletters sorted automatically
- Users who already use the gws command-line tool and want an agent to manage Gmail settings
- Anyone who wants to check and verify existing Gmail filters without clicking through settings menus
Skip it if
- Users who do not have the gws tool installed or authorised, since the skill cannot work without it
- Situations needing filters on criteria beyond the example (the file shows only a sender match), as the skill gives limited guidance on other options; changes to live account settings are hard to undo casually and should be reviewed first
Try asking
- “Create a filter that labels all emails from receipts@example.com as Receipts and removes them from the inbox”
- “Show me my existing Gmail labels and filters in a table”
- “Set up a rule to star all messages from my manager”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 1 original files, the Apache-2.0 licence and an attribution note.
recipe-create-gmail-filter.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip recipe-create-gmail-filter.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip recipe-create-gmail-filter.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Review the filter criteria and actions before the agent creates it, because it changes live Gmail settings and removing the INBOX label hides mail from your inbox.
- Ask the agent to run the list command afterwards to confirm the filter was saved correctly.
- Make sure the gws tool and gws-gmail skill are installed first, or the recipe will fail.
What's inside
- SKILL.md
Redistributed unmodified from googleworkspace/cli under the Apache-2.0 licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.