# Jq Data Processing

> Process JSON data from GitHub CLI using jq to calculate metrics like average merge times, counts, and top contributors.

- Skill: `cxcscmu/jq-data-processing` (Agent Skill)
- Install (CLI): `npx get-skill add cxcscmu/jq-data-processing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cxcscmu/jq-data-processing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- Author: cxcscmu (https://skillmd.com/u/cxcscmu)
- Updated: 2026-11-24
- Page: https://skillmd.com/skills/cxcscmu/jq-data-processing

---


# JQ Data Processing for Repo Stats

This skill provides `jq` patterns for common repository metrics calculations.

## Common Patterns

### Counting and Filtering
Count total items:
```bash
jq 'length' data.json
```

Filter for merged PRs:
```bash
jq '[.[] | select(.mergedAt != null)]' prs.json
```

### Calculating Average Merge Time
Compute average merge time in days (assuming `createdAt` and `mergedAt` are ISO8601 strings):
```bash
jq '[.[] | select(.mergedAt != null) | ((.mergedAt | fromdateiso8601) - (.createdAt | fromdateiso8601)) / 86400] | add / length | round * 10 / 10' prs.json
```
*Note: Dividing by 86400 converts seconds to days.*

### Finding Top Contributor
Identify the author with the most entries:
```bash
jq -r '[.[] | .author.login] | group_by(.) | sort_by(-length) | .[0][0]' prs.json
```

### Complex Label Search
Count items where any label contains "bug":
```bash
jq '[.[] | select(.labels[].name | contains("bug"))] | length' issues.json
```

