Communitygithub.com

David-Li0406/meta-skill-evloving

全面的試算表建立、編輯與分析技能,支援公式、格式設定、資料分析與視覺化。當 Claude 需要處理試算表(.xlsx, .xlsm, .csv, .tsv 等)以進行建立新試算表、讀取或分析資料、修改現有試算表並保留公式、資料分析與視覺化,或重新計算公式時使用。

meta-skill-evloving 是什麼?

此技能為 AI 代理(如 Claude Code 或 Cursor)提供處理試算表的專業能力,核心目標是建立動態、可更新的試算表,並徹底避免硬編碼數值。它強制要求在 Python 程式碼中使用 Excel 公式(例如 `=SUM(B2:B9)`)來取代直接寫入計算結果,確保試算表能隨來源資料變動而自動更新。技能支援 pandas 進行資料分析與 openpyxl 處理複雜的格式設定和公式操作,並提供 `recalc.py` 腳本(依賴 LibreOffice)來重新計算所有公式值並掃描錯誤(如 #REF!、#DIV/0!),同時也涵蓋產業標準的色彩編碼(例如藍色代表輸入值、黑色代表公式)與數字格式規則。

相容平台✓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

公式錯誤預防

  • 驗證所有儲存格參照是否正確
  • 檢查範圍是否有差一錯誤
  • 確保所有預測期間的公式一致
  • 使用邊界案例測試(零值、負數)
  • 驗證無意外的循環參照

硬編碼值的文件要求

  • 在儲存格旁註解(若位於表格末端)。格式:「來源:[系統/文件],[日期],[特定參考],[URL(如適用)]」
  • 範例:
    • 「來源:公司 10-K, FY2024, 第 45 頁, 營收備註, [SEC EDGAR URL]」
    • 「來源:公司 10-Q, 2025 年第二季, 附件 99.1, [SEC EDGAR URL]」
    • 「來源:Bloomberg Terminal, 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: {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() 檢查空值
  • 最右側欄位:FY 資料通常位於第 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".

相關技能