$npx -y skills add stvlynn/dingtalk-wukong-skills --skill xlsxComprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Read
| 1 | # Excel电子表格处理专家 Real Skill |
| 2 | |
| 3 | ## 一句话说明 |
| 4 | |
| 5 | 专业的 Excel 处理工具,强制零公式错误标准,支持数据分析、报表生成和财务建模。 |
| 6 | |
| 7 | **Excel Spreadsheet Mastery** - Zero-error formula standard, data analysis, automated reporting, financial modeling with color coding. |
| 8 | |
| 9 | --- |
| 10 | |
| 11 | ## 使用场景 |
| 12 | |
| 13 | **适用**: |
| 14 | - 数据分析和统计报告 |
| 15 | - 自动化生成 Excel 报表 |
| 16 | - 财务预测模型(色彩编码) |
| 17 | - 批量处理多个 Excel 文件 |
| 18 | - 数据清洗和格式转换 |
| 19 | |
| 20 | **不适用**: |
| 21 | - 实时协同编辑(用 Google Sheets / use Google Sheets for real-time collaboration) |
| 22 | - 复杂宏操作(用 VBA / use VBA for complex macros) |
| 23 | |
| 24 | --- |
| 25 | |
| 26 | ## 核心流程 |
| 27 | |
| 28 | ``` |
| 29 | 用户需求 → 判断任务类型 → 选择工具 → 执行操作 → 公式重算 → 验证输出 |
| 30 | User request → Task classification → Tool selection → Execute → Recalc formulas → Validate |
| 31 | ``` |
| 32 | |
| 33 | **任务类型判断 (Task Classification)**: |
| 34 | |
| 35 | ### Data Analysis (数据分析) |
| 36 | - **Simple analysis** → pandas (read, analyze, visualize) |
| 37 | - **Statistical reports** → pandas + matplotlib/seaborn |
| 38 | - **Data cleaning** → pandas transformations |
| 39 | |
| 40 | ### Spreadsheet Creation (创建电子表格) |
| 41 | - **With formulas** → openpyxl + recalc.py (MANDATORY) |
| 42 | - **Without formulas** → pandas (faster) |
| 43 | - **Financial models** → openpyxl + color coding + recalc.py |
| 44 | |
| 45 | ### Editing Existing (编辑已有文件) |
| 46 | - **Data updates** → openpyxl (preserves formulas) |
| 47 | - **Template modifications** → Match existing format EXACTLY |
| 48 | |
| 49 | ⚠️ **CRITICAL**: After using formulas, MUST run `python scripts/recalc.py output.xlsx` |
| 50 | |
| 51 | --- |
| 52 | |
| 53 | ## 任务完成标准 |
| 54 | |
| 55 | **必须满足**(缺一不可): |
| 56 | - ✅ **零公式错误 (Zero Formula Errors)**(#REF!, #DIV/0!, #VALUE!, #N/A, #NAME? = 0) |
| 57 | - Excel 文件可正常打开 |
| 58 | - 数据完整准确 |
| 59 | - 格式规范(数字格式、对齐、边框) |
| 60 | - 财务模型使用行业标准色彩编码(如适用) |
| 61 | |
| 62 | **质量评级**: |
| 63 | - ⭐⭐⭐⭐⭐ 优秀 - 零错误 + 色彩编码 + 完整文档 |
| 64 | - ⭐⭐⭐ 及格 - 零错误 + 数据正确 |
| 65 | - ⭐ 失败 - 存在公式错误 |
| 66 | |
| 67 | --- |
| 68 | |
| 69 | ## 参考资料(供 AI 使用) |
| 70 | |
| 71 | | 类型 | 路径 | 说明 | |
| 72 | |-----|------|------| |
| 73 | | 核心文档 | `docs/00-SKILL-完整操作指南.md` | Complete Excel processing guide (~300 lines) | |
| 74 | | 工具脚本 | `scripts/recalc.py` | Formula recalculation script (requires LibreOffice) | |
| 75 | |
| 76 | --- |
| 77 | |
| 78 | ## 关键原则(AI 必读 / Critical Principles) |
| 79 | |
| 80 | ### 1. ⚠️ Zero Formula Errors (零公式错误原则 - MANDATORY) |
| 81 | **Every Excel file MUST be delivered with ZERO formula errors**: |
| 82 | - No #REF! (invalid references) |
| 83 | - No #DIV/0! (division by zero) |
| 84 | - No #VALUE! (wrong data type) |
| 85 | - No #N/A (lookup not found) |
| 86 | - No #NAME? (unrecognized formula name) |
| 87 | |
| 88 | **Verification workflow**: |
| 89 | ```bash |
| 90 | python scripts/recalc.py output.xlsx |
| 91 | # Check JSON output: status should be "success" |
| 92 | # If "errors_found", fix and recalculate |
| 93 | ``` |
| 94 | |
| 95 | ### 2. Use Formulas, Not Hardcoded Values (使用公式而非硬编码) |
| 96 | **CRITICAL**: Always use Excel formulas instead of calculating in Python. |
| 97 | |
| 98 | ❌ **WRONG - Hardcoding**: |
| 99 | ```python |
| 100 | total = df['Sales'].sum() |
| 101 | sheet['B10'] = total # Hardcodes 5000 |
| 102 | ``` |
| 103 | |
| 104 | ✅ **CORRECT - Using Formulas**: |
| 105 | ```python |
| 106 | sheet['B10'] = '=SUM(B2:B9)' # Dynamic formula |
| 107 | ``` |
| 108 | |
| 109 | **Why**: Spreadsheet remains dynamic and updateable when source data changes. |
| 110 | |
| 111 | ### 3. Financial Modeling Color Coding (财务建模色彩编码) |
| 112 | **Industry-standard color conventions** (unless user specifies otherwise): |
| 113 | |
| 114 | ```python |
| 115 | from openpyxl.styles import Font |
| 116 | |
| 117 | # Blue text (0000FF): User inputs and assumptions |
| 118 | ws['A1'].font = Font(color='0000FF') |
| 119 | |
| 120 | # Black text (000000): ALL formulas and calculations |
| 121 | ws['B1'].font = Font(color='000000') |
| 122 | |
| 123 | # Green text (008000): Links within same workbook |
| 124 | ws['C1'].font = Font(color='008000') |
| 125 | |
| 126 | # Red text (FF0000): External file links |
| 127 | ws['D1'].font = Font(color='FF0000') |
| 128 | |
| 129 | # Yellow background (FFFF00): Key assumptions |
| 130 | from openpyxl.styles import PatternFill |
| 131 | ws['E1'].fill = PatternFill(start_color='FFFF00', fill_type='solid') |
| 132 | ``` |
| 133 | |
| 134 | ### 4. Number Formatting Standards (数字格式标准) |
| 135 | ```python |
| 136 | from openpyxl.styles import numbers |
| 137 | |
| 138 | # Years: Format as text strings "2024" (not numbers) |
| 139 | ws['A1'].number_format = '@' # Text format |
| 140 | ws['A1'] = "'2024" # Force text |
| 141 | |
| 142 | # Currency: $#,##0 + specify units in header |
| 143 | ws['B1'].number_format = '$#,##0' |
| 144 | |
| 145 | # Zeros: Format as "-" |
| 146 | ws['C1'].number_format = '$#,##0;($#,##0);"-"' |
| 147 | |
| 148 | # Percentages: 0.0% (one decimal) |
| 149 | ws['D1'].number_format = '0.0%' |
| 150 | |
| 151 | # Multiples: 0.0x for valuation multiples |
| 152 | ws['E1'].number_format = '0.0"x"' |
| 153 | |
| 154 | # Negative numbers: Use parentheses (123) not minus -123 |
| 155 | ws['F1'].number_format = '#,##0;(#,##0)' |
| 156 | ``` |
| 157 | |
| 158 | ### 5. Preserve Existing Templates (保留现有模板) |
| 159 | When modifying existing files: |
| 160 | - Study and EXACTLY match existing format, style, conventions |
| 161 | - Never impose standardized formatting on files with established patterns |
| 162 | - Existing template conventions ALWAYS override these guidelines |
| 163 | |
| 164 | --- |
| 165 | |
| 166 | ## 快速命令参考 (Quick Commands) |
| 167 | |
| 168 | ### Data Analysis with Pandas (数据分析) |
| 169 | ```python |
| 170 | import pandas as pd |
| 171 | |
| 172 | # Read Excel (single sheet or all) |
| 173 | df = pd.read_excel('file.xlsx') # First sheet |
| 174 | all_sheets = pd.read_excel('file.xlsx', sheet_name=None) # All sheets as dict |