Community研究與資料分析github.com

grahama1970/analytics

適用於任何數據集的靈活數據科學分析工具。自動探索結構、推薦圖表,並可匯出至 create-figure 格式。支援來自任何來源的 JSONL、JSON、CSV 格式。

analytics 是什麼?

Analytics 是一款靈活的資料科學分析技能,可自動適應任何數據集。它透過自動發現數據結構(schema)、識別欄位類型(如時間、數值、類別、布林值、文字),並根據數據特徵推薦最合適的圖表類型(如長條圖、折線圖、熱力圖、直方圖等),簡化了數據分析工作流程。此技能支援 JSONL、JSON 和 CSV 格式,並能與 create-figure 技能無縫整合,將圖表規格直接渲染為高品質的 PDF 或 PNG 輸出。其核心功能包括使用 `describe` 指令進行數據探索、`group-by` 和 `stats` 進行靈活分析,以及 `chart` 生成圖表規格。對於含有時間戳記的數據(例如 ingest-* 系列的輸出),還提供 `insights`、`trends`、`sessions` 等專用指令進行深度分析。該技能主要用於命令列環境(如 Claude Code、Cursor),並透過 Typer 建構 CLI,依賴 Pandas 進行數據處理。設計思維是先探索、再繪圖、最後渲染,確保用戶總是基於數據的實際結構做出最佳的可視化決策。

相容平台~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 的新對話。

說明文件

Analytics 技能

適用於任何數據集的靈活數據科學分析。自動探索結構、推薦視覺化圖表,並以 create-figure 格式匯出。

快速開始(任何數據集)

cd .pi/skills/analytics

# 步驟 1:探索數據內容
./run.sh describe data.jsonl

# 步驟 2:查看建議並生成圖表
./run.sh chart data.jsonl --name distribution_channel -o chart.json

# 步驟 3:使用 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 (bar)  │
│   - trend_by_date (line)        │
│   - 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 - 產品分佈
#   2. distribution_region - 區域分佈
#   3. trend_by_date - 隨時間計數
#   4. heatmap_product_x_region - 產品 vs 區域

靈活分析

指令說明
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 dtype圓餅圖(真/假)
文字高基數字串文字雲、前 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.

相關技能