Agent Skillspenpot/penpot › jq-json-processor

jq-json-processor

GitHub

提供jq命令行工具的使用指南,涵盖JSON数据的提取、过滤、转换及格式化操作,支持数组处理、条件筛选和文件读写等场景。

.opencode/skills/jq-json-processor/SKILL.md penpot/penpot

触发场景

需要解析或提取JSON字段 对API返回的JSON数据进行过滤或转换 格式化或压缩JSON输出

安装

npx skills add penpot/penpot --skill jq-json-processor -g -y
更多选项

非标准路径

npx skills add https://github.com/penpot/penpot/tree/develop/.opencode/skills/jq-json-processor -g -y

不安装直接使用

npx skills use penpot/penpot@jq-json-processor

指定 Agent (Claude Code)

npx skills add penpot/penpot --skill jq-json-processor -a claude-code -g -y

安装 repo 全部 skill

npx skills add penpot/penpot --all -g -y

预览 repo 内 skill

npx skills add penpot/penpot --list

SKILL.md

Frontmatter
{
    "name": "jq-json-processor",
    "homepage": "https:\/\/jqlang.github.io\/jq\/",
    "metadata": {
        "clawdbot": {
            "emoji": "🔍",
            "install": [
                {
                    "id": "brew",
                    "bins": [
                        "jq"
                    ],
                    "kind": "brew",
                    "label": "Install jq (brew)",
                    "formula": "jq"
                },
                {
                    "id": "apt",
                    "bins": [
                        "jq"
                    ],
                    "kind": "apt",
                    "label": "Install jq (apt)",
                    "package": "jq"
                }
            ],
            "requires": {
                "bins": [
                    "jq"
                ]
            }
        }
    },
    "description": "Process, filter, and transform JSON data using jq - the lightweight and flexible command-line JSON processor."
}

jq JSON Processor

Process, filter, and transform JSON data with jq.

Quick Examples

Basic filtering

# Extract a field
echo '{"name":"Alice","age":30}' | jq '.name'
# Output: "Alice"

# Multiple fields
echo '{"name":"Alice","age":30}' | jq '{name: .name, age: .age}'

# Array indexing
echo '[1,2,3,4,5]' | jq '.[2]'
# Output: 3

Working with arrays

# Map over array
echo '[{"name":"Alice"},{"name":"Bob"}]' | jq '.[].name'
# Output: "Alice" "Bob"

# Filter array
echo '[1,2,3,4,5]' | jq 'map(select(. > 2))'
# Output: [3,4,5]

# Length
echo '[1,2,3]' | jq 'length'
# Output: 3

Common operations

# Pretty print JSON
cat file.json | jq '.'

# Compact output
cat file.json | jq -c '.'

# Raw output (no quotes)
echo '{"name":"Alice"}' | jq -r '.name'
# Output: Alice

# Sort keys
echo '{"z":1,"a":2}' | jq -S '.'

Advanced filtering

# Select with conditions
jq '[.[] | select(.age > 25)]' people.json

# Group by
jq 'group_by(.category)' items.json

# Reduce
echo '[1,2,3,4,5]' | jq 'reduce .[] as $item (0; . + $item)'
# Output: 15

Working with files

# Read from file
jq '.users[0].name' users.json

# Multiple files
jq -s '.[0] * .[1]' file1.json file2.json

# Modify and save
jq '.version = "2.0"' package.json > package.json.tmp && mv package.json.tmp package.json

Common Use Cases

Extract specific fields from API response:

curl -s https://api.github.com/users/octocat | jq '{name: .name, repos: .public_repos, followers: .followers}'

Convert CSV-like data:

jq -r '.[] | [.name, .email, .age] | @csv' users.json

Debug API responses:

curl -s https://api.example.com/data | jq '.'

Tips

  • Use -r for raw string output (removes quotes)
  • Use -c for compact output (single line)
  • Use -S to sort object keys
  • Use --arg name value to pass variables
  • Pipe multiple jq operations: jq '.a' | jq '.b'

Documentation

Full manual: https://jqlang.github.io/jq/manual/ Interactive tutorial: https://jqplay.org/

版本历史

  • 2dcf1a8 当前 2026-08-20 19:20

同 Skill 集合

.opencode/skills/bat-cat/SKILL.md
.opencode/skills/code-review-and-quality/SKILL.md
.opencode/skills/code-review/SKILL.md
.opencode/skills/create-commit/SKILL.md
.opencode/skills/create-issue/SKILL.md
.opencode/skills/create-pr/SKILL.md
.opencode/skills/fd-find/SKILL.md
.opencode/skills/nrepl-eval/SKILL.md
.opencode/skills/plan-review/SKILL.md
.opencode/skills/planner/SKILL.md
.opencode/skills/refine-prompt/SKILL.md
.opencode/skills/ripgrep/SKILL.md
.opencode/skills/security-and-hardening/SKILL.md
.opencode/skills/taiga/SKILL.md
.opencode/skills/testing/SKILL.md
.opencode/skills/update-changelog/SKILL.md
.opencode/skills/ste/SKILL.md

元信息

文件数
0
版本
2ce202c
Hash
31dc5421
收录时间
2026-08-20 19:20

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-16 20:14
浙ICP备14020137号-1