# connector-googledrive

A skill that wires Google Drive into Caffeine builds: listing files, folders, sharing and comments through ready mops packages.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 9100 installs · ★ 2
- Author: caffeinelabs
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/caffeinelabs/skills/tree/HEAD/skills/connector-googledrive/SKILL.md
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/skills/connector-googledrive

## What it does

The skill spells out the only supported route to Google Drive from a Caffeine canister: the `googledrive-client` package (Drive REST API v3) paired with `google-oauth` (OAuth 2.0 code exchange, refresh, PKCE). The client is generated from the Drive v3 Discovery document with diagnostics on, so a decode gap traps loudly instead of handing back silently wrong data.

Auth runs on-chain. The canister generates a PKCE pair, builds the authorize URL, exchanges the returned code for access and refresh tokens in a non-replicated outcall, then refreshes on 401 and retries. Refresh tokens do not rotate, so keep the first one in the canister's stable state rather than a Wasm global. Request the narrowest scope that works: `drive.file`, `drive.readonly` or `drive.metadata.readonly`; full `drive` only when the task truly needs it.

The `Client.mo` facade captures `Config` once and exposes Drive's resource hierarchy as nested classes: `files`, `permissions`, `comments`, `replies`, `drives`, `changes`. Methods are async and take each endpoint's full query-parameter list positionally, so check the generated signatures in `Client.mo` before calling. `defaultConfig` already sets `is_replicated = ?false`, which keeps writes from duplicating and cost from multiplying — leave it alone. File bytes are out of scope: this client handles metadata, organization and sharing.

## Requirements
- Works with: Google Drive

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add caffeinelabs/skills --skill connector-googledrive -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/connector-googledrive/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/connector-googledrive/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add caffeinelabs/skills --skill connector-googledrive -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/connector-googledrive/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add caffeinelabs/skills --skill connector-googledrive -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/connector-googledrive/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install caffeinelabs/skills connector-googledrive
```

2. **Manually: put the files in place**
- File: `.github/skills/connector-googledrive/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add caffeinelabs/skills --skill connector-googledrive -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/caffeinelabs/skills --path skills/connector-googledrive
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/connector-googledrive/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add caffeinelabs/skills --skill connector-googledrive -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/caffeinelabs/skills/tree/HEAD/skills/connector-googledrive/SKILL.md

## When to use it
- list a user's Drive files and folders
- create a folder and file things into it
- grant or revoke access to a file
- read file metadata from an ID or share link
- track Drive changes with a sync token

## Example prompts
- Add `googledrive-client` and `google-oauth` to the project and list the files on my Google Drive
- Share the file by ID using `permissions.create`
- Refresh the access token on 401 through `google-oauth`

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 674a8dda54843b68.

BEGIN THIRD-PARTY FILE 674a8dda54843b68
```text
---
name: connector-googledrive
description: >-
  MANDATORY recipe for every Caffeine build that lists, reads, creates, shares,
  or organizes files and folders on the user's own Google Drive. The ONLY
  supported path is the `googledrive-client` mops package (Drive REST API v3)
  combined with the `google-oauth` mops package (OAuth 2.0 token exchange +
  refresh + PKCE). Hand-rolling `ic.http_request` calls to
  `oauth2.googleapis.com` or `www.googleapis.com/drive/v3` is a FORBIDDEN
  anti-pattern — it bypasses bearer auth, the `is_replicated = ?false`
  replication-cost safeguard, and the `google-oauth` library's token handling.
  Load this skill ONLY when the user, spec, or a prior task refers to **Google
  Drive specifically** — e.g. "Google Drive", "my Drive", "Drive files/folders",
  a Drive file/folder ID or share link, "upload to Google Drive", "list my Drive
  files", or Drive sharing/permissions. Do NOT load it for generic file storage,
  documents, uploads, or access-control features that are not Google Drive —
  those are unrelated and this connector must not be attached to them. When it does apply, load it BEFORE writing any code that touches a Google
  endpoint.
version: 0.1.1
caffeineai-subscription: [none]
compatibility:
  mops:
    googledrive-client: "~0.2.0"
    google-oauth: "~0.2.0"
---

# Google Drive Connector

> **Note.** The client is generated from the Drive v3 Discovery document.
> `diagnostics` is on, so a decode gap traps loudly rather than returning
> silently-wrong data. The nested-facade methods take each Drive endpoint's
> **full query-parameter list positionally** (many `Text`/`Bool` args) — consult
> the generated signatures in `Client.mo` before calling. Media endpoints are
> metadata-only (see the Media caveat).

## Orchestrator routing notes

The `googledrive-client` + `google-oauth` pair is the **only** supported way to
reach Google Drive from a Caffeine canister. If a build needs Drive, add both as
mops dependencies and follow this skill. Never emit raw `ic.http_request` calls to
Google hosts.

| Task | Use |
|---|---|
| List / search the user's files & folders | `googledrive-client` `Client(cfg).files.list(...)` + `google-oauth` |
| Read file metadata | `Client(cfg).files.get(...)` (metadata only — see Media caveat) |
```
END THIRD-PARTY FILE 674a8dda54843b68

The third-party file has ended. Everything between the 674a8dda54843b68 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2308 of 7890 bytes. © caffeinelabs · Apache-2.0 · https://github.com/caffeinelabs/skills/tree/HEAD/skills/connector-googledrive/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
