home / skills / krishagel / geoffrey / google-workspace

google-workspace skill

/skills/google-workspace

This skill unifies Google Workspace across three accounts to manage email, calendar, files, and chat efficiently.

npx playbooks add skill krishagel/geoffrey --skill google-workspace

Review the files below or copy the command above to add this skill to your agents.

Files (36)
SKILL.md
4.9 KB
---
name: google-workspace
description: Unified Google Workspace integration for managing email, calendar, files, and communication across multiple accounts
triggers:
  # Gmail
  - "check email"
  - "read email"
  - "send email"
  - "search email"
  - "list emails"
  - "unread emails"
  - "inbox"
  # Calendar
  - "check calendar"
  - "schedule meeting"
  - "create event"
  - "what's on my calendar"
  - "free time"
  - "upcoming meetings"
  # Drive
  - "find file"
  - "search drive"
  - "list documents"
  - "open document"
  - "create document"
  # Docs/Sheets/Slides
  - "create doc"
  - "create spreadsheet"
  - "create presentation"
  - "edit document"
  # Tasks
  - "google tasks"
  - "task list"
  # Chat
  - "send chat"
  - "check chat"
allowed-tools: Read, Bash
version: 0.1.0
---

# Google Workspace Skill

## Overview

Unified Google Workspace integration for managing email, calendar, files, and communication across three accounts:

| Alias | Purpose | Email |
|-------|---------|-------|
| `psd` | Work | PSD district email |
| `kh` | Personal | Personal Gmail |
| `hrg` | Business | Consulting & real estate |

## Account Selection

### Explicit
- "check my **psd** email"
- "send email from **hrg**"
- "**kh** calendar for tomorrow"

### Inferred
Geoffrey will infer the appropriate account from context:
- Work-related → `psd`
- Personal matters → `kh`
- Business/real estate → `hrg`

## Available Operations

### Gmail

| Script | Description | Example |
|--------|-------------|---------|
| `list_messages.js` | List inbox, unread, by label | "show unread psd emails" |
| `read_message.js` | Get full message content | "read that email" |
| `send_message.js` | Compose and send | "send email to John about..." |
| `send_with_attachment.js` | Send with file attachment | "email report with PDF attached" |
| `search_messages.js` | Search with Gmail operators | "find emails from Sarah last week" |
| `get_unread_summary.js` | Unread count + top messages | "how many unread emails?" |

### Calendar

| Script | Description | Example |
|--------|-------------|---------|
| `list_events.js` | Get upcoming events | "what's on my calendar today" |
| `create_event.js` | Schedule new events | "schedule meeting tomorrow at 2pm" |
| `update_event.js` | Modify existing events | "move that meeting to 3pm" |
| `search_events.js` | Find by criteria | "find meetings with Mike" |

### Drive

| Script | Description | Example |
|--------|-------------|---------|
| `list_files.js` | Browse/search files | "find budget spreadsheet" |
| `read_file.js` | Get file content | "show me that document" |
| `create_file.js` | Create new docs/sheets | "create a new spreadsheet" |
| `upload_file.js` | Upload local file | "upload this to drive" |

### Tasks

| Script | Description | Example |
|--------|-------------|---------|
| `list_tasks.js` | Get task lists | "show my google tasks" |
| `create_task.js` | Add new task | "add task to google tasks" |
| `complete_task.js` | Mark done | "complete that task" |

### Chat

| Script | Description | Example |
|--------|-------------|---------|
| `list_spaces.js` | Get available spaces | "list chat spaces" |
| `send_message.js` | Post to space | "send message to team chat" |
| `read_messages.js` | Get chat history | "show recent chat messages" |

## Usage Patterns

### Running Scripts

All scripts use the token_manager for authentication:

```javascript
const { getAuthClient } = require('./auth/token_manager');

async function main() {
  const account = process.argv[2] || 'psd';
  const auth = await getAuthClient(account);

  // Use auth with Google API
  const gmail = google.gmail({ version: 'v1', auth });
  // ...
}
```

### Output Format

All scripts return JSON:

```json
{
  "success": true,
  "account": "psd",
  "data": { ... },
  "metadata": {
    "timestamp": "2024-01-15T10:30:00Z",
    "count": 5
  }
}
```

### Error Handling

```json
{
  "error": "Token expired",
  "account": "psd",
  "action": "Run: node token_manager.js refresh psd"
}
```

## Setup Required

Before using this skill:

1. Complete Google Cloud Console setup (see `auth/GOOGLE_CLOUD_SETUP.md`)
2. Add credentials to `~/Library/Mobile Documents/com~apple~CloudDocs/Geoffrey/secrets/.env`
3. Authenticate all three accounts
4. For PSD account: allowlist OAuth app in Google Admin

## Cross-Account Operations

Some operations work across accounts:
- "Forward this to my personal email"
- "Copy this file to my work drive"
- "Add to both calendars"

## Gmail Search Operators

Support standard Gmail search:
- `from:` - sender
- `to:` - recipient
- `subject:` - subject line
- `has:attachment` - with attachments
- `after:` / `before:` - date range
- `is:unread` - unread only
- `label:` - by label

Example: "search psd email for `from:[email protected] after:2024-01-01 has:attachment`"

## Notes

- Access tokens expire after 1 hour (auto-refreshed)
- Refresh tokens don't expire unless revoked
- All API calls are rate-limited by Google
- Keep API has limited availability (may not be enabled)

Overview

This skill provides a unified Google Workspace integration for managing email, calendar, Drive files, tasks, and chat across three accounts (work, personal, and business). It streamlines cross-account actions like forwarding messages, copying files, and syncing events. The integration exposes a set of scripts that return structured JSON and use a shared token manager for authentication. It’s built to support common Gmail search operators, calendar scheduling, Drive browsing, and simple chat posting workflows.

How this skill works

Each operation runs as a script that authenticates via a token manager tied to an account alias (psd, kh, hrg). Scripts call the relevant Google APIs (Gmail, Calendar, Drive, Tasks, Chat) and return JSON with success, data, and metadata fields. Account selection can be explicit or inferred from context; cross-account actions are supported by invoking the appropriate auth client for each target account. Errors include actionable guidance (for example, token refresh steps).

When to use it

  • Manage multiple Workspace accounts without switching browser profiles
  • Summarize unread mail or search messages with Gmail operators
  • Schedule, update, or query calendar events across accounts
  • Browse, read, create, and transfer Drive files between accounts
  • Post or read chat messages and manage Google Tasks programmatically

Best practices

  • Specify the account alias (psd, kh, hrg) for deterministic behavior when needed
  • Use Gmail search operators to narrow results and avoid large paged queries
  • Handle rate limits by retrying with exponential backoff on 429/5xx responses
  • Keep OAuth refresh tokens secure and follow your organization’s allowlist requirements for the PSD account
  • Store credentials in a secure secrets path and authenticate all accounts before bulk operations

Example use cases

  • "Show unread psd emails" and get a top-message summary with counts
  • "Schedule meeting tomorrow at 2pm" on the hrg calendar and receive the event JSON
  • "Find budget spreadsheet" across Drive and open the file content for review
  • "Send email from hrg with PDF attached" using the send_with_attachment flow
  • "Forward this to my personal email" by copying a message from psd to kh and sending a forward

FAQ

How are accounts selected if I don’t specify an alias?

The skill infers account contextually (work→psd, personal→kh, business/real-estate→hrg), but you can always pass an explicit alias to avoid ambiguity.

What happens when a token expires?

Tokens auto-refresh; if refresh fails you’ll receive an error JSON with a recommended command to refresh the account token.