skills/gogcli/SKILL.md
Google Workspace CLI for Gmail, Calendar, Drive, Contacts, Sheets, Docs, Tasks, Chat, People, and Classroom via the `gog` command
npx skillsauth add avifenesh/cairn gogcliInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill is for Google Workspace services ONLY: Gmail, Calendar, Drive, Contacts, Sheets, Docs, Tasks, Chat, People, and Classroom.
Never use this skill for GitHub or git operations.
cairn.shell with the gh CLI.cairn.shell or cairn.gitRun.gh pr view, gh pr create, git status, git log, or any git/GitHub command to gog.cairn.googleQuery or cairn.googleExecute for GitHub — they are Google Workspace tools only.Misrouting git/GitHub commands to gog causes 100+ errors per period. Use the right tool.
Use gog (installed at /usr/local/bin/gog) to interact with Google Workspace services via CLI.
Authenticated account is configured via gog auth add.
Follow these steps to install gogcli from scratch and connect it to a Google account.
brew tap petergriffin42/tap
brew install gogcli
Verify installation:
gog --version
# Should output: v0.9.0 or later
which gog
# /usr/local/bin/gog
You need a Google Cloud Platform project to host the OAuth credentials and enable APIs.
Option A: Playwright-Assisted Setup (Recommended) Claude navigates the GCP Console via Playwright MCP while the user clicks/inputs when needed.
https://console.cloud.google.com/Option B: Manual Setup
gogcli needs 11 APIs enabled. The fastest method is Google Cloud Shell batch command.
Cloud Shell Batch Enable (Fastest Method):
https://shell.cloud.google.com/?show=terminalfill() does NOT work in Cloud Shell's xterm terminal. You must use:
page.locator('.xterm-helper-textarea').first().type(command, { delay: 10 })
Then press Enter via: page.keyboard.press('Enter')gcloud services enable \
gmail.googleapis.com \
calendar-json.googleapis.com \
drive.googleapis.com \
people.googleapis.com \
contacts.googleapis.com \
sheets.googleapis.com \
docs.googleapis.com \
tasks.googleapis.com \
chat.googleapis.com \
classroom.googleapis.com \
admin.googleapis.com
Full list of 11 required APIs:
| API | Service Name | |-----|-------------| | Gmail | gmail.googleapis.com | | Calendar | calendar-json.googleapis.com | | Drive | drive.googleapis.com | | People | people.googleapis.com | | Contacts | contacts.googleapis.com | | Sheets | sheets.googleapis.com | | Docs | docs.googleapis.com | | Tasks | tasks.googleapis.com | | Chat | chat.googleapis.com | | Classroom | classroom.googleapis.com | | Admin SDK | admin.googleapis.com |
Alternative: Enable APIs individually via Console UI
Claude navigates to https://console.cloud.google.com/apis/library and searches/enables each API one by one. This is slower but works if Cloud Shell is unavailable.
https://console.cloud.google.com/auth/overviewgogcliSince the app is in "Testing" mode, the Google account must be added as a test user.
https://console.cloud.google.com/auth/audience[email protected])https://console.cloud.google.com/auth/clientsgogcliGetting the credentials JSON:
{
"installed": {
"client_id": "YOUR_CLIENT_ID.apps.googleusercontent.com",
"project_id": "YOUR_PROJECT_ID",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uris": ["http://localhost"]
}
}
Save as: ~/Downloads/client_secret_gogcli.json
To find Client Secret if dialog was closed:
https://console.cloud.google.com/auth/clientsgog auth credentials ~/Downloads/client_secret_gogcli.json
# Output: Credentials stored at ~/.config/gogcli/credentials.json
gog auth add [email protected]
This opens a browser for Google OAuth. The user must:
Verify with:
gog gmail labels list
If labels appear, setup is complete.
When assisting with GCP setup via Playwright MCP:
General approach:
browser_navigatebrowser_snapshot to verify the page loaded correctlybrowser_click/browser_typeKnown Playwright quirks with GCP Console:
.xterm-helper-textarea locator with .type() and { delay: 10 } — standard fill() won't workHelpful GCP Console URLs:
| Page | URL |
|------|-----|
| Project selector | https://console.cloud.google.com/projectselector2/home/dashboard |
| APIs Library | https://console.cloud.google.com/apis/library |
| APIs Dashboard | https://console.cloud.google.com/apis/dashboard |
| OAuth Consent | https://console.cloud.google.com/auth/overview |
| OAuth Audience | https://console.cloud.google.com/auth/audience |
| OAuth Clients | https://console.cloud.google.com/auth/clients |
| Cloud Shell | https://shell.cloud.google.com/?show=terminal |
| IAM & Admin | https://console.cloud.google.com/iam-admin |
--json for JSON output (best for scripting/parsing)--plain for stable TSV output--force to skip confirmations on destructive commands--no-input never prompt, fail insteadIMPORTANT: Gmail search filters (from:, to:, subject:, is:, has:, newer_than:, older_than:, in:, label:) are NOT CLI flags. They go INSIDE the quoted query string. Never use --from: or --subject: as flags.
# Correct: filters inside quoted query string
gog gmail search "is:unread"
gog gmail search "from:boss subject:urgent" --max=5
gog gmail search "from:ceo newer_than:7d" --max=10
gog gmail search "subject:budget from:finance" --max=5
gog gmail search "in:trash from:noreply"
# WRONG — these will fail:
# gog gmail search --from:boss ← WRONG: --from: is not a flag
# gog gmail search --subject:budget ← WRONG: --subject: is not a flag
# gog gmail search --newer_than:7d ← WRONG: put inside quotes
gog gmail get <messageId> # Get full message
gog gmail get <messageId> --format=raw # Raw message
gog gmail send --to="[email protected]" --subject="Hello" --body="Message"
gog gmail send --to="[email protected]" --cc="[email protected]" --subject="Hi" --body="Body" --attach=file.pdf
gog gmail labels list # List labels
gog gmail labels create "MyLabel" # Create label
gog gmail thread get <threadId> # Get thread
gog gmail thread modify <threadId> --add-labels=INBOX --remove-labels=UNREAD
gog gmail drafts list # List drafts
gog gmail drafts create --to="[email protected]" --subject="Draft" --body="Content"
gog gmail messages list --label=INBOX --max=10
gog gmail batch archive --query="older_than:30d label:promotions"
gog calendar events # List events from all calendars
gog calendar events primary # Events from primary calendar
gog calendar events --from="2024-01-01" --to="2024-01-31"
gog calendar create primary --summary="Meeting" --from="2024-01-15T10:00:00-05:00" --to="2024-01-15T11:00:00-05:00"
gog calendar create primary --summary="All Day" --from="2024-01-15" --to="2024-01-16" --all-day
gog calendar update primary <eventId> --summary="Updated Meeting"
gog calendar delete primary <eventId>
gog calendar search "team meeting" # Search events
gog calendar calendars # List calendars
gog calendar freebusy primary --from="2024-01-15" --to="2024-01-16"
gog calendar conflicts # Find scheduling conflicts
gog calendar respond primary <eventId> --status=accepted
gog calendar focus-time --from="2024-01-15T14:00:00" --to="2024-01-15T16:00:00"
gog calendar out-of-office --from="2024-01-20" --to="2024-01-22"
Calendar create important notes:
--from and --to (NOT --start/--end)2024-01-15T10:00:00-05:00--all-day flag: --from="2024-01-15" --to="2024-01-16"--description, --location, --attendees, --event-color (1-11), --with-meetgog drive ls # List files in root
gog drive ls --folder=<folderId> # List files in folder
gog drive search "quarterly report" # Full-text search
gog drive get <fileId> # File metadata
gog drive download <fileId> # Download file
gog drive download <fileId> --format=pdf # Export Google Doc as PDF
gog drive upload ./local-file.pdf # Upload file
gog drive upload ./file.pdf --folder=<folderId>
gog drive mkdir "New Folder" # Create folder
gog drive mkdir "Subfolder" --parent=<folderId>
gog drive delete <fileId> # Move to trash
gog drive move <fileId> --to=<folderId> # Move file
gog drive rename <fileId> "New Name" # Rename
gog drive share <fileId> --email="[email protected]" --role=writer
gog drive permissions <fileId> # List permissions
gog drive url <fileId> # Print web URL
gog drive copy <fileId> "Copy Name" # Copy file
gog drive drives # List shared drives
gog contacts list # List all contacts
gog contacts search "John" # Search by name/email/phone
gog contacts get <resourceName> # Get contact details
gog contacts create --given-name="John" --family-name="Doe" --email="[email protected]"
gog contacts update <resourceName> --phone="+1234567890"
gog contacts delete <resourceName>
gog contacts directory list # Directory contacts
gog contacts other list # Other contacts
gog sheets get <spreadsheetId> "Sheet1!A1:D10" # Read range
gog sheets update <spreadsheetId> "Sheet1!A1" "val1" "val2" "val3" # Write values
gog sheets append <spreadsheetId> "Sheet1!A1" "new1" "new2" # Append row
gog sheets clear <spreadsheetId> "Sheet1!A1:D10" # Clear range
gog sheets metadata <spreadsheetId> # Sheet metadata
gog sheets create "New Spreadsheet" # Create new
gog sheets copy <spreadsheetId> "Copy Title" # Copy sheet
gog sheets export <spreadsheetId> --format=csv # Export
gog sheets format <spreadsheetId> "Sheet1!A1:D1" --bold --bg-color="#4285F4"
gog docs cat <docId> # Print doc as plain text
gog docs info <docId> # Doc metadata
gog docs create "New Document" # Create new doc
gog docs create "Doc Title" --body="Initial content"
gog docs copy <docId> "Copy Title" # Copy doc
gog docs export <docId> --format=pdf # Export as PDF/DOCX/TXT
gog tasks lists list # List task lists
gog tasks list <tasklistId> # List tasks in a list
gog tasks get <tasklistId> <taskId> # Get task details
gog tasks add <tasklistId> --title="Buy groceries" --notes="Milk, eggs"
gog tasks add <tasklistId> --title="Due tomorrow" --due="2024-01-16"
gog tasks update <tasklistId> <taskId> --title="Updated title"
gog tasks done <tasklistId> <taskId> # Mark completed
gog tasks undo <tasklistId> <taskId> # Mark needs action
gog tasks delete <tasklistId> <taskId> # Delete task
gog tasks clear <tasklistId> # Clear completed
gog chat spaces list # List chat spaces
gog chat messages list <spaceName> # List messages in space
gog chat messages send <spaceName> --text="Hello!" # Send message
gog chat dm send <userId> --text="Hi" # Direct message
gog chat threads list <spaceName> # List threads
gog people search "Jane" # Search people
gog people get <resourceName> # Get person details
gog gmail labels requires a subcommand: list, get, create, or modifycreate uses --from/--to, NOT --start/--end2026-02-16T10:00:00-05:00)~/.config/gogcli/gog <service> --help for detailed subcommand help--json for programmatic output parsinggog gmail search "from:X subject:Y" not gog gmail search --from:X| Issue | Fix |
|-------|-----|
| gog: command not found | Run brew install gogcli or check which gog |
| 401 Unauthorized | Re-authenticate: gog auth add [email protected] |
| 403 API not enabled | Enable the missing API in GCP Console or via Cloud Shell |
| 400 Missing time zone | Calendar create needs RFC3339 with timezone offset |
| unexpected argument | Check gog <command> --help — some commands don't take positional email args |
| OAuth "access denied" | Add your email as test user in OAuth Consent Screen > Audience |
data-ai
Detect agent-cairn PRs that have stalled (no activity >=90 min) and classify the failure mode to route to appropriate recovery agent.
tools
Post-install skill adaptation: read a newly installed SKILL.md, fix environment-specific references (paths, accounts, tool names), assign the skill to relevant agent types, and propose an AGENTS.md update. Triggered automatically after cairn.installSkill completes.
data-ai
Monthly self-improvement brief for Cairn. Queries error_patterns, action_exemplars, experiment_windows, and session_journal to synthesize what Cairn learned, where it failed, and 3 concrete proposals for Avi to approve. Run on the 1st of each month. Keywords: growth brief, monthly review, self-improvement, what did cairn learn, how is cairn doing, monthly report
testing
Decision support with memory-backed context. Retrieves past decisions, journal history, and relevant facts before answering questions that involve a choice or tradeoff. Keywords: should I, which is better, tradeoff, compare, decide, choose, option, alternative, pros and cons, recommend