Community研究与数据分析github.com

grahama1970/analytics

灵活的数据科学分析工具,适用于任何数据集。自动发现数据模式,推荐图表,并导出为 create-figure 格式。支持 JSONL、JSON、CSV 等来源。

analytics 是什么?

该技能是一个通用的数据科学分析工具,可处理任何数据集(JSONL、JSON、CSV)。它能自动发现数据模式(包括列类型、基数等),并根据模式推荐最适合的图表类型。用户或 AI 可以通过命令行生成图表规格,并导出为 create-figure 格式,最终渲染成高质量的 PDF/PNG 图表。该工具支持从基础统计到时间序列分析(趋势、会话、模式)等丰富的分析命令,非常适合结合 Claude Code、Cursor 等 AI 编码工具进行自动化数据探索和可视化。

兼容平台~Claude Code~Codex CLI~Cursor✓Antigravity
npx skills add https://github.com/grahama1970/agent-skills/tree/main/skills/analytics

Installed? Explore more 研究与数据分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

分析技能

灵活的数据科学分析,适用于任何数据集。自动发现数据模式,推荐可视化方案,并导出为 create-figure 格式。

快速开始(任意数据集)

cd .pi/skills/analytics

# 第一步:探索数据中的内容
./run.sh describe data.jsonl

# 第二步:查看推荐并生成图表
./run.sh chart data.jsonl --name distribution_channel -o chart.json

# 第三步:使用 create-figure 渲染
cd .agent/skills/create-figure
./run.sh metrics -i /path/to/chart.json --type bar -o chart.pdf

无缝流水线

任意数据(JSONL/JSON/CSV)
         │
         ▼
┌─────────────────────────────────┐
│     analytics describe          │  ← 发现数据模式,推荐图表
│  "检测到 5 个分类列、2 个数值列、│
│   1 个时间列"                   │
│  推荐方案:                     │
│   - distribution_channel(柱状图)│
│   - trend_by_date(折线图)      │
│   - heatmap_hour_x_day(热力图) │
└─────────────────────────────────┘
         │
         ▼
┌─────────────────────────────────┐
│     analytics chart/group-by    │  ← 以 create-figure 格式生成图表数据
│  --name distribution_channel    │
│  -o chart.json                  │
└─────────────────────────────────┘
         │
         ▼
┌─────────────────────────────────┐
│     create-figure metrics       │  ← 渲染出版质量的 PDF/PNG
│  -i chart.json --type bar       │
│  -o channel_distribution.pdf    │
└─────────────────────────────────┘

命令

数据发现(从这里开始)

命令描述
describe <file>发现数据模式,检测列类型,推荐图表
./run.sh describe sales.jsonl
# 输出:
# 列:date(时间型)、product(分类型)、amount(数值型)、region(分类型)
# 推荐方案:
#   1. distribution_product - product 的分布
#   2. distribution_region - region 的分布
#   3. trend_by_date - 按 date 的计数
#   4. heatmap_product_x_region - product 与 region 的关系

灵活分析

命令描述
group-by <file>按任意列分组并进行聚合
stats <file>数值统计与相关性分析
chart <file>生成 create-figure 的图表规格
# 按任意列分组
./run.sh group-by data.jsonl --by channel --for-figure -o by_channel.json
./run.sh group-by data.jsonl --by category --agg price --func sum

# 数值统计
./run.sh stats data.jsonl --columns revenue,cost,profit

# 根据推荐生成图表
./run.sh chart data.jsonl --name distribution_channel -o chart.json

时间戳数据(ingest-* 输出)

命令描述
insights <file>完整分析摘要(趋势、会话、模式)
trends <file>使用滚动平均分析观看趋势
sessions <file>会话检测与狂欢分析
time-patterns <file>小时/天分布
evolution <file>偏好随时间的变化

输出

命令描述
export <file>批量导出所有标准图表
report <file>生成 Horus 风格的叙述性报告

支持的格式

格式扩展名自动检测
JSONL.jsonl行分隔的 JSON
JSON.json数组或 {data: [...]}
CSV.csv逗号分隔

列类型检测

describe 命令自动检测:

类型检测逻辑推荐图表
时间型datetime64、类似日期的字符串折线图、面积图、热力图(时间轴)
数值型int64、float64直方图、散点图、统计
分类型低基数(≤20 个唯一值)柱状图、饼图、热力图
布尔型bool 类型饼图(真/假)
文本型高基数字符串词云、Top-N 分析

图表推荐

根据列类型,analytics 推荐:

数据模式图表类型create-figure 命令
1 个分类列柱状图、饼图metrics --type bar
1 个时间列折线图training-curves
2 个分类列热力图heatmap
时间列 + 分类列热力图heatmap
2+ 个数值列相关矩阵heatmap
1 个数值列直方图metrics --type bar

智能体工作流

项目智能体分析任意数据集并进行可视化的方式:

# 1. 发现数据模式
result = run("./run.sh describe data.jsonl --json")
recommendations = result["recommendations"]

# 2. 选择第一个推荐方案
chart_name = recommendations[0]["name"]
cmd = recommendations[0]["create_figure_cmd"]

# 3. 生成图表数据
run(f"./run.sh chart data.jsonl --name {chart_name} -o chart.json")

# 4. 渲染
run(f"cd .agent/skills/create-figure && ./run.sh {cmd} -i chart.json -o chart.pdf")

示例

电商销售数据

# 数据:orders.jsonl,包含 date、product、category、amount、region

./run.sh describe orders.jsonl
# → 推荐:distribution_category、distribution_region、trend_by_date

./run.sh group-by orders.jsonl --by category --agg amount --func sum --for-figure -o revenue_by_category.json
# → {"metrics": {"Electronics": 45000, "Clothing": 32000, ...}}

cd .agent/skills/create-figure
./run.sh metrics -i revenue_by_category.json --type bar -o revenue.pdf

YouTube 历史(ingest-yt-history)

# 使用专门的时间戳命令
./run.sh insights ~/.pi/ingest-yt-history/history.jsonl
./run.sh export ~/.pi/ingest-yt-history/history.jsonl -o ./charts --for-figure

cd .agent/skills/create-figure
./run.sh heatmap -i charts/heatmap.json -o viewing_heatmap.pdf

API 响应数据

# 数据:api_logs.json,包含 endpoint、status_code、response_time、user_id

./run.sh describe api_logs.json
./run.sh stats api_logs.json --columns response_time
# → mean=245.3ms, std=89.2ms, p50=220ms, p99=450ms

./run.sh group-by api_logs.json --by endpoint --agg response_time --func mean --for-figure -o latency.json

依赖

# pyproject.toml
dependencies = [
    "pandas>=2.0.0",
    "typer>=0.9.0",
    "rich>=13.0.0",
]

与 Horus 集成

# Horus 叙述风格
./run.sh insights ~/.pi/ingest-yt-history/history.jsonl --horus

# 输出:
# "你的观看模式揭示了一种向忧郁内容的夜间倾向。
#  高峰活动出现在黄昏时刻,在深夜自省时段音乐消费加剧……"

常见错误

# 错误:直接对未知数据集调用 stats
./run.sh stats data.jsonl --columns revenue,cost
# → 在非数值列上失败(“USD 1000” 是文本,不是数字)
# 正确:始终先运行 describe
./run.sh describe data.jsonl
# → 显示列类型,推荐正确的图表命令

# 错误:不根据 describe 推荐,手动选择图表类型
./run.sh group-by data.jsonl --by date --agg views | ./run.sh metrics --type pie
# → 时间序列数据用饼图毫无意义
# 正确:使用 describe 推荐的 create-figure 命令

# 错误:假设 JSONL 的模式符合预期
# → 字段重命名、存在空值、类型混合
# 正确:describe 会自动检测所有这些

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

grahama1970/acceptance-contract

Turn a client brief, zip bundle, directory, or single requirements file into a typed acceptance-contract bundle with extracted requirements, acceptance checks, open questions, an immutable-goal draft, and a create-report-backed decision report. Use when users say acceptance contract, brief to requirements, freeze the goal, create immutable goal, amend immutable goal, build a Battle requirements bundle, or extract requirements from this bundle.

grahama1970/agent-ecosystem

Canonical map and shared contracts for the agent-governance ecosystem: the pi.receipt_envelope.v1 boundary envelope, the component graph, and the rules for which component owns which schema. Use when wiring a skill or extension into the shared receipt world, when asking how shame, triage-error, tau, ask, project-watchdog, ops-herdr, ponytail, and Memory fit together, or when validating an envelope.

grahama1970/agentic-evals

Agentic evaluation of skills using multi-trial fixtures, deterministic command assertions, trajectory checks, safety constraints, and evidence-backed readiness scoring. Use when users ask for agentic evals, multi-trial skill evaluation, skill trajectory validation, or readiness scoring for a skill workflow.

grahama1970/agent-inbox

File-based inter-agent messaging with headless dispatch. Check inbox, send bugs/requests to other projects, automatically spawn headless agents to fix bugs, and track progress via task-monitor.

grahama1970/agents-registry

Generate and query the centralized agent identity registry. Scans .pi/agents/*/AGENTS.md, parses frontmatter, outputs agents-registry.json and optionally syncs to /memory for semantic search.

grahama1970/agent-status

Artifact-driven status surfaces for long-running project-agent work. Maintains status.json, events.jsonl, proof manifests, and a stale-aware STATUS.html so humans can tell where the agent is, what passed, what is still unproven, and what decision or action is next — without dashboard theater.

grahama1970/align

Round-based context alignment before execution. Use when the human, project agent, WebGPT, scillm, ask, dogpile, memory, or project-knowledge may each hold different facts about a task; especially before ambiguous design, infographic, product workflow, high-stakes implementation, plan-iterate, project-infographic, or multi-review work.

grahama1970/analyze-chatterbox-emotions

Evaluate generated Chatterbox voice files as voice-quality artifacts: affect match, arousal/valence proxies, pause placement, intelligibility inputs, clipping, loudness, and discontinuity flags. Use when reviewing Chatterbox emotional tags, pauses, Turbo/base affect delivery, Persona Dream utterance renders, or whether generated speech matches an intended product-facing affect.

grahama1970/analyze-elf

Reverse-engineer features from ELF binaries. Extracts CLI commands, state machines, protocols, Zod schemas, and data models. Automatically generates a /create-walkthrough prosecution brief with Mermaid diagrams. Uses /treesitter for AST analysis of bundled JS/TS source.

grahama1970/animation-vocabulary

Reverse-lookup glossary that turns a vague description of a web animation or motion effect into its exact term ("the bouncy thing when a popover opens" → Pop in; "the iOS rubber-band scroll" → Rubber-banding). Use when the user asks "what's it called when…", or describes a motion effect without knowing its name and wants the right word to prompt an AI or designer with. For naming an effect, not designing or building one.

grahama1970/anonymize-data

Anonymize supported CSV, JSON, UTF-8 text, and SQLite files using an explicit policy through the oai-trial project. Use for anonymize data, pseudonymize exports, redact policy literals, or discover and explicitly approve fuzzy name aliases. The skill is a thin CLI/Docker interface, not another engine.

grahama1970/anvil

Heavy-duty "No-Vibes" debugging and hardening orchestrator. Use this for complex, stubborn bugs where `review-code` has failed, or for "Red Teaming" (hardening) a codebase. Runs multiple agents in parallel (Thunderdome) using git worktree isolation.

grahama1970/apple-design

Apple's approach to interface design and fluid, physical motion, translated for the web. Use when building or reviewing gesture-driven UI, spring animations, drag/swipe/sheet interactions, momentum and interruptible transitions, translucent materials and depth, typography (optical sizing, tracking, leading), reduced-motion, or the design foundations (feedback, spatial consistency, restraint) behind Apple-style interfaces.

grahama1970/argue

Multi-persona structured debate orchestrator. Personas research via /dogpile, consult colleagues via /ask, and argue toward nuanced synthesis on complex questions.

grahama1970/arxiv

Search arXiv for papers and extract knowledge into memory. Use `search` to find papers, `learn` to extract knowledge.

grahama1970/ask

Use when the user asks to query project memory, ask an oracle, use supported browser-backed reviewers, run Tau roundtable/single-handler workflows, ask Pi-native subagents from within Pi, run persona/deep-review workflows, generate image prompts, check OS/project health through composed skills, or run an ask DAG. This skill is the executable /ask runtime; do not replace it with an informal subagent, plain web search, or hand-written review; inside Pi, explicit Pi-native subagent targets are routed through the pi-subagents tool as an Ask target type.

grahama1970/assess

Step back and critically reassess project state. Use when asked to "assess", "step back", "fresh eyes", "check alignment", "sanity check", "health check", "prune documentation", or "evaluate what's working". Offers documentation pruning and doc-code alignment analysis. Offer to run after major changes (don't auto-run).

grahama1970/assistant

Shared GPT + classifier inference gateway for persona monitor tasks. Routes validation and classification through a 4-tier cascade: heuristic → classifier → local GPT → scillm.

grahama1970/assistant-lab

Self-improvement workbench for /assistant. All the tools needed to diagnose, train, evaluate, and promote models in a continuous loop. The "warm pond" where /assistant evolves its own inference stack.

grahama1970/batch-quality

Pre-flight validation and quality gates for batch LLM operations. ACTUALLY tests samples through LLM before burning tokens. Uses SPARTA contracts for DuckDB validation queries. Integrates with task-monitor for enforced quality gates.

相关技能