hydr0pon1c/skills-on-the-fly/191-40
Claude Code and agent skill by hydr0pon1c/skills-on-the-fly
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install hydr0pon1c/skills-on-the-fly/191-40SKILL.md
The same SKILL.md was published earlier as hydr0pon1c/skills-on-the-fly/191-40.
SKILL.md
When to use
Use this skill when you need to perform block-wise sorting within a spreadsheet where data is organized into contiguous blocks separated by blank rows. The target task specifies:
- The sheet name and column (D) by which to sort descending.
- Each block must be independently sorted (only numeric rows, not blank separators).
- Formulas in columns D–F must be preserved as formulas (not converted to text) and must reference the correct rows after sorting.
- Number formatting requires rounded numbers to one decimal place, with whole numbers displaying without a decimal point.
- Existing formatting (bold, center alignment, column widths) must be retained.
- Automatic Calculation must be enabled, and any text-stored formulas must be reconverted to formulas before sorting.
Before acting, gather:
- Full sheet layout: locate blank rows, block boundaries, and the exact column letters for D–F.
- Check if formulas exist in D–F and whether they are stored as text strings or as real formulas.
- Inspect existing number formats, alignment, and bold settings.
- Verify that the data columns beyond F are not to be sorted or altered.
Possible Failure Modes
- Treating blank-row separators as data: accidentally sorting blank rows into a block or removing them.
- Sorting blocks independently but not preserving blank-row count: after sorting, blocks may lose the required single blank row between them.
- Converting formulas to static values: reading cell values instead of preserving formula objects, causing loss of dynamic behavior.
- Formula cell references broken: when rows are moved, relative references in D–F formulas (e.g.,
=B2+C2) become incorrect unless the sort operation respects relative references. - Using text sort order on column D: column D may contain numeric values stored as text (e.g., from prior text-stored formulas), causing incorrect alphabetical ordering.
- Applying number formats separately: number formats (e.g.,
##0.0and##0) must be applied per cell, not overwritten by default formatting. - Omitting recalculation: after sorting, Excel must recalculate formulas. Ensure calculation mode is automatic.
- Ignoring formatting preservation: bold and center alignment may be lost if cells are overwritten without copying original formatting.
Possible procedures
- Identify blocks:
- Iterate over rows to find blank rows (all cells in the row are
Noneor empty). Use these as delimiters. - Group contiguous non-blank rows into blocks. Exclude header rows if present (the task may have a single header row at the top; treat it as a separate header block that should not be sorted).
- Convert text-stored formulas (if any):
- For each cell in D–F, if
cell.valueis a string starting with'='(or contains=Brow+Crowpattern), strip the leading'(apostrophe) that makes it text, then setcell.valueto the formula string (without the apostrophe).
- Set calculation mode:
- Use
wb.calculation = 'automatic'(openpyxl:wb.calculation.calcMode = 'auto'; but note openpyxl may not support setting calculation mode directly; alternative: set the workbook'scalcPrattributes usingxmlor rely on default). When saving, Excel will recalculate.
- For each block (excluding header if applicable):
- Extract the range of rows (min_row to max_row) for the block.
- Extract data for the sort key (column D values) along with the row indices. For rows within the block, evaluate formulas by reading
cell.value(if formula, value is the cached result; ensure calculation happened). If values are stored as text, convert to float for numeric comparison. - Sort the rows in descending order based on numeric value of column D. For ties, maintain original row order to preserve relative ordering.
- Write the sorted data back into the block rows, preserving all columns (A–F or more) but only reordering rows within the block.
- Preserve blank separators:
- After writing all blocks, explicitly reinsert a blank row between each block by writing
Noneto all cells of a designated separator row. Ensure exactly one blank row after each block (except after the last block).
- Apply number formatting:
- For entire columns D–F (or per block), set number format to
##0.0for cells that should display decimals, and##0for whole numbers. Use a formula check: if the value after rounding would be an integer, use##0; otherwise##0.0.
- Reapply bold and center alignment:
- For columns D, E, F, set
cell.font = Font(bold=True)andcell.alignment = Alignment(horizontal='center')for all data rows (including header row if required).
- Retain column widths:
- Before making changes, record column widths using
ws.column_dimensions['A'].width. After sorting, restore any changed widths (though sorting should not change them unless you assign new values).
- Recalculation:
- Since sorting may affect formula results, after sorting, trigger recalculation either by setting
ws.cell(row, col).value = ws.cell(row, col).value(but this might break formulas) or more reliably by saving and reopening the workbook (not always possible). The simplest approach: after writing, set the workbook calculation property to automatic and save. Excel will recalculate on open.
Verification Checklist
- [ ] Block detection correct: Verify that each block has the same number of rows as before sorting (except possible header row). Count blank rows: exactly one blank row between each block.
- [ ] Sort order: For each block, column D values are in descending numeric order (not text order). Use a Python assert or manual check.
- [ ] Formulas preserved: Open the output in Excel (or inspect with openpyxl) and confirm cells in D–F contain formulas (e.g.,
=B2+C2) and not static numbers. Check a few rows to ensure references point to the correct row (e.g., after sorting, row numbers may change; formulas should refer to cells relative to the new row, not fixed references). - [ ] Number formats: Cells with decimal values display one decimal (e.g., 115.6). Whole numbers display without decimal (e.g., 230, not 230.0). Use a quick loop to check number format strings.
- [ ] Bold and center: Confirm
boldattribute is True andalignment.horizontalis 'center' for D, E, F cells (at least for data rows). - [ ] Column widths unchanged: Compare before and after widths of involved columns (A–F or all). They should be identical.
- [ ] No text-stored formulas: Ensure all cells starting with
=are formula objects, not strings. - [ ] Calculation mode: Workbook calculation setting is automatic (or at least formulas are not broken).
- [ ] Unrelated data unaffected: Columns outside D–F (e.g., A–C, G–H) retain their original values and formatting (except for row reordering within blocks). Check a few sample rows.
- [ ] Recovery check: If any retrieved example had worksheet name mismatches (like
'sheet1'vs'Sheet1'), always use the exact sheet name as given in the spreadsheet_path file (case-sensitive). Avoid hardcoding sheet names from examples.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingprompt_optimizer/runs/example/spreadsheet/task_skills/191-40/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hydr0pon1c/skills-on-the-fly/191-40)