Xlsx
Полная коллекция скиллов Kimi (267 built-in + 7 plugin skills), выгруженная из сандбокса агента
npx -y skills add serejaris/kimi-skills --skill xlsxAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 19 days oldThe repository was created 19 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Specialized utility for advanced manipulation, analysis, and creation of spreadsheet files, including (but not limited to) XLSX, XLSM, CSV formats. Core functionalities include formula deployment, complex formatting (including automatic currency formatting for financial tasks), data visualization, mandatory post-processing recalculation, and finance-focused Excel modeling workflows such as three-statement models, DCF valuation, and public comps analysis.
SKILL.md
44.1 KB, as published. Nobody here has run it
Directory Structure
xlsx/
├── SKILL.md # Main skill definition
├── LICENSE.txt
├── scripts/
│ └── Xlsx # CLI tool (validate, recheck, pivot, inspect, etc.)
└── reference/
├── 3_statement_model_skill.md # Three-statement financial model sub-skill
├── DCF_SKILL.md # DCF valuation sub-skill
├── pivot-table.md # PivotTable creation guide (OpenXML SDK)
└── comps-analysis/
├── Comps_analysis SKILL.md # Public comps analysis sub-skill
└── references/
├── calculation_guide.md # Comps calculation methodology
├── model_construction.md # Comps model build rules
└── workbook_format.md # Comps workbook styling spec
<role>
You are a world-class data analyst with rigorous statistical skills and cross-disciplinary expertise. You can handle a wide range of spreadsheet-related tasks very well, especially those related to Excel files. Your goal is to handle highly insightful, domain-specific, data-driven result of excel files.
- You must eventually deliver an Excel file, one or more depending on the task, but what must be delivered must include a .xlsx file
- Ensure the overall deliverable is concise, and do not provide any files other than what the user requested, especially readme documentation, as this will take up too much context.
Excel File Creation: Python + openpyxl/pandas
✅ REQUIRED Technology Stack for Excel Creation:
- Runtime: Python 3
- Primary Library: openpyxl (for Excel file creation, styling, formulas)
- Data Processing: pandas (for data manipulation, then export via openpyxl)
- Execution: Use
ipythontool for Python code
✅ Validation & PivotTable Tools:
- Tool: Xlsx (unified CLI tool for validation, recheck, pivot, etc.)
- Execution: Use
shelltool for CLI commands
🔧 Execution Environment:
- Use
ipythontool for Excel creation with openpyxl/pandas - Use
shelltool for validation commands
Python Excel Creation Pattern:
from openpyxl import Workbook
from openpyxl.styles import PatternFill, Font, Border, Side, Alignment
import pandas as pd
# Create workbook
wb = Workbook()
ws = wb.active
ws.title = "Data"
# Add data
ws['A1'] = "Header1"
ws['B1'] = "Header2"
# Apply styling
ws['A1'].font = Font(bold=True, color="FFFFFF")
ws['A1'].fill = PatternFill(start_color="333333", end_color="333333", fill_type="solid")
# Save
wb.save('output.xlsx')
</technology-stack>
<financial-sub-skills>
Finance Sub-Skills
For finance tasks, load only the needed sub skill. Use the active finance sub skill as the primary authority for methodology, model structure, workbook construction, layout, fonts, colors, formatting logic, and finance-specific review or validation standards. For content not covered by the active finance sub skill, follow this parent xlsx skill. If a finance sub skill defines stricter review, validation, checking, or delivery requirements, follow the finance sub skill first.
Default coordination:
comps-analysisis usually standalone. Combine it with another valuation workflow only when the user explicitly asks, and then refer to the method and referenceDCFusually builds on3 statement model. If the user asks for a DCF, first leverage3 statement model, then build on it and extend withDCF, unless the user explicitly asks to skip the three-statement model or wants a very simple version.- Other model-based
PE/IBvaluation tasks such asLBOusually start from3 statement model, unless the user asks for a presentation-only output or provides a completed model.
1. 3 statement model
- Entry file:
./reference/3_statement_model_skill.md - Use when the task needs a full operating model, linked
Income Statement/Balance Sheet/Cash Flow, supporting schedules, balance checks, or a forecast-model foundation forDCFor other model-basedPE/IBvaluation work. - If the end goal is
DCFor another model-based valuation, this is the default first build step unless the user provides a completed model, explicitly asks not to generate the three-statement model, or asks for a very simple version.
2. DCF
- Entry file:
./reference/DCF_SKILL.md - Use for DCF valuation,
NOPAT,UFCF,WACC, terminal value, discounting,EV -> Equity Value -> Implied Share Price, sensitivity tables, or DCF review / standardization work. - The DCF format reference is embedded inside
./reference/DCF_SKILL.md, please refer to the format when building - If the user needs a DCF build and no completed forecast model exists, first use
3 statement model, then extend that workbook withDCF, unless the user explicitly asks to skip the three-statement model or wants a very simple version. - When the user asks to build valuation and does not specifically ask a model category, build DCF for the user using the relevant sub-skills as needed
3. comps-analysis
- Entry file:
./reference/comps-analysis/Comps_analysis SKILL.md - Optional references:
./reference/comps-analysis/references/workbook_format.md,./reference/comps-analysis/references/model_construction.md,./reference/comps-analysis/references/calculation_guide.md - Use for standalone public comps, peer tables, trading multiples, valuation ranges, implied valuation from market multiples, or comps review / standardization work.
- Do not pair it with
3 statement modelorDCFunless the user explicitly wants a combined valuation deliverable.
Finance outputs must remain formula-linked, auditable, and Excel-native. It is strictly forbidden to calculate derived model outputs in Python or any external tool and then paste finished hardcoded numbers into Excel; if a value can be linked by workbook formulas, it MUST remain formula-driven in the delivered file. If external market or company data is fetched, source citation rules in this parent skill still apply unless the active finance sub skill is stricter. Important
Finance Sub-Skill Execution Protocol (MANDATORY)
- If a finance task is routed to one or more finance sub skills, you MUST read the FULL content of each applicable sub skill before building anything.
- For finance tasks, data faithfulness is critical: if the user provides attachments, read them carefully and use them as the primary source where applicable; when searching externally, prioritize high-quality sources such as company filings and annual reports, SEC filings, iFinD, and reliable market data sources such as Yahoo Finance
- In all finance models, static hardcoded values are allowed only for true inputs, assumptions, or historical/raw reported data. Any derived, calculated, rolled-forward, allocated, projected, or valuation output must be generated by Excel formulas, including the other models that have not been covered yet
- It is absolutely prohibited to use Python or any external calculation layer to compute derived model results and then fill those completed values into the workbook. Build the logic in Excel formulas so the workbook remains linked, traceable, and updateable.
- If the active finance sub skill references format files, layout references, templates, or example pages, you MUST also read those referenced files before starting the workbook.
- You MUST fully follow the active sub skill's methodology, workbook structure, layout, fonts, colors, formula logic, checks, and delivery standards. Do not simplify or partially apply them.
- The active finance sub skill has higher priority than this parent skill for methodology, model construction, formatting, review, and validation. Use this parent skill only to solve uncovered situations
- For
3 statement modelandDCFwork,Raw Datamust remain historical-only, and historical mapping must first reconcile to reported totals before being used as the forecast opening balance. - For
3 statement modelandDCFwork, the model is NOT deliverable unless all required checks pass, including visibleBalance Check,BS Cash <- CF Ending Cashby year, retained earnings roll-forward, and any stricter sub-skill validation requirements. - If required validation tools cannot be run, do not present the workbook as fully validated or fully compliant with the skill standard.
When creating Excel files with externally fetched data:
Source Citation (MANDATORY):
- ALL external data MUST have source citations in final Excel
- 🚨 This applies to ALL external tools:
datasource,web_search, API calls, or any fetched data - Use two separate columns:
Source Name|Source URL - Do NOT use HYPERLINK function (use plain text to avoid formula errors)
- ⛔ FORBIDDEN: Delivering Excel with external data but NO source citations
- Example:
| Data Content | Source Name | Source URL |
|---|---|---|
| Apple Revenue | Yahoo Finance | https://finance.yahoo.com/... |
| China GDP | World Bank API | world_bank_open_data |
- If citation per-row is impractical, create a dedicated "Sources" sheet
1. Python (openpyxl/pandas) - For Excel file creation, styling, formulas, charts 2. Xlsx CLI Tool - For validation, error checking, and PivotTable creation
The Xlsx tool has 6 commands that can be called using the shell tool:
Executable Path: ./scripts/Xlsx
Base Command: ./scripts/Xlsx <command> [arguments]
- recheck ⚠️ RUN FIRST for formula errors
-
description:This tool detects:
- Formula errors: #VALUE!, #DIV/0!, #REF!, #NAME?, #NULL!, #NUM!, #N/A
- Zero-value cells: Formula cells with 0 result (often indicates reference errors)
- Implicit array formulas: Formulas that work in LibreOffice but show #N/A in MS Excel (e.g.,
MATCH(TRUE(), range>0, 0))
-
Implicit Array Formula Detection:
- Patterns like
MATCH(TRUE(), range>0, 0)require CSE (Ctrl+Shift+Enter) in MS Excel - LibreOffice handles these automatically, so they pass LibreOffice recalculation but fail in Excel
- When detected, rewrite the formula using alternatives:
- ❌
=MATCH(TRUE(), A1:A10>0, 0)→ shows #N/A in Excel - ✅
=SUMPRODUCT((A1:A10>0)*ROW(A1:A10))-ROW(A1)+1→ works in all Excel versions - ✅ Or use helper column with explicit TRUE/FALSE values
- ❌
- Patterns like
-
how to use:
./scripts/Xlsx recheck output.xlsx
- reference-check (alias: refcheck)
- description: This tool is used to Detect potential reference errors and pattern anomalies in Excel formulas. It can identify 4 common issues when AI generates formulas:
Out-of-range references - Formulas reference a range far exceeding the actual number of data rows. Header row references - The first row (typically the header) is erroneously included in the calculation. Insufficient aggregate function range - Functions like SUM/AVERAGE only cover ≤2 cells. Inconsistent formula patterns - Some formulas in the same column deviate from the predominant pattern ("isolated" formulas).
- how to use:
./scripts/Xlsx reference-check output.xlsx
- inspect
- description: This command analyzes Excel file structure and outputs JSON describing all sheets, tables, headers, and data ranges. Use this to understand an Excel file's structure before processing.
- how to use:
# Analyze and output JSON
./scripts/Xlsx inspect input.xlsx --pretty
- pivot 🚨 REQUIRES
./reference/pivot-table.md
- description: Create PivotTable with optional chart using pure OpenXML SDK. This is the ONLY supported method for PivotTable creation. Automatically creates a chart (bar/line/pie) alongside the PivotTable.
- ⚠️ CRITICAL: Before using this command, you MUST read
./reference/pivot-table.mdfor full documentation. - required parameters:
input.xlsx- Input Excel file (positional)output.xlsx- Output Excel file (positional)--source "Sheet!A1:Z100"- Source data range--location "Sheet!A3"- Where to place PivotTable--values "Field:sum"- Value fields with aggregation (sum/count/avg/max/min)
- optional parameters:
--rows "Field1,Field2"- Row fields--cols "Field1"- Column fields--filters "Field1"- Filter/page fields--name "PivotName"- PivotTable name (default: PivotTable1)--style "monochrome"- Style theme:monochrome(default) orfinance--chart "bar"- Chart type:bar(default),line, orpie
- how to use:
# First: inspect to get sheet names and headers
./scripts/Xlsx inspect data.xlsx --pretty
# Then: create PivotTable with chart
./scripts/Xlsx pivot \
data.xlsx output.xlsx \
--source "Sales!A1:F100" \
--rows "Product,Region" \
--values "Revenue:sum,Units:count" \
--location "Summary!A3" \
--chart "bar"
- chart-verify
- description: Verify that all charts have actual data content. Use this after creating charts to ensure they are not empty.
- how to use:
./scripts/Xlsx chart-verify output.xlsx
- exit codes:
0= All charts have data, safe to deliver1= Charts are empty or broken - MUST FIX
- validate ⚠️ MANDATORY - MUST RUN BEFORE DELIVERY
-
description: OpenXML structure validation. Files that fail this validation CANNOT be opened by Microsoft Excel. You MUST run this command before delivering any Excel file.
-
What it checks:
- OpenXML schema compliance (Office 2013 standard)
- PivotTable and Chart structure integrity
- Incompatible functions (FILTER, UNIQUE, XLOOKUP, etc. - not supported in Excel 2019 and earlier)
- .rels file path format (absolute paths cause Excel to crash)
-
exit codes:
0= Validation passed, safe to deliver- Non-zero = Validation failed - DO NOT DELIVER, regenerate the file
-
how to use:
./scripts/Xlsx validate output.xlsx
- If validation fails: Do NOT attempt to "fix" the file. Regenerate it from scratch with corrected code.
</tool-script-list> <analyze-rule> <important-guideline> By default, interactive execution follows the following principles: - **Understanding the Problem and Defining the Goal**: Summarize the problem, situation, and goal - **Gather the data you need**: Plan your data sources and try to get them as reasonably as possible. Log each attempt and switch alternatives if the primary data source is unavailable - **Explore and Clean Data (EDA)**: Clean data → use descriptive statistics to examine distributions, correlations, missing values, outliers - **Data Analysis**: Analyzing Data to Extract Evidence-Backed Insights: Applying Methodologies → Reporting Significant Effects → Examining Assumptions → Handling Outliers → Validating Robustness → Ensuring Reproducibility - **Review and Cross-Check**: Step by step to check calculations/analyses and flag anomalies → Validate with alternative data, methods, or slices → Application Domain Plausibility Check and compare against external benchmarks or real data → Clearly explain gaps, validation process, and significance → Output 'review.md' - Make sure using a numeric format for number information, not a text format - For tasks that involve data analysis, you use Excel formulas to calculate tables. - Be sure to check that the cells referenced by the formula are not misaligned. Especially when the calculation result is 0 or null, re-check the data referenced by these cells - All values for formula calculations must be in numeric format, not text. Be careful when writing via openpyxl - After opening Excel, everything involved in calculation has valid values, and there will be no situation where it cannot be calculated due to circular reference. - Pay attention to the accuracy of the reference when calculating the formula, you must carefully check that the cell you are referencing is the cell that your formula is really trying to calculate, and you must not refer to the wrong cell when calculating - For tables involving financial or fiscal data, please ensure that the numbers are calculated and presented in currency format (i.e., by adding the currency symbol before the number). - If **scenario assumptions** are required to obtain the calculation results for certain formulas, please **complete these scenario assumptions in advance**. Ensure that **every cell** requiring a calculation in **every table** receives a **calculated value**, rather than a note stating "Scenario simulation required" or "Manual calculation required." </important-guideline> <excel-creation-workflow>
📋 Excel Creation Workflow (Per-Sheet Validation)
🚨 CRITICAL: Validate EACH sheet immediately after creation, NOT after all sheets are done!
For each sheet in workbook:
1. PLAN → Design this sheet's structure, formulas, references
2. CREATE → Write data, formulas, styling for this sheet
3. SAVE → Save the workbook (wb.save())
4. CHECK → Run recheck + reference-check → Fix until 0 errors
5. NEXT → Only proceed to next sheet after current sheet has 0 errors
After ALL sheets pass:
6. VALIDATE → Run `validate` command → Fix until exit code 0
7. DELIVER → Only deliver files that passed ALL validations
Per-Sheet Check Commands
# After creating/modifying EACH sheet, save and run:
./scripts/Xlsx recheck output.xlsx
./scripts/Xlsx reference-check output.xlsx
# Fix ALL errors before creating the next sheet!
Final Validation (after all sheets complete)
./scripts/Xlsx validate output.xlsx
Why Per-Sheet Validation?
- Errors in Sheet 1 propagate to Sheet 2, Sheet 3... causing cascading failures
- Fixing 3 errors per sheet is easier than fixing 30 errors at the end
- Cross-sheet references can be validated immediately
⚠️ CRITICAL: Excel Formulas Are ALWAYS the First Choice
For ANY analysis task, using Excel formulas is the default and preferred approach. Wherever a formula CAN be used, it MUST be used.
✅ CORRECT - Use Excel formulas:
ws['C2'] = '=A2+B2' # Sum
ws['D2'] = '=C2/B2*100' # Percentage
ws['E2'] = '=SUM(A2:A100)' # Aggregation
❌ FORBIDDEN - Pre-calculate in Python and paste static values:
result = value_a + value_b
ws['C2'] = result # BAD: Static value, not a formula
Only use static values when:
- Data is fetched from external sources (web search, API)
- Values are constants that never change
- Formula would create circular reference
Follow this workflow::
Sheet 1: Plan (write detailed design) → Create → Save → Run Recheck → Run ReferenceCheck → Fix errors → Zero errors ✓
Sheet 2: Plan (write detailed design) → Create → Save → Run Recheck → Run ReferenceCheck → Fix errors → Zero errors ✓
Sheet 3: Plan (write detailed design) → Create → Save → Run Recheck → Run ReferenceCheck → Fix errors → Zero errors ✓
...
🚨 CRITICAL: Recheck Results Are FINAL - NO EXCEPTIONS
The recheck command detects formula errors (#VALUE!, #DIV/0!, #REF!, #NAME?, #N/A, etc.) and zero-value cells. You MUST follow these rules strictly:
-
ZERO TOLERANCE for errors: If
recheckreports ANY errors, you MUST fix them before delivery. There are NO exceptions. -
DO NOT assume errors will "auto-resolve":
- ❌ WRONG: "These errors will disappear when the user opens the file in Excel"
- ❌ WRONG: "Excel will recalculate and fix these errors automatically"
- ✅ CORRECT: Fix ALL errors reported by
recheckuntil error_count = 0
-
Errors detected = Errors to fix:
- If
recheckshowserror_count: 5, you have 5 errors to fix - If
recheckshowszero_value_count: 3, you have 3 suspicious cells to verify - Only when
error_count: 0can you proceed to the next step
- If
-
Common mistakes to avoid:
- ❌ "The #REF! error is because openpyxl doesn't evaluate formulas" - WRONG, fix it!
- ❌ "The #VALUE! will resolve when opened in Excel" - WRONG, fix it!
- ❌ "Zero values are expected" - VERIFY each one, many are reference errors!
-
Delivery gate: Files with ANY
recheckerrors CANNOT be delivered to users.
Forbidden Patterns ❌:
1. Create Sheet 1 → Create Sheet 2 → Create Sheet 3 → Run Recheck once at end
❌ WRONG: Errors accumulate, debugging becomes exponentially harder
✅ CORRECT: Check after EACH sheet, fix before moving to next
2. Skip planning for any sheet
❌ WRONG: Causes 80%+ of reference errors
✅ CORRECT: Plan each sheet's structure before creating it
3. Recheck shows errors → Ignore and deliver anyway
❌ ABSOLUTELY FORBIDDEN - errors must be fixed, not ignored!
4. Recheck shows errors → Proceed to create next sheet anyway
❌ WRONG: Errors in Sheet 1 will cascade to Sheet 2, 3...
✅ CORRECT: Fix ALL errors in current sheet before creating next sheet
</analyze-loop>
<vlookup-usage-rules>
**When to Use**: User requests lookup/match/search; Multiple tables share keys (ProductID, EmployeeID); Master-detail relationships; Code-to-name mapping; Cross-file data with common keys; Keywords: "based on", "from another table", "match against"
Syntax: =VLOOKUP(lookup_value, table_array, col_index_num, FALSE) — lookup column MUST be leftmost in table_array
Best Practices: Use FALSE for exact match; Lock range with $A$2:$D$100; Wrap with IFERROR(...,"N/A"); Cross-sheet: Sheet2!$A$2:$C$100
Errors: #N/A=not found; #REF!=col_index exceeds columns. Alt: INDEX/MATCH when lookup column not leftmost
ws['D2'] = '=IFERROR(VLOOKUP(A2,$G$2:$I$50,3,FALSE),"N/A")'
</vlookup-usage-rules>
<pivot-table-module>
🚨 CRITICAL: PivotTable Creation Requires Reading ./reference/pivot-table.md
When to Trigger: Detect ANY of these user intents:
- User explicitly requests "pivot table", "data pivot", "数据透视表"
- Task requires data summarization by categories
- Keywords: summarize, aggregate, group by, categorize, breakdown, statistics, distribution, count by, total by
- Dataset has 50+ rows with grouping needs
- Cross-tabulation or multi-dimensional analysis needed
⚠️ MANDATORY ACTION: When PivotTable need is detected, you MUST:
- READ
./reference/pivot-table.mdFIRST - Follow the execution order and workflow in that document
- Use the
pivotcommand (NOT manual code construction)
Why This Is Required:
- PivotTable creation uses pure OpenXML SDK (C# tool)
- The
pivotcommand provides stable, tested implementation - Manual pivot construction in openpyxl is NOT supported and forbidden
- Chart types (bar/line/pie) are automatically created with PivotTable
Quick Reference (Details in ./reference/pivot-table.md):
# Step 1: Inspect data structure
./scripts/Xlsx inspect data.xlsx --pretty
# Step 2: Create PivotTable with chart
./scripts/Xlsx pivot \
data.xlsx output.xlsx \
--source "Sheet!A1:F100" \
--rows "Category" \
--values "Revenue:sum" \
--location "Summary!A3" \
--chart "bar"
# Step 3: Validate
./scripts/Xlsx validate output.xlsx
⛔ FORBIDDEN:
- Creating PivotTable manually with openpyxl code
- Skipping the
inspectstep - Not reading
./reference/pivot-table.mdbefore creating PivotTable - 🚨 NEVER modify pivot output file with openpyxl - openpyxl will corrupt pivotCache paths!
⚠️ CRITICAL: Workflow Order for PivotTable If you need to add extra sheets (Cover, Summary, etc.) to a file that will have PivotTable:
- FIRST: Create ALL sheets with openpyxl (data sheets, cover sheet, styling, etc.)
- THEN: Run
pivotcommand as the FINAL STEP - NEVER: Open the pivot output file with openpyxl again - this corrupts the file!
✅ CORRECT ORDER:
openpyxl creates base.xlsx (with Cover, Data sheets)
→ pivot command: base.xlsx → final.xlsx (adds PivotTable)
→ validate final.xlsx
→ DELIVER final.xlsx (do NOT modify again)
❌ WRONG ORDER (WILL CORRUPT FILE):
pivot command creates pivot.xlsx
→ openpyxl opens pivot.xlsx to add Cover sheet ← CORRUPTS FILE!
→ File cannot be opened in MS Excel
</pivot-table-module>
<baseline-error>
**Forbidden Formula Errors**:
1. Formula errors: #VALUE!, #DIV/0!, #REF!, #NAME?, #NULL!, #NUM!, #N/A - NEVER include
2. Off-by-one references (wrong cell/row/column)
3. Text starting with `=` interpreted as formula
4. Static values instead of formulas (use formulas for calculations)
5. Placeholder text: "TBD", "Pending", "Manual calculation required" - FORBIDDEN
6. Missing units in headers; Inconsistent units in calculations
7. Currency without format symbols (¥/$)
8. Result of 0 must be verified - often indicates reference error
🚨 FORBIDDEN FUNCTIONS (Incompatible with older Excel versions):
The following functions are NOT supported in Excel 2019 and earlier. Files using these functions will FAIL to open in older Excel versions. Use traditional alternatives instead.
| ❌ Forbidden Function | ✅ Alternative |
|---|---|
FILTER() | Use AutoFilter, or SUMIF/COUNTIF/INDEX-MATCH |
UNIQUE() | Use Remove Duplicates feature, or helper column with COUNTIF |
SORT(), SORTBY() | Use Excel's Sort feature (Data → Sort) |
XLOOKUP() | Use INDEX() + MATCH() combination |
XMATCH() | Use MATCH() |
SEQUENCE() | Use ROW() or manual fill |
LET() | Define intermediate calculations in helper cells |
LAMBDA() | Use named ranges or VBA |
RANDARRAY() | Use RAND() with fill-down |
ARRAYFORMULA() | Google Sheets only - use Ctrl+Shift+Enter array formulas |
QUERY() | Google Sheets only - use SUMIF/COUNTIF/PivotTable |
IMPORTRANGE() | Google Sheets only - copy data manually |
Why these are forbidden:
- These are Excel 365/2021+ dynamic array functions or Google Sheets functions
- Older Excel versions (2019, 2016, etc.) cannot parse these formulas
- The file will crash or show errors when opened in older Excel
- The
validatecommand will detect and reject files using these functions
Example - Converting FILTER to INDEX-MATCH:
❌ WRONG: =FILTER(A2:C100, B2:B100="Active")
✅ CORRECT: Use AutoFilter on the data range, or create a PivotTable
⚠️ Off-By-One Prevention: Before saving, verify each formula references correct cells. Run reference-check tool. Common errors: referencing headers, wrong row/column offset. If result is 0 or unexpected → check references first.
💰 Financial Values: Store in smallest unit (15000000 not 1.5M). Use Excel format for display: "¥#,##0". Never use scaled units requiring conversion in formulas.
Use python-openpyxl package to design the style of excel. Apply styling directly in openpyxl code.
🎨 Overall Visual Design Principles
- ⚠️ MANDATORY: Hide Gridlines - ALL sheets MUST have gridlines hidden (see code below)
- Start at B2 (top-left padding), not A1
- Title Row Height: Since content starts at B2, row 2 is typically the title row with larger font. Always increase row 2 height to prevent text clipping:
ws.row_dimensions[2].height = 30(adjust based on font size) - ⚠️ MANDATORY: Do NOT use wrap text by default - keep
wrap_textoff unless the user explicitly asks for it or the active sub skill explicitly requires it - Professionalism First: Adopt business-style color schemes, avoid over-decoration that impairs data readability
- Consistency: Use uniform formatting, fonts, and color schemes for similar data types
- Clear Hierarchy: Establish information hierarchy through font size, weight, and color intensity
- Appropriate White Space: Use reasonable margins and row heights to avoid content crowding
- Please arrange the appropriate width and height dimensions for each cell, and do not have a cell that is not wide enough and too high, resulting in a display scale imbalance
⚠️ How to Hide Gridlines (openpyxl)
from openpyxl import Workbook
wb = Workbook()
ws = wb.active
# Hide gridlines
ws.sheet_view.showGridLines = False
# ... add your data and styling ...
wb.save('output.xlsx')
📐 Merged Cells Guide
Use ws.merge_cells() for titles, headers spanning columns, or grouped labels. Apply style to top-left cell only.
# Merge and style
ws.merge_cells('B2:F2')
ws['B2'] = "Report Title"
ws['B2'].font = Font(size=18, bold=True)
ws['B2'].alignment = Alignment(horizontal='center', vertical='center')
Rules:
- ✅ Use for: titles, section headers, category labels spanning columns
- ❌ Avoid in: data areas, formula ranges, PivotTable source data
- Always set
alignmenton merged cells for proper text positioning
🎨 Style Selection Guide
- Minimalist Monochrome Style: Default for ALL non-financial tasks (Black/White/Grey + Blue accent only)
- Professional Finance Style: For general financial/fiscal analysis (stock, GDP, salary, public finance), if it's fiancial sub skills relevant, refer to the sub skills
<Minimalist_Monochrome_Style>
📊 Minimalist Monochrome Style (DEFAULT)
🎨 Core Color Principle (STRICTLY ENFORCED)
Base Colors (ONLY these 3):
- White (#FFFFFF) - Background, content areas
- Black (#000000) - Primary text, key headers
- Grey (various shades) - Structure, secondary elements, borders
Accent Color (ONLY Blue for differentiation):
- When you need to highlight, differentiate, or emphasize, use Blue with varying lightness/saturation
- NO other colors allowed (no green, red, orange, purple, etc.) except for regional financial indicators
⚠️ STRICTLY FORBIDDEN
- ❌ NO Green, Red, Orange, Purple, Yellow, Pink or any other colors
- ❌ NO Rainbow or multi-color schemes
- ❌ NO Saturated/vibrant colors except Blue accents
- ❌ NO Color gradients using multiple hue families
Python Color Palette
# Minimalist Monochrome Style Palette
from openpyxl.styles import PatternFill, Font, Border, Side, Alignment
# Base Colors (Black/White/Grey ONLY)
bg_white = "FFFFFF" # Primary background
bg_light_grey = "F5F5F5" # Secondary background
bg_row_alt = "F9F9F9" # Alternating row fill
header_black = "000000" # Primary headers, totals
header_dark_grey = "333333" # Main section headers
text_dark = "000000" # Primary text
border_grey = "D0D0D0" # All borders
# Blue Accent (ONLY color for differentiation)
blue_primary = "0066CC" # Key highlights
blue_secondary = "4A90D9" # Secondary emphasis
blue_light = "E6F0FA" # Subtle background highlight
# Hide gridlines
ws.sheet_view.showGridLines = False
# Example: Apply header style
header_fill = PatternFill(start_color=header_dark_grey, end_color=header_dark_grey, fill_type="solid")
header_font = Font(color="FFFFFF", bold=True)
for cell in ws['A1:D1'][0]:
cell.fill = header_fill
cell.font = header_font
</Minimalist_Monochrome_Style>
<Professional_Finance_Style>
💎 Professional Finance Style (For Financial Tasks)
Use this style when the task involves: stock, GDP, salary, revenue, profit, budget, ROI, public finance, or any fiscal analysis.
🚨 CRITICAL: Regional Color Convention for Financial Data
| Region | Price Up | Price Down |
|---|---|---|
| China (Mainland) | Red | Green |
| Outside China (International) | Green | Red |
Python Color Palette
# Professional Finance Style Palette
from openpyxl.styles import PatternFill, Font, Border, Side, Alignment
bg_light = "ECF0F1" # Main background (light gray)
text_dark = "000000" # Primary text
accent_warm = "FFF3E0" # Key metrics highlight (pale orange)
header_dark_blue = "122B49" # Header fill
negative_red = "FF0000" # Negative values
# Hide cell border line
ws.sheet_view.showGridLines = False
# Example: Apply Professional Finance header style
gs_header_fill = PatternFill(start_color=header_dark_blue, end_color=header_dark_blue, fill_type="solid")
gs_header_font = Font(color="FFFFFF", bold=True)
gs_highlight_fill = PatternFill(start_color=accent_warm, end_color=accent_warm, fill_type="solid")
for cell in ws['A1:D1'][0]:
cell.fill = gs_header_fill
cell.font = gs_header_font
</Professional_Finance_Style>
<Conditional_Formatting>
🎯 Conditional Formatting (PROACTIVE USE REQUIRED)
Actively use Conditional Formatting to create professional, visually impactful Excel deliverables.
| Data Type | Format | Code Example |
|---|---|---|
| Numeric values | Data Bars | DataBarRule(start_type='min', end_type='max', color='4A90D9', showValue=True) |
| Distribution | Color Scales | ColorScaleRule(start_type='min', start_color='FFFFFF', end_type='max', end_color='4A90D9') |
| KPIs/Status | Icon Sets | IconSetRule(icon_style='3TrafficLights1', type='percent', values=[0,33,67]) |
| Thresholds | Highlight Cells | CellIsRule(operator='greaterThan', formula=['100000'], fill=green_fill) |
| Rankings | Top/Bottom | FormulaRule(formula=['RANK(A2,$A$2:$A$100)<=10'], fill=gold_fill) |
Icon Styles: 3TrafficLights1 (🔴🟡🟢), 3Arrows (↓→↑), 3Symbols (✗−✓), 5Rating (★)
Colors by Style:
- Monochrome: Data bars
4A90D9, ScaleF5F5F5→B0B0B0→333333 - Finance: Positive
63BE7B, NegativeF8696B, NeutralFFEB84
from openpyxl.formatting.rule import DataBarRule, ColorScaleRule, IconSetRule, CellIsRule
# Data Bar
ws.conditional_formatting.add('C2:C100', DataBarRule(start_type='min', end_type='max', color='4A90D9', showValue=True))
# 3-Color Scale (Red→Yellow→Green)
ws.conditional_formatting.add('D2:D100', ColorScaleRule(start_type='min', start_color='F8696B', mid_type='percentile', mid_value=50, mid_color='FFEB84', end_type='max', end_color='63BE7B'))
# Icon Set
ws.conditional_formatting.add('E2:E100', IconSetRule(icon_style='3TrafficLights1', type='percent', values=[0, 33, 67], showValue=True))
Best Practices: Apply to 2-4 key columns per sheet; use consistent color meanings; combine Data Bars + Icons for impact.
</Conditional_Formatting>
📝 Text Color Style (MUST FOLLOW)
- Blue font: Fixed values/input values
- Black font: Cells with calculation formulas
- Green font: Cells referencing other sheets
- Red font: Cells with external reference
- For finance models, these color rules are hard minimum standards and must remain consistent sheet by sheet unless the active finance sub skill is stricter.
- For finance models, if a formula combines references with arithmetic, it is a calculation formula and must be black, not green.
📏 Border Styles
- In general cases, do not add borders to cells to make the whole content appear more focused
- Do not use a table border line unless you need to use a border line to reflect the calculation results
- Sometimes, you can use 1px borders within models, thicker for section breaks
Every Excel deliverable MUST include a Cover Page as the FIRST sheet.
Cover Page Structure
| Row | Content | Style |
|---|---|---|
| 2-3 | Report Title | Large font (18-20pt), Bold, Centered |
| 5 | Subtitle/Description | Medium font (12pt), Gray color |
| 7-15 | Key Metrics Summary | Table format with highlights |
| 17-20 | Sheet Index | List of all sheets with descriptions |
| 22+ | Notes & Instructions | Small font, Gray |
Required Elements
1. Report Title - Clear, descriptive title of the workbook
2. Key Metrics Summary - 3-6 most important numbers/findings:
3. Sheet Index - Navigation guide:
| Sheet Name | Description |
|------------|-------------|
| Raw Data | Original dataset (100 rows) |
| Analysis | Sales breakdown by region |
| Pivot Summary | Interactive pivot analysis |
4. PivotTable Notice (MANDATORY when workbook contains PivotTables):
⚠️ IMPORTANT: This workbook contains PivotTables.
Please refresh data after opening:
- Windows: Select PivotTable → Right-click → Refresh
- Mac: Select PivotTable → PivotTable Analyze → Refresh
- Or press Ctrl+Alt+F5 to refresh all
Cover Page Styling
- Background: Clean white or light gray (#F5F5F5)
- Title row height: 30-40pt for prominence
- No gridlines: Hide gridlines on Cover sheet for clean look
- Column width: Merge cells A-G for title area
- Color scheme: Match the workbook's theme (monochrome/finance)
Hide gridlines
Make sure the gridlines of covers still keep hiden </cover-page-design>
</style-rules> <visual-chart>⚠️ CRITICAL: You MUST Create REAL Excel Charts
Stronger Requirement (Proactive Visualization):
- If the user asks for charts/visuals, you MUST actively create charts instead of waiting for explicit per-table requests.
- When a workbook has multiple prepared datasets/tables, ensure each prepared dataset has at least one corresponding chart unless the user explicitly says otherwise.
- If any dataset is not visualized, explain why and ask for confirmation before delivery.
Trigger Keywords - When user mentions ANY of these, you MUST create actual embedded charts:
- "visual", "chart", "graph", "visualization", "visual table", "diagram"
- "show me a chart", "create a chart", "add charts", "with graphs"
❌ ABSOLUTELY FORBIDDEN:
- Creating a "CHARTS DATA" sheet with data + instructions "Go to Insert > Charts"
- Telling user to manually create charts themselves
- Marking "Add visual charts" as completed without actual charts
✅ REQUIRED:
- Default: Create embedded Excel charts inside the .xlsx file using openpyxl
- Only if user explicitly requests: Create standalone PNG/JPG image files separately
Mandatory Workflow:
1. Create Excel with openpyxl (data, styling)
2. Add charts using openpyxl.chart module
3. Save file
4. Run chart-verify to confirm charts exist and have data
5. If chart-verify returns exit code 1 → FIX before delivering
📚 openpyxl Chart Creation Guide
Required Imports
from openpyxl import Workbook
from openpyxl.chart import BarChart, LineChart, PieChart, Reference
from openpyxl.chart.label import DataLabelList
Chart Creation Example (Bar Chart)
from openpyxl import Workbook
from openpyxl.chart import BarChart, Reference
wb = Workbook()
ws = wb.active
# Sample data
data = [
['Category', 'Value'],
['A', 100],
['B', 200],
['C', 150],
]
for row in data:
ws.append(row)
# Create chart
chart = BarChart()
chart.type = "col" # Column chart (vertical bars)
chart.style = 10
chart.title = "Sales by Category"
chart.y_axis.title = 'Value'
chart.x_axis.title = 'Category'
# Define data range
data_ref = Reference(ws, min_col=2, min_row=1, max_row=4)
cats_ref = Reference(ws, min_col=1, min_row=2, max_row=4)
chart.add_data(data_ref, titles_from_data=True)
chart.set_categories(cats_ref)
chart.shape = 4 # Rectangular shape
# Position chart
ws.add_chart(chart, "E2")
wb.save('output.xlsx')
Chart Types Quick Reference
| Chart Type | openpyxl Class | Key Config |
|---|---|---|
| Column/Bar | BarChart() | type="col" (vertical) or type="bar" (horizontal) |
| Line | LineChart() | style=10, optional markers |
| Pie | PieChart() | No axes needed |
| Area | AreaChart() | grouping="standard" |
Line Chart Example
from openpyxl.chart import LineChart, Reference
chart = LineChart()
chart.title = "Trend Analysis"
chart.style = 13
chart.y_axis.title = 'Value'
chart.x_axis.title = 'Month'
data = Reference(ws, min_col=2, min_row=1, max_row=13, max_col=3)
chart.add_data(data, titles_from_data=True)
cats = Reference(ws, min_col=1, min_row=2, max_row=13)
chart.set_categories(cats)
ws.add_chart(chart, "E2")
Pie Chart Example
from openpyxl.chart import PieChart, Reference
pie = PieChart()
pie.title = "Market Share"
data = Reference(ws, min_col=2, min_row=1, max_row=5)
labels = Reference(ws, min_col=1, min_row=2, max_row=5)
pie.add_data(data, titles_from_data=True)
pie.set_categories(labels)
ws.add_chart(pie, "E2")
After Creating Charts - MANDATORY:
./scripts/Xlsx chart-verify output.xlsx
Exit code 1 = Charts broken → MUST FIX. No excuses - if chart-verify fails, the chart IS broken regardless of data embedding method.
Chart Type Selection:
| Data Type | Chart | Use Case |
|---|---|---|
| Trend | Line | Time series |
| Compare | Column/Bar | Category comparison |
| Composition | Pie/Doughnut | Percentages (≤6 items) |
| Distribution | Histogram | Data spread |
| Correlation | Scatter | Relationships |
Chart Color Scheme:
- Monochrome:
333333,666666,0066CC,4A90D9 - Finance:
122B49,274C77,3B6796,D9E2F3
🚨 Excel Creation Workflow (MUST FOLLOW)
Phase 1: DESIGN
→ Plan all sheets structure, formulas, cross-references before coding
Phase 2: CREATE & VALIDATE (Per-Sheet Loop)
For each sheet:
1. Create sheet (data, formulas, styling, charts if needed)
2. Save workbook
3. Run: recheck output.xlsx
4. Run: reference-check output.xlsx
5. Run: chart-verify output.xlsx (if sheet contains charts)
6. If errors found → Fix and repeat step 2-5
7. Only proceed to next sheet when current sheet has 0 errors
Phase 3: FINAL VALIDATION
→ Run: validate output.xlsx
→ If exit code = 0: Safe to deliver
→ If exit code ≠ 0: Regenerate the file with corrected code
Phase 4: DELIVER
→ Only deliver files that passed ALL validations
⛔ FORBIDDEN Patterns:
- Creating all sheets first, then running validation once at the end
- Ignoring recheck/reference-check errors and proceeding to next sheet
- Delivering files that failed validation
Other Requirements
-
Make sure that the final delivery contains at least one .xlsx file.
-
Make sure that there is content in each table, and there should be no situation where there is only the header and no content, please recheck
-
Check each cell that is calculated as null by the formula, check if the cell it references has a value
-
Please arrange the height and width ratio of the table reasonably, so that there is no display disorder
-
All calculations are done using real data unless the user requests the use of simulated data.
-
For cells that contain numbers, mark the units at the header of the table, not after the numbers in the table
-
Make sure you design Excel using the required style template. For financial tasks, use Professional Finance style templates
-
🔍 VLOOKUP: For cross-table matching tasks, refer to
<vlookup-usage-rules>. Multi-file scenarios: merge all files into one workbook first, then apply VLOOKUP formulas. ❌ FORBIDDEN: Using code merge() instead of VLOOKUP formulas. -
🚨 PivotTable: See
<pivot-table-module>below. MUST read./reference/pivot-table.mdfirst. ⛔ FORBIDDEN: Manually constructing pivot tables in code. -
📊 Charts: When user requests "visual"/"chart"/"graph", you MUST create real Excel charts using openpyxl. After creating, run
chart-verifytool. ⛔ FORBIDDEN: Creating "chart data" sheets and telling user to insert charts manually. -
🔗 External Data Sources: When using
datasource,web_search, or any external data fetching tool, you MUST include source citations in the final Excel. AddSource NameandSource URLcolumns, or create a dedicated "Sources" sheet. ⛔ FORBIDDEN: Delivering Excel with fetched data but missing source references.
Gives 0 of the 12 instructions most pdf office docs skills give
Counted across 635 of the 690 authors here whose files we hold, read 2026-08-06
- extract text using pdfplumberin 92 of 635, across 25 files
- create PDFs using reportlabin 83 of 635, across 16 files
- read FORMS.md to fill out PDF formsin 80 of 635, across 13 files
- OCR scanned PDFs using pytesseractin 77 of 635, across 10 files
- merge or split PDFs using qpdfin 70 of 635, across 3 files
- use Excel formulas instead of hardcoded calculated valuesin 68 of 635, across 12 files
- unpack edit xml and repack existing documentsin 63 of 635, across 8 files
- document sources for hardcoded valuesin 61 of 635, across 9 files
- write minimal python code without unnecessary commentsin 59 of 635, across 7 files
- run the recalculation script after adding or modifying formulasin 58 of 635, across 6 files
- fix all identified formula errors and recalculatein 58 of 635, across 6 files
- format years as text stringsin 57 of 635, across 5 files
Said here and by no other author read
- Deliver at least one xlsx file
- Provide only requested files
- Do not provide readme documentation
- Execute Python code using ipython
- Run recheck before proposing a fix
- Read applicable finance sub-skills before building
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.