Communitygithub.com

David-Li0406/meta-skill-evloving

全面的电子表格创建、编辑和分析,支持公式、格式、数据分析和可视化。适用于Claude处理.xlsx、.xlsm、.csv、.tsv等电子表格文件:新建含公式格式的电子表格、读取分析数据、修改现有表格并保留公式、进行数据分析和可视化、重新计算公式。

meta-skill-evloving 是什么?

该技能(meta-skill-evloving)专为AI代理(如Claude)设计,提供了创建、编辑和分析电子表格(.xlsx, .xlsm, .csv, .tsv等)的完整工作流。其核心价值在于确保生成的电子表格动态、无错误且符合行业标准,尤其适用于金融建模场景。技能要求所有计算均使用Excel公式而非硬编码值,以保持表格的可更新性。它支持pandas进行数据分析,使用openpyxl处理公式和格式,并提供了一个`recalc.py`脚本来重新计算公式并扫描`#REF!`、`#DIV/0!`等错误。该技能特别强调了严格的颜色编码标准(如蓝色文本表示硬编码输入,黑色表示公式)、数字格式规范(如负数用括号表示)、以及公式构建规则(如将假设条件放在单独的单元格中)。对于金融模型,它还要求文档化所有硬编码数据源的出处。用户可在任何支持Python和LibreOffice的平台上使用此技能。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/David-Li0406/meta-skill-evloving/tree/HEAD/AgentSkillOS/data/skill_seeds/xlsx

在你喜欢的 AI 中提问

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

文档

输出要求

所有Excel文件

零公式错误

  • 每个Excel模型必须交付时零公式错误(#REF!、#DIV/0!、#VALUE!、#N/A、#NAME?)

保留现有模板(更新模板时)

  • 修改文件时,仔细研究并精确匹配现有的格式、样式和约定
  • 绝不将标准化格式强加给已有既定格式的文件
  • 现有模板约定始终覆盖这些指南

金融模型

颜色编码标准

除非用户或现有模板另有说明

行业标准颜色约定

  • 蓝色文本(RGB: 0,0,255):硬编码输入,以及用户将用于场景更改的数字
  • 黑色文本(RGB: 0,0,0):所有公式和计算
  • 绿色文本(RGB: 0,128,0):从同一工作簿内其他工作表链接的数据
  • 红色文本(RGB: 255,0,0):指向其他文件的外部链接
  • 黄色背景(RGB: 255,255,0):需要关注的关键假设或需要更新的单元格

数字格式标准

必需格式规则

  • 年份:格式化为文本字符串(例如,“2024”而不是“2,024”)
  • 货币:使用 $#,##0 格式;始终在标题中指定单位(“收入($mm)”)
  • 零值:使用数字格式将所有零显示为“-”,包括百分比(例如,“$#,##0;($#,##0);-”)
  • 百分比:默认使用 0.0% 格式(一位小数)
  • 倍数:估值倍数(EV/EBITDA、P/E)格式化为 0.0x
  • 负数:使用括号 (123) 而非减号 -123

公式构建规则

假设条件放置

  • 将所有假设条件(增长率、利润率、倍数等)放在单独的假设单元格中
  • 在公式中使用单元格引用,而不是硬编码值
  • 示例:使用 =B5*(1+$B$6) 而不是 =B5*1.05

公式错误预防

  • 验证所有单元格引用是否正确
  • 检查范围中的差一错误
  • 确保所有预测期间的公式一致
  • 使用边缘情况测试(零值、负数)
  • 验证没有意外的循环引用

硬编码的文档化要求

  • 在单元格旁边(如果位于表格末尾)注释。格式:“来源:[系统/文档],[日期],[具体引用],[网址(如适用)]”
  • 示例:
    • “来源:公司10-K年报,2024财年,第45页,收入附注,[SEC EDGAR网址]”
    • “来源:公司10-Q季报,2025年第二季度,附件99.1,[SEC EDGAR网址]”
    • “来源:彭博终端,2025年8月15日,AAPL US Equity”
    • “来源:FactSet,2025年8月20日,共识预期屏幕”

XLSX创建、编辑与分析

概述

用户可能要求您创建、编辑或分析.xlsx文件的内容。您可针对不同任务使用不同的工具和工作流。

重要要求

重新计算公式需要LibreOffice:可以假定已安装LibreOffice,用于使用recalc.py脚本重新计算公式值。该脚本在首次运行时自动配置LibreOffice。

读取和分析数据

使用pandas进行数据分析

对于数据分析、可视化和基本操作,使用pandas,它提供强大的数据处理能力:

import pandas as pd

# 读取Excel文件
df = pd.read_excel('file.xlsx')  # 默认:第一个工作表
all_sheets = pd.read_excel('file.xlsx', sheet_name=None)  # 所有工作表作为字典

# 分析
df.head()      # 预览数据
df.info()      # 列信息
df.describe()  # 统计信息

# 写入Excel文件
df.to_excel('output.xlsx', index=False)

Excel文件工作流

关键:使用公式,而非硬编码值

始终使用Excel公式,而非在Python中计算值然后硬编码。 这确保了电子表格保持动态和可更新。

❌ 错误做法——硬编码计算值

# 错误:在Python中计算并硬编码结果
total = df['Sales'].sum()
sheet['B10'] = total  # 硬编码5000

# 错误:在Python中计算增长率
growth = (df.iloc[-1]['Revenue'] - df.iloc[0]['Revenue']) / df.iloc[0]['Revenue']
sheet['C5'] = growth  # 硬编码0.15

# 错误:Python计算平均值
avg = sum(values) / len(values)
sheet['D20'] = avg  # 硬编码42.5

✅ 正确做法——使用Excel公式

# 正确:让Excel计算总和
sheet['B10'] = '=SUM(B2:B9)'

# 正确:增长率作为Excel公式
sheet['C5'] = '=(C4-C2)/C2'

# 正确:使用Excel函数计算平均值
sheet['D20'] = '=AVERAGE(D2:D19)'

这适用于所有计算——总计、百分比、比率、差异等。电子表格应能在源数据更改时重新计算。

通用工作流

  1. 选择工具:数据分析用pandas,公式/格式用openpyxl
  2. 创建/加载:创建新工作簿或加载现有文件
  3. 修改:添加/编辑数据、公式和格式
  4. 保存:写入文件
  5. 重新计算公式(如果使用公式,则强制要求):使用recalc.py脚本
    python recalc.py output.xlsx
    
  6. 验证并修复任何错误:
    • 脚本返回包含错误详情的JSON
    • 如果status为errors_found,检查error_summary了解具体错误类型和位置
    • 修复已识别的错误并再次重新计算
    • 要修复的常见错误:
      • #REF!:无效的单元格引用
      • #DIV/0!:除以零
      • #VALUE!:公式中数据类型错误
      • #NAME?:无法识别的公式名称

创建新的Excel文件

# 使用openpyxl处理公式和格式
from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill, Alignment

wb = Workbook()
sheet = wb.active

# 添加数据
sheet['A1'] = 'Hello'
sheet['B1'] = 'World'
sheet.append(['Row', 'of', 'data'])

# 添加公式
sheet['B2'] = '=SUM(A1:A10)'

# 格式化
sheet['A1'].font = Font(bold=True, color='FF0000')
sheet['A1'].fill = PatternFill('solid', start_color='FFFF00')
sheet['A1'].alignment = Alignment(horizontal='center')

# 列宽
sheet.column_dimensions['A'].width = 20

wb.save('output.xlsx')

编辑现有的Excel文件

# 使用openpyxl保留公式和格式
from openpyxl import load_workbook

# 加载现有文件
wb = load_workbook('existing.xlsx')
sheet = wb.active  # 或 wb['SheetName'] 用于特定工作表

# 处理多个工作表
for sheet_name in wb.sheetnames:
    sheet = wb[sheet_name]
    print(f"工作表:{sheet_name}")

# 修改单元格
sheet['A1'] = 'New Value'
sheet.insert_rows(2)  # 在第2行位置插入行
sheet.delete_cols(3)  # 删除第3列

# 添加新工作表
new_sheet = wb.create_sheet('NewSheet')
new_sheet['A1'] = 'Data'

wb.save('modified.xlsx')

重新计算公式

由openpyxl创建或修改的Excel文件将公式保存为字符串,但未计算值。使用提供的recalc.py脚本重新计算公式:

python recalc.py <excel_file> [timeout_seconds]

示例:

python recalc.py output.xlsx 30

该脚本:

  • 首次运行时自动设置LibreOffice宏
  • 重新计算所有工作表中的所有公式
  • 扫描所有单元格中的Excel错误(#REF!、#DIV/0!等)
  • 返回包含详细错误位置和计数的JSON
  • 适用于Linux和macOS

公式验证检查清单

确保公式正确运行的快速检查:

基本验证

  • 测试2-3个示例引用:在构建完整模型前,验证它们提取正确的值
  • 列映射:确认Excel列匹配(例如,第64列 = BL,而非BK)
  • 行偏移:记住Excel行从1开始索引(DataFrame第5行 = Excel第6行)

常见陷阱

  • NaN处理:使用pd.notna()检查空值
  • 右侧列:财年数据通常位于第50+列
  • 多个匹配:搜索所有出现,而不仅仅是第一个
  • 除以零:在公式中使用/之前检查分母(#DIV/0!)
  • 错误引用:验证所有单元格引用指向预期单元格(#REF!)
  • 跨工作表引用:使用正确格式(Sheet1!A1)链接工作表

公式测试策略

  • 从小处着手:在广泛应用之前,先在2-3个单元格上测试公式
  • 验证依赖项:检查公式中引用的所有单元格是否存在
  • 测试边缘情况:包括零值、负数和非常大的值

解读recalc.py的输出

该脚本返回包含错误详情的JSON:

{
  "status": "success",           // 或 "errors_found"
  "total_errors": 0,              // 总错误数
  "total_formulas": 42,           // 文件中的公式数量
  "error_summary": {              // 仅在发现错误时存在
    "#REF!": {
      "count": 2,
      "locations": ["Sheet1!B5", "Sheet1!C10"]
    }
  }
}

最佳实践

库的选择

  • pandas:最适合数据分析、批量操作和简单数据导出
  • openpyxl:最适合复杂格式、公式和Excel特定功能

使用openpyxl

  • 单元格索引从1开始(row=1, column=1 表示单元格 A1)
  • 使用 data_only=True 读取计算值:load_workbook('file.xlsx', data_only=True)
  • 警告:如果以 data_only=True 打开并保存,公式将被替换为值并永久丢失
  • 对于大文件:使用 read_only=True 读取或 write_only=True 写入
  • 公式会被保留但不计算——使用 recalc.py 更新值

使用pandas

  • 指定数据类型以避免推断问题:pd.read_excel('file.xlsx', dtype={'id': str})
  • 对于大文件,读取特定列:pd.read_excel('file.xlsx', usecols=['A', 'C', 'E'])
  • 正确处理日期:pd.read_excel('file.xlsx', parse_dates=['date_column'])

代码风格指南

重要:在生成用于Excel操作的Python代码时:

  • 编写简洁、精炼的Python代码,避免不必要的注释
  • 避免冗长的变量名和冗余操作
  • 避免不必要的print语句

对于Excel文件本身:

  • 为包含复杂公式或重要假设的单元格添加注释
  • 为硬编码值记录数据来源
  • 包含关键计算和模型部分的注释

Individual skills in this repo

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

David-Li0406/meta-skill-evloving

Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.

David-Li0406/meta-skill-evloving

Create technical diagrams using Mermaid syntax for architecture, sequences, ERDs, flowcharts, and state machines. Use for visualizing system design, data flows, and processes. Triggers: diagram, mermaid, architecture diagram, sequence diagram, flowchart, ERD, entity relationship, state diagram, C4 model, component diagram, visualize, draw.

David-Li0406/meta-skill-evloving

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

David-Li0406/meta-skill-evloving

Complete color manipulation and green screen effects system. PROACTIVELY activate for: (1) Green screen/chromakey removal, (2) Color grading with LUTs, (3) Color correction (levels, curves, white balance), (4) Colorkey/color removal effects, (5) Hue/saturation manipulation, (6) Color space conversions (BT.709, BT.2020, HDR), (7) Color isolation effects, (8) Teal and orange look, (9) Vintage/film looks, (10) Color keying for transparency. Provides: chromakey and colorkey filters, LUT application (lut3d), curves and levels adjustment, color balance, selective color manipulation, color space handling, HDR tone mapping, professional color grading chains.

David-Li0406/meta-skill-evloving

Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.

David-Li0406/meta-skill-evloving

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

David-Li0406/meta-skill-evloving

Build with OpenAI's stateless APIs - Chat Completions (GPT-5, GPT-4o), Embeddings, Images (DALL-E 3), Audio (Whisper + TTS), and Moderation. Includes Node.js SDK and fetch-based approaches for Cloudflare Workers. Use when: implementing chat completions with GPT-5/GPT-4o, streaming responses with SSE, using function calling/tools, creating structured outputs with JSON schemas, generating embeddings for RAG (text-embedding-3-small/large), generating images with DALL-E 3, editing images with GPT-Image-1, transcribing audio with Whisper, synthesizing speech with TTS (11 voices), moderating content (11 safety categories), or troubleshooting rate limits (429), invalid API keys (401), function calling failures, streaming parse errors, embeddings dimension mismatches, or token limit exceeded.

David-Li0406/meta-skill-evloving

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

David-Li0406/meta-skill-evloving

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

David-Li0406/meta-skill-evloving

Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.

David-Li0406/meta-skill-evloving

Best practices for Remotion - Video creation in React

David-Li0406/meta-skill-evloving

Provides bidirectional translation (Chinese/English), grammar checking, and sentence polishing. Supports specific tense constraints, context-aware tone adjustment, and natural expression optimization. Outputs direct text without formatting.

David-Li0406/meta-skill-evloving

指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。

David-Li0406/meta-skill-evloving

生成Python脚本,利用FFmpeg将图片序列按3x3布局合并,或将合并图拆分。要求使用subprocess模块执行命令,并支持用户交互式输入路径。

David-Li0406/meta-skill-evloving

SOP for extracting and analyzing promotional activity details, handling time formatting, location mapping, payment logic, and step-by-step process validation.

David-Li0406/meta-skill-evloving

Specializes in creating TikTok short video scripts using an anthropomorphic 'Chef' perspective to explain wildlife food chains and survival environments, utilizing real field footage.

David-Li0406/meta-skill-evloving

针对TikTok平台,以拟人化视角(如动物作为厨师)创作系列短视频脚本。重点介绍野生动物、食物链及生态环境,要求使用野外实拍素材,风格幽默且具有教育意义。

David-Li0406/meta-skill-evloving

Generates KWL (Know, Want to know, Learned) charts for educational videos, specifically BrainPOP, using simple 7th-grade language and short, concise bullet points.

David-Li0406/meta-skill-evloving

Develops DAX measures to calculate promo and regular volumes and generates a calculated table of dates excluding continuous promo date ranges, handling multiple periods and nulls.

David-Li0406/meta-skill-evloving

Tracks complex, multi-session work using the Beads issue tracker and dependency graphs, and provides persistent memory that survives conversation compaction. Use when work spans multiple sessions, has complex dependencies, or needs persistent context across compaction cycles. Trigger with phrases like "create task for", "what's ready to work on", "show task", "track this work", "what's blocking", or "update status".

相关技能