| name | jqschema |
| description | Infer JSON structure and types with jq-based schema discovery. |
| tools | {"bash":["jq *","./.github/skills/jqschema/jqschema.sh","git"]} |
jqschema - JSON Schema Discovery
Use ./.github/skills/jqschema/jqschema.sh directly from the repository skill folder to discover complex JSON structure.
Purpose
Generate a compact structural schema (keys + types) from JSON input. Use it when:
- Analyzing tool outputs from GitHub search (search_code, search_issues, search_repositories)
- Exploring API responses with large payloads
- Understanding the structure of unfamiliar data without verbose output
- Planning queries before fetching full data
Usage
cat data.json | ./.github/skills/jqschema/jqschema.sh
echo '{"name": "test", "count": 42, "items": [{"id": 1}]}' | ./.github/skills/jqschema/jqschema.sh
gh api search/repositories?q=language:go | ./.github/skills/jqschema/jqschema.sh
How It Works
The script transforms JSON data by:
- Replacing object values with their type names ("string", "number", "boolean", "null")
- Reducing arrays to their first element's structure (or empty array if empty)
- Recursively processing nested structures
- Outputting compact (minified) JSON
Example
Input:
{
"total_count": 1000,
"items": [
{"login": "user1", "id": 123, "verified": true},
{"login": "user2", "id": 456, "verified": false}
]
}
Output:
{"total_count":"number","items":[{"login":"string","id":"number","verified":"boolean"}]}
Best Practices
Use this script when:
- You need to understand the structure of tool outputs before requesting full data
- GitHub search tools return large datasets (use
perPage: 1 and pipe through schema minifier first)
- Exploring unfamiliar APIs or data structures
- Planning data extraction strategies
Example workflow for GitHub search tools:
echo '{}' | gh api search/repositories -f q="language:go" -f per_page=1 | ./.github/skills/jqschema/jqschema.sh
Using with GitHub MCP tools:
When using tools like search_code, search_issues, or search_repositories, pipe the output through jqschema to discover available fields:
gh api search/code -f q="jq in:file language:bash" -f per_page=1 > /tmp/sample.json
cat /tmp/sample.json | ./.github/skills/jqschema/jqschema.sh