data-qa
数据问答技能 / Data Q&A Skill
Precisely calculate data through Python scripts, provide immediate accurate numeric answers and business explanations. Directly reading data produces hallucinations; must use script complete calculation.
代码执行方式 / Code Execution Method
Data analysis code must be executed via run_python_snippet tool.
核心步骤 / Core Steps
- Write script: Python processes full data, outputs JSON or structured result
- Execute: run_python_snippet(python_code=..., script_path=..., cwd=...)
- Parse: Extract answer, explanation from result.content
- Answer: Natural language response with numeric result and business explanation
- End task
完整工作流示例 / Complete Workflow Example
# Step 1: 使用 run_python_snippet 执行 Python 代码
run_python_snippet(
python_code="""
import json
import pandas as pd
df = pd.read_csv('path/to/data.csv')
metric = df['column'].sum() # 完整计算,勿仅读取片段
print(json.dumps({'answer': metric, 'explanation': '...'}))
""",
script_path="temp_data_qa.py",
cwd="工作区根目录"
)
# Step 2: 解析 result.content 获取计算结果
# Step 3: 基于计算结果用自然语言回答用户问题
Key: Script must process complete data and output structured result (e.g. JSON). Strictly prohibited to answer by directly reading file snippets.
核心原则 / Core Principle
Directly reading data produces hallucinations, misleading decisions. Only through script complete calculation can accurate results be obtained.
工具选择决策树 / Tool Selection Decision Tree
User asks numeric data question? ├─ Yes → Write run_python_snippet script to calculate └─ No → Do not use this skill
Data format? ├─ CSV/Excel → pandas read, full calculation, print(json.dumps(...)) ├─ JSON → json.load + processing logic └─ Other → See data processing instructions below
数据处理规范 / Data Processing Instructions
When scenarios involve data analysis, write Python scripts for analysis:
- Python scripts are solely for data analysis processing, not data visualization. Use ECharts for visualization. Strictly prohibited to write chart rendering code in Python scripts.
- For data files like Excel, CSV, use read_files to read first 10 lines to understand structure, then use Python scripts for data analysis.
- For Excel files with multiple sheets or large size, always use Python scripts for analysis. First use script to view data structure and sheet structure, then perform analysis. Scripts should return only small amount of result data, avoid reading large volumes of useless data.
- Python script processing results should be refined. Script's role is to calculate and distill core data, not return large amounts of process data. Typically hundreds to thousands of characters, max 5000 characters.
- Follow latest mainstream Python programming practices. Ensure code robustness, aim for one-time successful execution.
More from dtyq/magic
find-skill
Search and install skills from the platform skill library, skill market, or skillhub. Use when the agent needs to find or install a skill to expand its capabilities. Always search the platform first; fall back to skillhub only if nothing is found.
21skill-vetter
Security-first skill vetting protocol for AI agents. Use before installing any skill from the platform skill market, skillhub, GitHub, or other sources. Checks for red flags, permission scope, and suspicious patterns to determine whether a skill is safe to install.
19ui-data-testid
Add stable `data-testid` attributes by default for new or refactored UI components. Use when implementing React/TSX views, shadcn/antd-style components, dropdown/menu configs, or interactive UI flows that need reliable selectors for unit/E2E tests.
19wiki-generator
通过分析代码结构与依赖,自动提取系统总体架构、核心特有功能模块的实现细节,并生成互相关联的多页面 Wiki 结构文档集。作为项目的架构知识库守护者,还负责在日常开发中解答疑问,并在架构变更时自动维护文档。
18code-review-expert
Expert code review of current git changes with a senior engineer lens. Detects SOLID violations, security risks, and proposes actionable improvements.
17env-manager
Manage persistent environment variables. Use when the user provides API keys or other configuration values that need to be saved and reused across sessions.
17