incremental-excel-build
它能做什么
这项技能描述了一种分阶段制作电子表格的方法,适用于包含计算、预测或多个数据来源的表格。适合希望在生成最终工作簿前检查每个阶段的分析人员。
适用场景
- ✓当我要制作一个需要从多个数据来源提取数据的 Excel 文件时。
- ✓当表格中包含需要核对的计算或预测时。
- ✓当我以后可能需要只重新运行工作流中的某一个阶段时。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/incremental-excel-build/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我根据我的门店和销售文件,制作一个预测工作簿。每完成一步都保存检查点,方便我逐阶段核对。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 把工作拆分为提取、转换和组装等阶段,每个阶段结束后保存一个中间 CSV 文件,并在进入下一阶段前检查这些文件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Incremental Excel Build Pattern
When creating complex Excel files with calculations, forecasts, or data transformations, use an incremental build-and-verify approach instead of monolithic scripts. This pattern breaks the workflow into discrete, testable stages with intermediate CSV outputs that can be inspected at each step.
When to Use
- Creating Excel files with multiple data sources
- Complex calculations or forecasts that need validation
- Tasks where debugging intermediate results is important
- Workflows that may need to be re-run from a specific stage
The Four-Stage Pattern
Stage 1: Data Extraction
Extract raw data from source systems and save to CSV.
# extract_data.py
import pandas as pd
def extract_store_data():
# Query database, API, or read source files
stores = pd.read_csv('source_stores.csv')
sales_history = pd.read_csv('source_sales.csv')
# Save intermediate output for verification
stores.to_csv('intermediate_stores.csv', index=False)
sales_history.to_csv('intermediate_sales.csv', index=False)
print(f"Extracted {len(stores)} stores, {len(sales_history)} sales records")
return stores, sales_history
if __name__ == '__main__':
extract_store_data()
Verification checkpoint: Open intermediate_stores.csv and intermediate_sales.csv to verify data completeness and format before proceeding.
Stage 2: Data Preparation/Transformation
Clean, filter, and transform data for calculations.
# prepare_data.py
import pandas as pd
def prepare_data():
# Load intermediate files from Stage 1
stores = pd.read_csv('intermediate_stores.csv')
sales = pd.read_csv('intermediate_sales.csv')
# Filter active stores, clean data
active_stores = stores[stores['status'] == 'active']
# Merge and prepare for calculations
prepared = pd.merge(active_stores, sales, on='store_id', how='left')
prepared = prepared.fillna(0) # Handle missing values
# Save for verification
prepared.to_csv('intermediate_prepared.csv', index=False)
print(f"Prepared data for {len(prepared)} store-week combinations")
return prepared
if __name__ == '__main__':
prepare_data()
Verification checkpoint: Review intermediate_prepared.csv to confirm filtering logic and data integrity.
Stage 3: Calculations/Forecasts
Perform business logic, forecasts, or complex calculations.
# calculate_forecast.py
import pandas as pd
import numpy as np
def calculate_forecast():
# Load prepared data from Stage 2
data = pd.read_csv('intermediate_prepared.csv')
# Apply forecast logic
data['forecast_week1'] = data['avg_sales'] * 1.05 # 5% growth
data['forecast_week2'] = data['avg_sales'] * 1.08
data['forecast_week3'] = data['avg_sales'] * 1.10
data['forecast_week4'] = data['avg_sales'] * 1.12
# Calculate totals and metrics
data['total_forecast'] = data[['forecast_week1', 'forecast_week2',
'forecast_week3', 'forecast_week4']].sum(axis=1)
# Save calculations for verification
data.to_csv('intermediate_calculated.csv', index=False)
print(f"Calculated forecasts with avg total: ${data['total_forecast'].mean():.2f}")
return data
if __name__ == '__main__':
calculate_forecast()
Verification checkpoint: Validate intermediate_calculated.csv for calculation accuracy and reasonableness of forecast values.
Stage 4: Excel Output
Format and write final Excel file with proper styling.
# create_excel.py
import pandas as pd
from openpyxl import load_workbook
from openpyxl.styles import Font, PatternFill, Alignment
def create_excel_output():
# Load calculated data from Stage 3
data = pd.read_csv('intermediate_calculated.csv')
# Create Excel writer
writer = pd.ExcelWriter('final_output.xlsx', engine='openpyxl')
data.to_excel(writer, sheet_name='Forecast', index=False)
# Apply formatting
workbook = writer.book
worksheet = writer.sheets['Forecast']
# Header styling
header_fill = PatternFill(start_color='4472C4', end_color='4472C4', fill_type='solid')
header_font = Font(bold=True, color='FFFFFF')
for cell in worksheet[1]:
cell.fill = header_fill
cell.font = header_font
cell.alignment = Alignment(horizontal='center')
# Format currency columns
for col in ['forecast_wee
常见问题
为什么要保存 CSV 检查点?
检查点让你可以打开并检查每个阶段的数据,更容易找到错误。
文中描述了哪些阶段?
指南描述了数据提取等阶段,计算和生成最终文件还有更多步骤。
可以单独重新运行某个阶段吗?
可以。指南说明可以从某个特定阶段开始重新运行。
详情
作者的原始描述
Build complex Excel files through staged, verifiable steps with intermediate CSV outputs for debugging
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #12893
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
agentpilot
7.8k帮你的智能体准备任务并运行 AgentPilot 循环,逐步改进项目:循环会提出修改、测试修改并为其打分。
openspace
7.8k帮你的智能体设置 OpenSpace,这是一个用于存储和获取智能体技能的工具,并通过 MCP 将其连接到你的 AI 应用。
rsi-arena
7.8k帮你的智能体设置并运行标准 AI 基准测试,例如 AIME 和 Terminal-Bench,用来比较不同的改进方法。
experiment-guide
7.8k帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。