Parse Gemini CLI headless output (JSON and stream-JSON formats). Covers response extraction, stats interpretation, error handling, and tool call analysis. Use when processing Gemini CLI programmatic output.
View on GitHubmelodic-software/claude-code-plugins
google-ecosystem
plugins/google-ecosystem/skills/gemini-json-parsing/SKILL.md
January 21, 2026
Select agents to install to:
npx add-skill https://github.com/melodic-software/claude-code-plugins/blob/main/plugins/google-ecosystem/skills/gemini-json-parsing/SKILL.md -a claude-code --skill gemini-json-parsingInstallation paths:
.claude/skills/gemini-json-parsing/# Gemini JSON Parsing
## 🚨 MANDATORY: Invoke gemini-cli-docs First
> **STOP - Before providing ANY response about Gemini JSON output:**
>
> 1. **INVOKE** `gemini-cli-docs` skill
> 2. **QUERY** for the specific output format topic
> 3. **BASE** all responses EXCLUSIVELY on official documentation loaded
## Overview
Skill for parsing Gemini CLI's structured output formats. Essential for integration workflows where Claude needs to process Gemini's responses programmatically.
## When to Use This Skill
**Keywords:** parse gemini output, json output, stream json, gemini stats, token usage, jq parsing, gemini response
**Use this skill when:**
- Extracting responses from Gemini JSON output
- Analyzing token usage and costs
- Parsing tool call statistics
- Handling errors from Gemini CLI
- Building automation pipelines
## Output Formats
### Standard JSON (`--output-format json`)
Single JSON object returned after completion:
```json
{
"response": "The main AI-generated content",
"stats": {
"models": {
"gemini-2.5-pro": {
"api": {
"totalRequests": 2,
"totalErrors": 0,
"totalLatencyMs": 5053
},
"tokens": {
"prompt": 24939,
"candidates": 20,
"total": 25113,
"cached": 21263,
"thoughts": 154,
"tool": 0
}
}
},
"tools": {
"totalCalls": 1,
"totalSuccess": 1,
"totalFail": 0,
"totalDurationMs": 1881,
"totalDecisions": {
"accept": 0,
"reject": 0,
"modify": 0,
"auto_accept": 1
},
"byName": {
"google_web_search": {
"count": 1,
"success": 1,
"fail": 0,
"durationMs": 1881
}
}
},
"files": {
"totalLinesAdded": 0,
"totalLinesRemoved": 0
}
},
"error": {
"type": "ApiError",
"message": "Error description",
"code": 500
}
}
```
### Stream JSON (`--output-format st