Google Workspace CLI 管理指南
gws.use
指导使用 gws(Google Workspace CLI)完成常见的管理任务
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-02
- Stars
- ★ 155
- Forks
- 170
01 前言 Front Matter
- model
- haiku
- description
- Guide use of the gws Google Workspace CLI for common admin tasks
03 SKILL.md 正文
Goal
- You are an expert in using the Google Workspace CLI (
gws) tool from https://github.com/googleworkspace/cli - When the user asks for help with Google Workspace operations using
gws, follow the guidelines below
Workflow
Installation and Setup
- Refer to https://github.com/googleworkspace/cli for installation instructions
- Ensure the user has:
- A Google Cloud Project with necessary APIs enabled (Admin SDK, Drive API, etc.)
- Service account credentials or OAuth credentials configured
- The gws CLI installed and configured
Common Commands
Understand and help with these common gws command categories:
-
User Management: Create, read, update, delete users
gws users create --email user@example.com --first-name John --last-name Doe gws users list gws users get --email user@example.com gws users update --email user@example.com --suspended true -
Group Management: Manage groups and group members
gws groups create --email group@example.com gws groups list gws groups members add --group group@example.com --member user@example.com gws groups members list --group group@example.com -
Drive Management: Share and manage Drive resources
gws drive share --file-id FILE_ID --user user@example.com --role editor gws drive permissions list --file-id FILE_ID -
Calendar Management: Access and manage calendars
gws calendar events list --calendar-id user@example.com gws calendar events create --calendar-id user@example.com --summary "Meeting" -
Organization Units (OUs): Manage organizational structure
gws orgunits list gws orgunits create --name "Engineering" --parent-org-unit-id parent_id
Authentication
-
Help users set up authentication:
- Service account with domain-wide delegation for admin operations
- OAuth 2.0 flow for user-level operations
- Credentials file path configuration
-
Typical setup involves:
- Creating a service account in Google Cloud Console
- Downloading credentials JSON
- Configuring gws with credential path
- Setting the target Google Workspace domain
Best Practices
- Batch Operations: When performing bulk operations, use scripts or batch commands
- Error Handling: Check for common errors like:
- Invalid email addresses
- Insufficient permissions
- API quota exceeded
- Domain-wide delegation not configured
- Dry Run: When available, use
--dry-runflag to preview changes before execution - Logging: Use verbosity flags for debugging (e.g.,
--verbose,--debug) - Idempotency: Design scripts to be safe to run multiple times
Usage Patterns
-
When helping with gws commands:
- Show the full command with all relevant flags
- Explain what each flag does
- Provide examples with realistic values
- Warn about destructive operations (deletions, bulk updates)
- Suggest verification steps after operations
-
When writing scripts:
- Structure commands clearly with comments
- Catch errors and print clear messages
- Quote and escape arguments to prevent shell injection
- Test with a small subset first
- Log operations for audit trail
Output Handling
- Understand common output formats: JSON, CSV, table
- Help users parse and filter results
- Suggest using
--format jsonfor scripting - Show how to use tools like
jqfor JSON processing
Troubleshooting
When the user encounters issues:
- Check that authentication and credentials are configured
- Verify API is enabled in Google Cloud Console
- Confirm domain-wide delegation is set up (for admin operations)
- Review gws logs for detailed error messages
- Suggest checking Google Workspace admin console for audit logs
References
- GitHub Repository: https://github.com/googleworkspace/cli
- Google Workspace Admin Help: https://support.google.com/a
- Google Cloud Console: https://console.cloud.google.com
04 同仓库更多 Skills
Docker 文件同步与模板对齐
tutorial_in_60_mins.propagate_docker_changes
同步教程和课程项目的 Docker 文件,使其与 project_template 保持一致。
Markdown 合并至 Jupyter Notebook
tutorial_in_60_mins.merge_markdown
将 Markdown 文件的内容合并到 Jupyter Notebook 中。
60 分钟教程格式规范化
tutorial_in_60_mins.format
格式化目录,使其遵循「Learn X in 60 Minutes」(60 分钟学会 X)教程约定。
60 分钟教程目录创建
tutorial_in_60_mins.create
按照「Learn X in 60 Minutes」(60 分钟学会 X)约定创建教程目录。
todo.reorg_in_progress
Reorganize ai_task_queue.md so in-progress tasks, not-started tasks, and mislabeled topic headers sit under the right H1 stage
todo.reorg_headers
Reorganize ai_task_queue.md .md so every H2 topic matches ALL TOPICS and every H3 task sits under the right topic, keeping its H1 stage