Edit Excel workbooks only after anchored preflight audit, then require deterministic Python/openpyxl post-write proof that every requested criterion is satisfied or explicitly reconciled before finalizing.
59
68%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./benchmarks/gdpval/skills/spreadsheet-audit-edit-validate-merged/SKILL.mdUse this skill when you must modify, create, or validate an Excel workbook and the result must be proven against a user specification rather than merely described.
This skill combines:
This is a workflow skill. It does not require a specific editor, but it does require a direct Python verification pass with openpyxl before you report success.
Use this skill when any of the following are true:
Never finalize from narrative summary alone.
A workbook task is only complete when:
PASSFAILUNAVAILABLE-IN-SOURCEIf any mandatory criterion is still FAIL, do not declare success.
If a criterion is UNAVAILABLE-IN-SOURCE, only finalize if:
All discovery, reads, writes, and verification must be anchored to the exact workspace path provided for the task.
Rules:
Your output to yourself and to the user should be based on proof, not inference.
For every task, maintain three artifacts internally:
Candidate inventoryPre-edit audit checklistPost-write proof checklistThe post-write proof checklist is decisive.
Search under the exact workspace root for plausible Excel files:
.xlsx.xlsm.xlsPrefer files that:
If several files are plausible, inspect all plausible candidates before choosing.
Before choosing the workbook to edit, confirm at least:
Do not select a workbook based on filename similarity alone.
Before editing, extract every requirement you can verify.
Possible criteria include:
Turn these into an explicit checklist.
Represent each requested requirement as a discrete checkable item.
Good examples:
required-sheet: Summary existsrequired-sheet: Sample existsrequired-column: Sheet Sample has column "Selected"sample-count: exactly 25 marked rows in Samplecoverage: at least 1 marked row where Product = Trade Financepreservation: source sheet RawData still existsformula: column H contains formulas for all populated rowsBad examples:
workbook looks rightsampling seems okaymost tabs presentBefore any write, inspect the workbook structure against the extracted criteria.
For each relevant workbook:
If you inspect the workbook multiple times or with multiple tools, the inspections must agree on:
If they disagree, treat workbook identity as unconfirmed.
If two inspections disagree on sheet names, row counts, dimensions, or headers, do not edit until you can produce all of the following:
If you cannot reconcile the conflict, the decision is no-go.
Proceed only if all are true:
Otherwise stop and report the mismatch.
Only after the workbook passes pre-edit audit:
Record at minimum:
This phase is mandatory.
After saving, directly inspect the saved workbook from disk with Python and openpyxl. Do not finalize from memory, delegated prose, or a generic success message.
The verification pass must produce a compact, machine-checkable checklist covering every extracted criterion.
The verification must be:
At minimum, the verification must report:
Each criterion must end in exactly one status:
PASS — requirement satisfied by direct inspectionFAIL — requirement not satisfiedUNAVAILABLE-IN-SOURCE — requirement could not be satisfied because required source information was absent from the workbook or inputsDo not replace these with softer wording like:
You may finalize only when every required criterion is either:
PASS, orUNAVAILABLE-IN-SOURCE with explicit reconciliationYou must not finalize when:
FAILIf direct proof says the workbook is incomplete, that proof is authoritative.
Create a numbered list of all checkable requirements from the user request.
Example:
<path>Sample existsSummary existsSample has column SelectedProduct = Trade FinanceRawData still existsUse a standalone script or inline Python. openpyxl is the default.
Your script should print, in a compact format:
Adapt this template to the task.
from pathlib import Path
from openpyxl import load_workbook
WORKBOOK = Path("TARGET.xlsx")
TRUTHY = {"x", "yes", "true", "1", "y"}
MARKER_CANDIDATES = {"mark", "marked", "flag", "selected", "include", "status"}
def norm(v):
if v is None:
return ""
return str(v).strip()
def lower(v):
return norm(v).lower()
def first_nonempty_row(ws, max_scan=20):
for r in ws.iter_rows(min_row=1, max_row=min(ws.max_row, max_scan), values_only=True):
vals = list(r)
if any(norm(v) != "" for v in vals):
return vals
return []
def data_rows(ws, header_row_idx=1):
count = 0
for row in ws.iter_rows(min_row=header_row_idx + 1, values_only=True):
if any(norm(v) != "" for v in row):
count += 1
return count
def marker_index(headers):
normalized = [lower(h) for h in headers]
for i, h in enumerate(normalized):
if h in MARKER_CANDIDATES:
return i
return None
def is_truthy(v):
return lower(v) in TRUTHY
def marked_rows(ws, header_row_idx=1, idx=None):
if idx is None:
return 0
count = 0
for row in ws.iter_rows(min_row=header_row_idx + 1, values_only=True):
if not any(norm(v) != "" for v in row):
continue
value = row[idx] if idx < len(row) else None
if is_truthy(value):
count += 1
return count
criteria = []
print(f"WORKBOOK: {WORKBOOK}")
print(f"EXISTS: {WORKBOOK.exists()}")
if not WORKBOOK.exists():
print("CRITERION|output-exists|FAIL|Workbook file missing")
raise SystemExit(0)
wb = load_workbook(WORKBOOK, data_only=False)
print(f"SHEETS: {wb.sheetnames}")
for ws in wb.worksheets:
headers = first_nonempty_row(ws)
idx = marker_index(headers) if headers else None
print(f"SHEET|{ws.title}|HEADERS|{headers}")
print(f"SHEET|{ws.title}|DATA_ROWS|{data_rows(ws, header_row_idx=1)}")
if idx is not None:
print(f"SHEET|{ws.title}|MARKER_COLUMN|{headers[idx]}")
print(f"SHEET|{ws.title}|MARKED_ROWS|{marked_rows(ws, header_row_idx=1, idx=idx)}")
else:
print(f"SHEET|{ws.title}|MARKER_COLUMN|<not found>")
# Add explicit criteria below. Examples:
required_sheets = ["Sample", "Summary"]
for s in required_sheets:
status = "PASS" if s in wb.sheetnames else "FAIL"
reason = "present" if status == "PASS" else "missing"
print(f"CRITERION|required-sheet:{s}|{status}|{reason}")The generic script is not enough by itself. Extend it to test the actual request, such as:
If the task depends on category coverage, test category coverage explicitly rather than assuming it from total counts.
Example criteria additions:
exactly 40 marked rowsat least one marked row for each required regioncolumn "Review Note" populated for all marked rowssheet "Summary" cell B2 contains numeric totalsheet "RawData" still present after saveFor each non-pass criterion:
FAILDo one of:
Do not declare completion while a mandatory FAIL remains.
UNAVAILABLE-IN-SOURCEState explicitly:
Use UNAVAILABLE-IN-SOURCE only for true source limitations, not for editing mistakes.
Every post-write verification must include a checklist in this style:
CRITERION|<name>|PASS|<reason>CRITERION|<name>|FAIL|<reason>CRITERION|<name>|UNAVAILABLE-IN-SOURCE|<reason>This format is intentionally rigid so you can reason from concrete output.
Do not edit if:
Do not finalize if:
FAILTrust direct proof from the deterministic script.
If a delegated agent claimed success but your direct verification shows missing sheets, wrong counts, missing categories, or missing output files, the task is not complete.
FAIL if safePASS or explicitly reconciled UNAVAILABLE-IN-SOURCEWhen reporting to the user, base your summary only on verified facts from the direct proof output.
Include:
Preferred phrasing:
...."...."N pass items, M fail items, and K unavailable-in-source items."Do not:
Spreadsheet tasks often fail not during editing but during final judgment. A workbook can be modified successfully and still be wrong.
This skill prevents false completion by forcing:
When workbook correctness matters, proof beats summary.
c5a9c4b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.