skills/xlsx/SKILL.md
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.
npx skillsauth add aifinlab/finclaw xlsxInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Unless otherwise stated by the user or existing template
A user may ask you to create, edit, or analyze the contents of an .xlsx file. You have different tools and workflows available for different tasks.
LibreOffice Required for Formula Recalculation: You can assume LibreOffice is installed for recalculating formula values using the scripts/recalc.py script. The script automatically configures LibreOffice on first run, including in sandboxed environments where Unix sockets are restricted (handled by scripts/office/soffice.py)
For data analysis, visualization, and basic operations, use pandas which provides powerful data manipulation capabilities:
import pandas as pd
# Read Excel
df = pd.read_excel('file.xlsx') # Default: first sheet
all_sheets = pd.read_excel('file.xlsx', sheet_name=None) # All sheets as dict
# Analyze
df.head() # Preview data
df.info() # Column info
df.describe() # Statistics
# Write Excel
df.to_excel('output.xlsx', index=False)
Always use Excel formulas instead of calculating values in Python and hardcoding them. This ensures the spreadsheet remains dynamic and updateable.
# Bad: Calculating in Python and hardcoding result
total = df['Sales'].sum()
sheet['B10'] = total # Hardcodes 5000
# Bad: Computing growth rate in Python
growth = (df.iloc[-1]['Revenue'] - df.iloc[0]['Revenue']) / df.iloc[0]['Revenue']
sheet['C5'] = growth # Hardcodes 0.15
# Bad: Python calculation for average
avg = sum(values) / len(values)
sheet['D20'] = avg # Hardcodes 42.5
# Good: Let Excel calculate the sum
sheet['B10'] = '=SUM(B2:B9)'
# Good: Growth rate as Excel formula
sheet['C5'] = '=(C4-C2)/C2'
# Good: Average using Excel function
sheet['D20'] = '=AVERAGE(D2:D19)'
This applies to ALL calculations - totals, percentages, ratios, differences, etc. The spreadsheet should be able to recalculate when source data changes.
python scripts/recalc.py output.xlsx
status is errors_found, check error_summary for specific error types and locations#REF!: Invalid cell references#DIV/0!: Division by zero#VALUE!: Wrong data type in formula#NAME?: Unrecognized formula name# Using openpyxl for formulas and formatting
from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill, Alignment
wb = Workbook()
sheet = wb.active
# Add data
sheet['A1'] = 'Hello'
sheet['B1'] = 'World'
sheet.append(['Row', 'of', 'data'])
# Add formula
sheet['B2'] = '=SUM(A1:A10)'
# Formatting
sheet['A1'].font = Font(bold=True, color='FF0000')
sheet['A1'].fill = PatternFill('solid', start_color='FFFF00')
sheet['A1'].alignment = Alignment(horizontal='center')
# Column width
sheet.column_dimensions['A'].width = 20
wb.save('output.xlsx')
# Using openpyxl to preserve formulas and formatting
from openpyxl import load_workbook
# Load existing file
wb = load_workbook('existing.xlsx')
sheet = wb.active # or wb['SheetName'] for specific sheet
# Working with multiple sheets
for sheet_name in wb.sheetnames:
sheet = wb[sheet_name]
print(f"Sheet: {sheet_name}")
# Modify cells
sheet['A1'] = 'New Value'
sheet.insert_rows(2) # Insert row at position 2
sheet.delete_cols(3) # Delete column 3
# Add new sheet
new_sheet = wb.create_sheet('NewSheet')
new_sheet['A1'] = 'Data'
wb.save('modified.xlsx')
Excel files created or modified by openpyxl contain formulas as strings but not calculated values. Use the provided scripts/recalc.py script to recalculate formulas:
python scripts/recalc.py <excel_file> [timeout_seconds]
Example:
python scripts/recalc.py output.xlsx 30
The script:
Quick checks to ensure formulas work correctly:
pd.notna()/ in formulas (#DIV/0!)The script returns JSON with error details:
{
"status": "success", // or "errors_found"
"total_errors": 0, // Total error count
"total_formulas": 42, // Number of formulas in file
"error_summary": { // Only present if errors found
"#REF!": {
"count": 2,
"locations": ["Sheet1!B5", "Sheet1!C10"]
}
}
}
data_only=True to read calculated values: load_workbook('file.xlsx', data_only=True)data_only=True and saved, formulas are replaced with values and permanently lostread_only=True for reading or write_only=True for writingpd.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'])IMPORTANT: When generating Python code for Excel operations:
For Excel files themselves:
development
# trust-valuation-engine ## 描述 信托资产估值引擎,支持非标债权估值、股权估值、净值计算、减值测试。 ## 功能 - 非标债权估值(现金流折现法) - 股权估值(市场法/收益法/资产基础法) - 净值计算与发布 - 减值测试与拨备 - 估值模型管理 ## 许可证 MIT License
development
# trust-risk-manager ## 描述 信托风险全流程管理工具,覆盖信用风险、市场风险、流动性风险、操作风险四大维度,提供实时监控、预警提示和风险处置建议。 ## 功能 - 信用风险评估(融资主体、担保措施、偿债能力) - 市场风险监控(利率、汇率、商品价格敏感性) - 流动性风险分析(期限错配、赎回压力、变现能力) - 操作风险检查(流程合规、系统安全) - 风险预警指标(VaR、CVaR、压力测试) - 风险限额管理(集中度、久期、杠杆) - 风险报告生成 ## 使用场景 - 风控部门日常监控 - 投后管理风险排查 - 新产品风险评审 - 监管报送数据准备 - 风险预警处置 ## 输入输出 ### 输入 ```json { "portfolio_id": "", "risk_type": "all|credit|market|liquidity|operation", "assets": [ { "asset_id": "", "asset_type": "非标债权|股票|债券|基金", "exposu
development
# trust-product-analyzer ## 描述 信托产品综合分析与筛选工具,支持产品信息抓取、风险评级、收益测算、合规检查和竞品对比。 ## 功能 - 信托产品信息智能抓取与解析(支持用益信托网、中国信托登记等平台) - 多维度风险评估(信用风险、市场风险、流动性风险) - 预期收益与实际收益对比分析 - 合格投资者适当性匹配 - 产品竞品横向对比 - 自动生成尽调报告 ## 使用场景 - 理财师为客户筛选合适信托产品 - 投资经理进行竞品分析 - 风控部门审查产品合规性 - 研究人员追踪市场产品发行情况 ## 输入输出 ### 输入 ```json { "action": "analyze|compare|screen", "product_code": "", "product_name": "", "filters": { "min_yield": 6.5, "max_duration": 24, "risk_level": ["R2", "R3"], "trust_type": "集合信托", "i
development
# trust-post-investment-monitor ## 描述 信托投后监控工具,提供预警指标追踪、风险事件监测、处置建议生成、定期报告输出。 ## 功能 - 融资主体监控(经营/财务/舆情) - 担保物监控(价值/权属/流动性) - 预警阈值管理 - 风险事件响应 - 处置方案建议 - 定期监控报告 ## 许可证 MIT License