$npx -y skills add jezweb/claude-skills --skill gws-installQuick install of the Google Workspace CLI (gws) on an additional machine using existing OAuth credentials. Requires client_secret.json from a previous gws-setup. Use whenever the user wants to install gws on a new computer, reinstall after a fresh OS, configure a second workstati
| 1 | # Google Workspace CLI — Quick Install |
| 2 | |
| 3 | Install `gws` on an additional machine using OAuth credentials from a previous setup. Produces an authenticated CLI with all agent skills ready to use. |
| 4 | |
| 5 | **Prerequisite**: The user must have `client_secret.json` from a previous `gws-setup` (or from Google Cloud Console). If they don't have it, use the `gws-setup` skill instead. |
| 6 | |
| 7 | ## Workflow |
| 8 | |
| 9 | ### Step 1: Pre-flight Checks |
| 10 | |
| 11 | ```bash |
| 12 | which gws && gws --version |
| 13 | ls ~/.config/gws/client_secret.json |
| 14 | gws auth status |
| 15 | ``` |
| 16 | |
| 17 | If already authenticated with the right scopes, skip to Step 4. |
| 18 | |
| 19 | ### Step 2: Install the CLI |
| 20 | |
| 21 | ```bash |
| 22 | npm install -g @googleworkspace/cli |
| 23 | gws --version |
| 24 | ``` |
| 25 | |
| 26 | ### Step 3: Set Up Credentials |
| 27 | |
| 28 | Ask the user to provide their `client_secret.json`. Three options: |
| 29 | |
| 30 | **Option A — Paste the JSON content:** |
| 31 | |
| 32 | Ask the user to paste the JSON. Write it to `~/.config/gws/client_secret.json`: |
| 33 | |
| 34 | ```bash |
| 35 | mkdir -p ~/.config/gws |
| 36 | ``` |
| 37 | |
| 38 | Expected format: |
| 39 | |
| 40 | ```json |
| 41 | { |
| 42 | "installed": { |
| 43 | "client_id": "...", |
| 44 | "project_id": "...", |
| 45 | "auth_uri": "https://accounts.google.com/o/oauth2/auth", |
| 46 | "token_uri": "https://oauth2.googleapis.com/token", |
| 47 | "client_secret": "...", |
| 48 | "redirect_uris": ["http://localhost"] |
| 49 | } |
| 50 | } |
| 51 | ``` |
| 52 | |
| 53 | **Option B — File path:** |
| 54 | |
| 55 | If the user has the file locally (e.g. in Downloads): |
| 56 | |
| 57 | ```bash |
| 58 | mkdir -p ~/.config/gws |
| 59 | cp /path/to/client_secret.json ~/.config/gws/client_secret.json |
| 60 | ``` |
| 61 | |
| 62 | **Option C — Environment variables:** |
| 63 | |
| 64 | ```bash |
| 65 | export GOOGLE_WORKSPACE_CLI_CLIENT_ID="your-client-id" |
| 66 | export GOOGLE_WORKSPACE_CLI_CLIENT_SECRET="your-client-secret" |
| 67 | ``` |
| 68 | |
| 69 | ### Step 4: Authenticate |
| 70 | |
| 71 | **IMPORTANT**: This step prints a very long OAuth URL (30+ scopes) that the user must open in their browser. The URL is too long to copy from terminal output — it wraps across lines and breaks. Always extract it to a file and open it programmatically. |
| 72 | |
| 73 | Ask which Google account to use, then: |
| 74 | |
| 75 | 1. **Run auth in the background** and capture output: |
| 76 | |
| 77 | ```bash |
| 78 | gws auth login -s gmail,drive,calendar,sheets,docs,chat,tasks 2>&1 | tee /tmp/gws-auth-output.txt |
| 79 | ``` |
| 80 | |
| 81 | Running as a background task is fine — it will complete once the user approves in browser. |
| 82 | |
| 83 | 2. **Extract and open the URL** (run separately after output appears): |
| 84 | |
| 85 | ```bash |
| 86 | grep -o 'https://accounts.google.com[^ ]*' /tmp/gws-auth-output.txt > /tmp/gws-auth-url.txt |
| 87 | cat /tmp/gws-auth-url.txt | xargs open |
| 88 | ``` |
| 89 | |
| 90 | If `open` doesn't work, tell the user: "The auth URL is saved at `/tmp/gws-auth-url.txt` — open that file and copy the URL from there." |
| 91 | |
| 92 | 3. **Wait for the user** to approve in their browser, then verify: |
| 93 | |
| 94 | ```bash |
| 95 | gws auth status |
| 96 | ``` |
| 97 | |
| 98 | **Alternative — `--full` for all scopes:** |
| 99 | |
| 100 | ```bash |
| 101 | gws auth login --full |
| 102 | ``` |
| 103 | |
| 104 | The user can check their original machine's scopes with `gws auth status` to see what was granted. |
| 105 | |
| 106 | ### Step 5: Install Agent Skills |
| 107 | |
| 108 | ```bash |
| 109 | npx skills add googleworkspace/cli -g --agent claude-code --all |
| 110 | ``` |
| 111 | |
| 112 | This installs 90+ skills into `~/.claude/skills/`. Safe to re-run if skills are already installed. |
| 113 | |
| 114 | ### Step 6: Verify |
| 115 | |
| 116 | ```bash |
| 117 | gws auth status |
| 118 | gws calendar +agenda --today |
| 119 | gws gmail +triage |
| 120 | ``` |
| 121 | |
| 122 | --- |
| 123 | |
| 124 | ## Troubleshooting |
| 125 | |
| 126 | ### "Auth error — credentials missing or invalid" (exit code 2) |
| 127 | |
| 128 | - Check `~/.config/gws/client_secret.json` exists and has valid JSON |
| 129 | - Re-run `gws auth login` |
| 130 | |
| 131 | ### Token expired |
| 132 | |
| 133 | - If the GCP app is in "Testing" status, tokens expire after 7 days |
| 134 | - Re-run `gws auth login` to refresh |
| 135 | - For permanent tokens, push the app to Production in GCP Console OAuth consent screen |
| 136 | |
| 137 | ### Skills not appearing in Claude Code |
| 138 | |
| 139 | - Skills load at session start — restart Claude Code after installing |
| 140 | - Verify: `ls ~/.claude/skills/gws-* | wc -l` should show 30+ directories |
| 141 | |
| 142 | ## See Also |
| 143 | |
| 144 | - [gws-setup](../gws-setup/SKILL.md) — First-time setup including GCP project creation |
| 145 | - [gws-shared](~/.claude/skills/gws-shared/SKILL.md) — Auth patterns and global flags |