AgentSkillsCN

gws-search

通过gws实现Google Sheets的CLI操作。当用户需要读取、写入或管理Google Sheets电子表格,包括单元格值、行、列、工作表、排序、合并,以及查找替换等操作时,可使用此技能。触发词包括:sheets、spreadsheet、google sheets、cells、rows、columns、公式。

SKILL.md
--- frontmatter
name: gws-search
version: 1.0.0
description: "Google Custom Search CLI operations via gws. Use when users need to perform web searches using Google Programmable Search Engine. Triggers: google search, custom search, web search."
metadata:
  short-description: Google Custom Search CLI operations
  compatibility: claude-code, codex-cli

Google Search (gws search)

gws search provides CLI access to Google Programmable Search Engine (Custom Search) with structured JSON output.

Disclaimer: gws is not the official Google CLI. This is an independent, open-source project not endorsed by or affiliated with Google.

Dependency Check

Before executing any gws command, verify the CLI is installed:

bash
gws version

If not found, install: go install github.com/omriariav/workspace-cli/cmd/gws@latest

Authentication

Requires separate API credentials beyond standard OAuth:

  1. Create a Programmable Search Engine at https://programmablesearchengine.google.com/
  2. Get an API key from Google Cloud Console
  3. Set GWS_SEARCH_ENGINE_ID and GWS_SEARCH_API_KEY environment variables, or add search_engine_id and search_api_key to your config file

Quick Command Reference

TaskCommand
Web searchgws search "query"
Limit resultsgws search "query" --max 5
Search a sitegws search "query" --site example.com
Image searchgws search "query" --type image
Paginate resultsgws search "query" --start 11
Override API keygws search "query" --api-key <key> --engine-id <id>

Detailed Usage

search — Web search

bash
gws search <query> [flags]

Flags:

  • --max int — Maximum number of results, 1-10 (default 10)
  • --site string — Restrict search to a specific site
  • --type string — Search type: image or empty for web
  • --start int — Start index for results pagination (default 1)
  • --api-key string — API Key (overrides config)
  • --engine-id string — Search Engine ID (overrides config)

Examples:

bash
gws search "golang best practices"
gws search "kubernetes deployment" --max 5
gws search "release notes" --site github.com
gws search "logo" --type image
gws search "query" --start 11    # Page 2 of results

Output Modes

bash
gws search "query" --format json    # Structured JSON (default)
gws search "query" --format text    # Human-readable text

Tips for AI Agents

  • Always use --format json (the default) for programmatic parsing
  • This command uses Google's Custom Search API, not standard Google search — it requires a separate API key and search engine ID
  • Max 10 results per request; use --start to paginate
  • The --site flag is useful for searching within a specific domain
  • Image search (--type image) returns image URLs and metadata