Guide · Agent skill
How to use the Google Workspace gws CLI agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The google-workspace skill gives an AI agent instructions for using the gws command-line tool to work with Google Workspace apps such as Drive, Docs, Sheets, Gmail, Calendar, Chat, Tasks and Slides. This guide explains what the skill does, how to install it, how to set up credentials, and how to ask for tasks in plain language. You do not need prior experience with agent skills to follow it.
Quick start
- 1Install Node.js and the gws CLI. Install Node.js and npm, then run npm install -g @googleworkspace/cli.
- 2Download and unzip the skill. Download the google-workspace ZIP from this page and unzip it so the folder with SKILL.md sits in ~/.claude/skills/ or a project's .claude/skills/.
- 3Configure credentials. Use a pre-injected Connect Workspace token if available, or create a Desktop app OAuth client and place client_secret.json in the config directory, or set a service account key path.
- 4Log in with read-only scopes. Run gws auth login --readonly and complete the browser login on your machine.
- 5Make a test request. Ask the agent for a simple read, such as listing a few Drive files or your next calendar event, to confirm access works.
- 6Add write access only when needed. When a task requires editing, re-run gws auth login with the specific scopes for that surface.
What the google-workspace skill makes the agent do
An agent skill is a folder with a SKILL.md file that tells an AI agent how to handle a certain kind of task. This skill covers Google Workspace. When it is installed, the agent knows to use the gws command-line tool for requests that name a Google app, instead of trying to write raw API calls by hand.
gws is a community CLI, not an official Google product. It wraps the Workspace REST APIs and covers Drive, Docs, Sheets, Gmail, Calendar, Chat, Tasks, Slides, Keep, Forms, Apps Script and Meet. The skill does not include any Google credentials, so you must set those up yourself.
- Read and write Drive, Docs, Sheets, Gmail, Calendar, Chat, Tasks and Slides
- Check for an existing access token before starting a login
- Help set up an OAuth client or service account if none exists
- Log in with read-only permissions first
How do you install the google-workspace skill?
Download the ZIP file for the skill from this page. Unzip it so that the skill folder, which contains SKILL.md, sits in one of these locations: ~/.claude/skills/ for your personal use, or .claude/skills/ inside a project folder if you want the skill limited to that project.
If you use the Claude apps instead, open Settings, go to Capabilities, then Skills, and upload the skill there.
The gws CLI itself must also be installed. The skill depends on the npm package @googleworkspace/cli, so you need Node.js and npm first.
- Node.js and npm are required to install gws
- Install the CLI with: npm install -g @googleworkspace/cli
- Personal install: ~/.claude/skills/
- Project install: .claude/skills/ inside the project
npm install -g @googleworkspace/cliHow do you set up Google authentication for gws?
Authentication is the step most people get stuck on. The skill checks for credentials in a fixed order, and you should follow the same order. If a token from the web UI's Connect Workspace feature is already present, the agent can use it directly. Otherwise, you configure an OAuth client or a service account.
To create an OAuth client by hand, choose the Desktop app client type, not Web application. The gws login listens on a local loopback port, and a Web application client rejects that with a redirect_uri_mismatch error. For a corporate Workspace organisation, you can set the consent screen audience to Internal.
For unattended automation, you can use a service account instead. Set GOOGLE_APPLICATION_CREDENTIALS to the path of your key file, and calls authenticate with that key without a login step.
- Option 1: place a client_secret.json file in the gws config directory
- Option 2: set GOOGLE_WORKSPACE_CLI_CLIENT_ID and GOOGLE_WORKSPACE_CLI_CLIENT_SECRET
- Option 3: set GOOGLE_APPLICATION_CREDENTIALS to a service account key file
- Create the OAuth client as a Desktop app; a Web application client causes a redirect error
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.jsonHow do you log in with read-only access first?
With an OAuth client in place, run the login with read-only scopes. This is the least-privilege starting point, and the skill recommends it. Add write scopes only when a task actually needs them, by running the login again with the scopes you need. Google's incremental consent adds the new permission to the ones already granted.
The login opens a browser on your machine and waits for a local redirect, so it needs a browser. You can check the current login state at any time with gws auth status. If you see a 403 or scope error when a request runs, the token is valid but does not include the permission that request needs.
- Start with --readonly for least privilege
- Add write scopes later, only for the surface you need
- Use -s to limit the scope picker to chosen services, for example drive, gmail and sheets
- gws auth login is browser-based and has no paste-a-code option
gws auth login --readonlyHow do you trigger the skill with natural requests?
You do not need to name the skill. The skill applies to any request that names a Google Workspace surface. Ask in ordinary language and say which app and what you want done. The more specific you are about the file, folder, label, or calendar, the fewer back-and-forth questions the agent needs to ask.
Requests that work well include reading a Drive file, listing a folder, sharing a document, creating a Doc from a description, updating a sheet, appending a row, drafting a Gmail reply, checking a calendar, scheduling a meeting, and posting to a Chat space.
- Read this Drive file and summarise it
- List my Drive folder called Client Notes
- Append a row with today's figures to the budget sheet
- Draft a Gmail reply to the last message from Sam, but do not send it
- What is on my calendar on Thursday?
- Schedule a 30 minute meeting with the design team next week
- Post this summary to the project Chat space
What are the safety notes for this skill?
The skill runs scripts and uses the network, because gws calls Google's APIs on your behalf. Once permissions are granted, the agent can read and change your email and files. Only grant access to an account you are comfortable letting an agent use, and prefer read-only scopes wherever possible.
For shared or automated setups, use a service account that a person has reviewed, and avoid unattended write access. A bad instruction could otherwise change or send data with no one checking it. The skill also tells the agent not to use curl against the raw Workspace APIs, because gws already handles those calls.
- Grant read-only scopes first and add write access only when needed
- Do not use unattended automation without a reviewed service account
- Only use this in environments where you can install the npm package
- Keep credentials out of shared folders; the skill does not supply them
What tips help the skill work reliably?
Confirm that each Google API you need is enabled for the account or project you use. If a call fails with a quota-project 403 error, check that the project_id in your client_secret.json is a project the signed-in account is allowed to use.
If you run the agent in a sandbox, set the config directory and keyring backend on every command, because each shell call starts fresh. Keep the config directory somewhere durable so the login survives upgrades.
- Name the file, sheet, or calendar exactly to avoid extra questions
- Keep the config directory persistent so the login is not lost
- Set GOOGLE_WORKSPACE_CLI_KEYRING_BACKEND=file when there is no OS keyring
- Use gws auth status to check login state, but confirm with a real read when a token came from the environment
export GOOGLE_WORKSPACE_CLI_CONFIG_DIR=/path/to/gws-config GOOGLE_WORKSPACE_CLI_KEYRING_BACKEND=fileWhat people use it for
- Summarising a long Google Doc or Drive folder
- Appending rows to a Google Sheet from a list of figures
- Drafting Gmail replies for review before sending
- Checking and scheduling Google Calendar events
- Posting status updates to a Google Chat space
Frequently asked questions
How do I install the google-workspace agent skill?
Download the skill ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into .claude/skills/ inside a project. You can also upload it in the Claude apps under Settings, then Capabilities, then Skills. You must also install the gws CLI with npm install -g @googleworkspace/cli.
What do I need before the skill works?
You need Node.js and npm, the gws CLI, and a Google OAuth client of the Desktop app type or a service account key. The Google account must have the relevant APIs enabled, and you need a browser on your machine for the login step. The skill does not include credentials.
Is the gws CLI free to use?
The source does not state pricing or licence terms for the gws CLI, so check its npm package page before relying on it. The skill itself is listed under Apache-2.0. Google Workspace access depends on your own Google account or organisation.
Why does gws auth login fail with redirect_uri_mismatch?
This usually means the OAuth client was created as a Web application. Create a new client with the Desktop app type, since gws listens on a random loopback port that Web application clients reject. Then place the client_secret.json in the config directory and try again.
Can the agent use a service account instead of logging in?
Yes. Set GOOGLE_APPLICATION_CREDENTIALS to the path of your service account key, and calls authenticate directly without gws auth login. This suits unattended automation, but use a service account that someone has reviewed, because write access could act without a person checking.
How is this different from calling the Google APIs directly?
The skill tells the agent to use gws rather than raw curl requests. gws wraps the REST APIs and handles pagination, retries and JSON parsing, so the agent does not need to hand-build each call. The trade-off is that you install and trust an extra community CLI.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
This skill suits people who often ask an agent to find, summarise or edit Google Docs, Sheets, Drive files, or who want an agent to drive Gmail and Calendar in a controlled setup. It is a poor fit if you are not willing to give an agent access to your Google account, if you cannot install the npm package, or if you need unattended write access without a reviewed service account.
Download the skill