agentsclimarketplace

Json data analysis

Skill cxcscmu/SkillLearnBench/skills/b1-one-shot-claude-sonnet-4-6/enterprise-information-search/json-data-analysis

Python patterns for analyzing large JSON datasets to find specific information, track tokens, and write answers in the required format.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill json-data-analysis

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.6 KB, 372 tokens by cl100k_base, as published. Nobody here has run it

JSON Data Analysis

Loading and Analyzing Large JSON Files

import json

with open('/path/to/file.json') as f:
    data = json.load(f)

Counting Tokens (Approximate)

import json

def count_tokens(text):
    """Approximate token count: ~4 chars per token"""
    return len(str(text)) // 4

# Or use tiktoken for more accurate counting
# pip install tiktoken
import tiktoken
enc = tiktoken.get_encoding("cl100k_base")
tokens = len(enc.encode(str(data)))

Writing Answer File

import json

answers = {
    "q1": {"answer": ["emp001", "emp002"], "tokens": 150},
    "q2": {"answer": ["emp003"], "tokens": 200},
}

with open('/root/answer.json', 'w') as f:
    json.dump(answers, f, indent=4)

Searching Nested Structures

def deep_search(obj, keyword):
    """Recursively search for keyword in nested structure"""
    results = []
    if isinstance(obj, str):
        if keyword.lower() in obj.lower():
            results.append(obj)
    elif isinstance(obj, dict):
        for v in obj.values():
            results.extend(deep_search(v, keyword))
    elif isinstance(obj, list):
        for item in obj:
            results.extend(deep_search(item, keyword))
    return results

Extracting Employee IDs

import re

def extract_employee_ids(text):
    """Extract employee IDs matching pattern like EMP001, E001, etc."""
    return re.findall(r'\b[A-Z]{1,3}\d{3,6}\b', text)

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.