Agent Skills: Gemini Query Command

Send a quick headless query to Gemini CLI and display the response with stats

UncategorizedID: melodic-software/claude-code-plugins/gemini-query

Install this agent skill to your local

pnpm dlx add-skill https://github.com/melodic-software/claude-code-plugins/tree/HEAD/plugins/google-ecosystem/skills/gemini-query

Skill Files

Browse the full folder contents for gemini-query.

Download Skill

Loading file tree…

plugins/google-ecosystem/skills/gemini-query/SKILL.md

Skill Metadata

Name
gemini-query
Description
Send a quick headless query to Gemini CLI and display the response with stats

Gemini Query Command

Execute a quick headless query to Gemini CLI and display the response.

Usage

/google-ecosystem:gemini-query <prompt>

Examples

  • /google-ecosystem:gemini-query What is the capital of France?
  • /google-ecosystem:gemini-query Explain async/await in JavaScript
  • /google-ecosystem:gemini-query Review this error: TypeError: Cannot read property 'x' of undefined

Execution

Run the query using Gemini CLI headless mode:

result=$(gemini "$ARGUMENTS" --output-format json 2>&1)

Output

Parse and present the response:

  1. Response: The main AI-generated content from .response
  2. Stats: Token usage, model used, latency from .stats
  3. Errors: Any error messages from .error

Response Extraction

# Extract response
response=$(echo "$result" | jq -r '.response // "No response"')

# Extract stats
tokens=$(echo "$result" | jq '.stats.models | to_entries | map(.value.tokens.total) | add // 0')
cached=$(echo "$result" | jq '.stats.models | to_entries | map(.value.tokens.cached) | add // 0')
models=$(echo "$result" | jq -r '.stats.models | keys | join(", ") | if . == "" then "unknown" else . end')
latency=$(echo "$result" | jq '.stats.models | to_entries | map(.value.api.totalLatencyMs) | add // 0')

# Check for errors
error=$(echo "$result" | jq -r '.error.message // empty')

Format Output

Present the results in a clean format:

## Gemini Response

{response}

---
**Stats**: {tokens} tokens ({cached} cached) | Model: {models} | Latency: {latency}ms

If there's an error:

## Error

**Type**: {error_type}
**Message**: {error_message}

Notes

  • Uses --output-format json for structured parsing
  • Displays both response and usage statistics
  • Handles errors gracefully with helpful messages