Day 4, 30 minutes · beginner
Why it matters
So far the agent checks Elske's sheet by reading it and applying four rules. That works on five rows. On five hundred rows a language model can miss a duplicate or misread a price, and two agents may count lines differently. A rule that must hold every time is a job for code.
The open standard lets a skill bring its own scripts. The instructions say when to run the script, the script does the exact check, and the agent turns the output into a report. The same small Python file then gives the same answer in Codex, GitHub Copilot and Antigravity.
A script that runs on your computer also needs your permission. Today you add a read-only check script to the skill, test it yourself first, and then watch each agent ask before it runs it. You end with a skill whose result no longer depends on how carefully a model reads a spreadsheet.
The script
Save this as scripts/check_products.py inside the skill folder, so the full path is .agents/skills/product-sheet-check/scripts/check_products.py.
# Read-only check of a product sheet (CSV).
import csv, json, re, sys
HEADER = ["sku", "name", "price_eur", "burn_hours"]
def main(args):
if len(args) != 1 or args[0] in ("-h", "--help"):
print("Usage: check_products.py SHEET.csv (exit 0 clean, 1 problems, 2 error)")
return 0 if args[:1] in (["-h"], ["--help"]) else 2
try:
with open(args[0], newline="", encoding="utf-8-sig") as f:
rows = list(csv.reader(f))
except OSError as e:
print(f"Error: cannot read {args[0]}: {e.strerror}", file=sys.stderr)
return 2
if not rows or rows[0] != HEADER:
print("Error: line 1 must be " + ",".join(HEADER), file=sys.stderr)
return 2
problems, seen = [], set()
for line, row in enumerate(rows[1:], start=2):
sku, _, price, hours = (row + [""] * 4)[:4]
found = []
if not sku:
found.append("missing sku")
elif sku in seen:
found.append("duplicate sku")
seen.add(sku)
if not re.fullmatch(r"\d+\.\d{2}", price):
found.append(f"price_eur needs two decimals: '{price}'")
if not re.fullmatch(r"\d+", hours):
found.append(f"burn_hours must be a whole number: '{hours}'")
problems += [{"line": line, "sku": sku, "problem": p} for p in found]
print(json.dumps({"sheet": args[0], "rows": len(rows) - 1, "problems": problems}, indent=2))
return 1 if problems else 0
sys.exit(main(sys.argv[1:]))
It follows the advice on agentskills.io for scripts that agents run:
- No questions. Agents work in shells where nobody can answer a prompt, so the script takes the sheet as an argument and never waits for input.
- A
--helptext. That is how an agent learns how to call it. Antigravity's docs advise letting the agent run--helpinstead of reading the whole source. - Structured output. It prints JSON on standard output and errors on standard error.
- Clear exit codes. 0 means clean, 1 means problems, 2 means it could not check.
- Read-only, no network, no extra packages. It only uses what comes with Python 3, so it runs the same in all three agents. Codex runs commands without network access by default, and Antigravity's sandbox limits the network to domains you approved.
The new SKILL.md
Replace the steps part of SKILL.md so the agent runs the script and only falls back on reading the sheet when Python is missing. The full text is in the guide for your tool. The key lines:
## Steps
1. Run scripts/check_products.py, which is in this skill's folder, with Python 3. Call it by its full path and pass the full path of the sheet as the only argument. Use python3; if that command is not found, use python.
2. The script only reads the sheet. It prints a JSON report and exits with 0 (clean), 1 (problems) or 2 (it could not check; show its error).
3. If Python is missing, check the rules below by reading the sheet yourself, and say so.
Say plainly where the script is and how to call it. The specification says paths in a skill are relative to the skill's folder, and GitHub's docs tell you to name the script in the instructions. The agent may run the command from the project folder or from the skill folder, so the instructions ask for full paths: then it works from either place. Do not count on the agent guessing.
The steps
- Create the script in the skill folder and save it.
- Run it yourself first, from the practice folder. On macOS and Linux use
python3 .agents/skills/product-sheet-check/scripts/check_products.py products.csv; on Windows the command is usuallypythoninstead ofpython3. You should see three problems and exit code 1. - Update
SKILL.mdwith the new steps. - Switch each agent to its careful mode, so you see any request to run a command. Each tool has its own switch, shown in the guides.
- Ask "Is my product sheet OK?" and, if the agent asks to run a command, read it before you approve. It should be
check_products.pyonproducts.csvand nothing else. - Compare the answers. All agents should now report exactly the three problems from the JSON.
- Commit the script and the new
SKILL.md.
Pick your tool below and follow the steps.
Approvals in the three agents
| Agent | Default behaviour for a local command |
|---|---|
| Codex | In Auto (the setting Codex recommends for a folder under git), routine commands inside the project run in a sandbox without asking. In Read Only, commands run in a read-only sandbox and anything outside it can need approval. |
| GitHub Copilot CLI | Asks for approval when a tool is not allowed yet. You can allow it once or for the rest of the session. |
| Antigravity CLI | In auto mode, where available, commands run in a sandbox without asking. Default mode asks before running terminal commands. |
The open standard has an experimental header field, allowed-tools, to pre-approve tools for a skill. GitHub documents it for Copilot and warns: only pre-approve shell or bash for a skill you have read and fully trust, because it removes the confirmation step. The Codex and Antigravity pages read for this course do not mention the field. Leave it out of Elske's shared skill.
Common mistakes
- Running a skill you have not read. GitHub warns that shared skills can hold hidden instructions or harmful scripts. Read every file in a skill folder before you use it, like you would read a script from the internet.
- Approving "for the whole session" out of habit. In Copilot that allows the tool in any way for the rest of the session, not only this one command.
- A script that asks questions. It hangs, because no one can answer.
Today's actions
Ticks are not saved without an accountDo it in your tool
OpenAI Codex
- In your editor, create
scripts/check_products.pyinside the skill folder with this code and save it.# Read-only check of a product sheet (CSV). import csv, json, re, sys HEADER = ["sku", "name", "price_eur", "burn_hours"] def main(args): if len(args) != 1 or args[0] in ("-h", "--help"): print("Usage: check_products.py SHEET.csv (exit 0 clean, 1 problems, 2 error)") return 0 if args[:1] in (["-h"], ["--help"]) else 2 try: with open(args[0], newline="", encoding="utf-8-sig") as f: rows = list(csv.reader(f)) except OSError as e: print(f"Error: cannot read {args[0]}: {e.strerror}", file=sys.stderr) return 2 if not rows or rows[0] != HEADER: print("Error: line 1 must be " + ",".join(HEADER), file=sys.stderr) return 2 problems, seen = [], set() for line, row in enumerate(rows[1:], start=2): sku, _, price, hours = (row + [""] * 4)[:4] found = [] if not sku: found.append("missing sku") elif sku in seen: found.append("duplicate sku") seen.add(sku) if not re.fullmatch(r"\d+\.\d{2}", price): found.append(f"price_eur needs two decimals: '{price}'") if not re.fullmatch(r"\d+", hours): found.append(f"burn_hours must be a whole number: '{hours}'") problems += [{"line": line, "sku": sku, "problem": p} for p in found] print(json.dumps({"sheet": args[0], "rows": len(rows) - 1, "problems": problems}, indent=2)) return 1 if problems else 0 sys.exit(main(sys.argv[1:])) - Replace the whole text of the skill's SKILL.md with this version, which tells the agent to run the script, and save it.
--- name: product-sheet-check description: Checks a Mosswick Candles product sheet (a CSV with sku, name, price_eur and burn_hours) for missing or duplicate SKUs, prices without two decimals and burn times that are not whole numbers. Use when asked to check, validate or review products.csv or another product sheet, for example before an upload. Do not use for writing product texts, changing prices or making a new sheet. --- # Product sheet check Check the product sheet the user names. If they name none, use products.csv in the project root. Never change the sheet. ## Steps 1. Run scripts/check_products.py, which is in this skill's folder, with Python 3. Call it by its full path and pass the full path of the sheet as the only argument. Use python3; if that command is not found, use python. 2. The script only reads the sheet. It prints a JSON report and exits with 0 (clean), 1 (problems) or 2 (it could not check; show its error). 3. If Python is missing, check the rules below by reading the sheet yourself, and say so. ## Rules 1. Line 1 is exactly: sku,name,price_eur,burn_hours 2. Every row has a sku, and no sku appears twice. 3. price_eur has two decimals, for example 18.50. 4. burn_hours is a whole number. ## Report List each problem as: line number, sku, what is wrong. Line 1 is the header. End with "Sheet OK" when there are no problems, or "N problems found". - Start Codex in the practice folder.
cd mosswick-candles codex - Type
/permissionsand choose Read Only, the preset for reviewing what Codex does. Read Only may still run a read-only script in its sandbox without asking. - Ask the question without naming the skill.
Is my product sheet OK? - If Codex asks to run the script, read the full command. It should be check_products.py on products.csv and nothing else. Approve it.
- Check that the answer lists lines 3, 4 and 5 and ends with 3 problems found.
- Type
/permissionsand choose Auto again, then type/exit.
Note: In Auto, which Codex recommends for a folder under git, Codex runs routine commands inside the project in a sandbox without asking, with no network access. This guide switches to Read Only for one run so you stay in charge.
Paid planOpenAI lists the Codex CLI for ChatGPT Plus, Pro, Business, Edu and Enterprise. Free and Go list Codex in the desktop app only, subject to rollout. An API key also works.
GitHub Copilot
- In your editor, create
scripts/check_products.pyinside the skill folder with this code and save it.# Read-only check of a product sheet (CSV). import csv, json, re, sys HEADER = ["sku", "name", "price_eur", "burn_hours"] def main(args): if len(args) != 1 or args[0] in ("-h", "--help"): print("Usage: check_products.py SHEET.csv (exit 0 clean, 1 problems, 2 error)") return 0 if args[:1] in (["-h"], ["--help"]) else 2 try: with open(args[0], newline="", encoding="utf-8-sig") as f: rows = list(csv.reader(f)) except OSError as e: print(f"Error: cannot read {args[0]}: {e.strerror}", file=sys.stderr) return 2 if not rows or rows[0] != HEADER: print("Error: line 1 must be " + ",".join(HEADER), file=sys.stderr) return 2 problems, seen = [], set() for line, row in enumerate(rows[1:], start=2): sku, _, price, hours = (row + [""] * 4)[:4] found = [] if not sku: found.append("missing sku") elif sku in seen: found.append("duplicate sku") seen.add(sku) if not re.fullmatch(r"\d+\.\d{2}", price): found.append(f"price_eur needs two decimals: '{price}'") if not re.fullmatch(r"\d+", hours): found.append(f"burn_hours must be a whole number: '{hours}'") problems += [{"line": line, "sku": sku, "problem": p} for p in found] print(json.dumps({"sheet": args[0], "rows": len(rows) - 1, "problems": problems}, indent=2)) return 1 if problems else 0 sys.exit(main(sys.argv[1:])) - Replace the whole text of the skill's SKILL.md with this version, which tells the agent to run the script, and save it.
--- name: product-sheet-check description: Checks a Mosswick Candles product sheet (a CSV with sku, name, price_eur and burn_hours) for missing or duplicate SKUs, prices without two decimals and burn times that are not whole numbers. Use when asked to check, validate or review products.csv or another product sheet, for example before an upload. Do not use for writing product texts, changing prices or making a new sheet. --- # Product sheet check Check the product sheet the user names. If they name none, use products.csv in the project root. Never change the sheet. ## Steps 1. Run scripts/check_products.py, which is in this skill's folder, with Python 3. Call it by its full path and pass the full path of the sheet as the only argument. Use python3; if that command is not found, use python. 2. The script only reads the sheet. It prints a JSON report and exits with 0 (clean), 1 (problems) or 2 (it could not check; show its error). 3. If Python is missing, check the rules below by reading the sheet yourself, and say so. ## Rules 1. Line 1 is exactly: sku,name,price_eur,burn_hours 2. Every row has a sku, and no sku appears twice. 3. price_eur has two decimals, for example 18.50. 4. burn_hours is a whole number. ## Report List each problem as: line number, sku, what is wrong. Line 1 is the header. End with "Sheet OK" when there are no problems, or "N problems found". - Start Copilot in the practice folder, or type
/skills reloadif it is already running.cd mosswick-candles copilot - Ask the question without naming the skill.
Is my product sheet OK? - When Copilot asks for approval to run the script, read the command. Choose Yes to allow it this one time only.
- Check that the answer lists lines 3, 4 and 5 and ends with 3 problems found. Then type
/exit.
Note: Leave allowed-tools out of the header. GitHub warns that pre-approving shell or bash removes the confirmation step. In Copilot CLI, earlier approvals or permission settings can also skip the prompt.
Google Antigravity
- In your editor, create
scripts/check_products.pyinside the skill folder with this code and save it.# Read-only check of a product sheet (CSV). import csv, json, re, sys HEADER = ["sku", "name", "price_eur", "burn_hours"] def main(args): if len(args) != 1 or args[0] in ("-h", "--help"): print("Usage: check_products.py SHEET.csv (exit 0 clean, 1 problems, 2 error)") return 0 if args[:1] in (["-h"], ["--help"]) else 2 try: with open(args[0], newline="", encoding="utf-8-sig") as f: rows = list(csv.reader(f)) except OSError as e: print(f"Error: cannot read {args[0]}: {e.strerror}", file=sys.stderr) return 2 if not rows or rows[0] != HEADER: print("Error: line 1 must be " + ",".join(HEADER), file=sys.stderr) return 2 problems, seen = [], set() for line, row in enumerate(rows[1:], start=2): sku, _, price, hours = (row + [""] * 4)[:4] found = [] if not sku: found.append("missing sku") elif sku in seen: found.append("duplicate sku") seen.add(sku) if not re.fullmatch(r"\d+\.\d{2}", price): found.append(f"price_eur needs two decimals: '{price}'") if not re.fullmatch(r"\d+", hours): found.append(f"burn_hours must be a whole number: '{hours}'") problems += [{"line": line, "sku": sku, "problem": p} for p in found] print(json.dumps({"sheet": args[0], "rows": len(rows) - 1, "problems": problems}, indent=2)) return 1 if problems else 0 sys.exit(main(sys.argv[1:])) - Replace the whole text of the skill's SKILL.md with this version, which tells the agent to run the script, and save it.
--- name: product-sheet-check description: Checks a Mosswick Candles product sheet (a CSV with sku, name, price_eur and burn_hours) for missing or duplicate SKUs, prices without two decimals and burn times that are not whole numbers. Use when asked to check, validate or review products.csv or another product sheet, for example before an upload. Do not use for writing product texts, changing prices or making a new sheet. --- # Product sheet check Check the product sheet the user names. If they name none, use products.csv in the project root. Never change the sheet. ## Steps 1. Run scripts/check_products.py, which is in this skill's folder, with Python 3. Call it by its full path and pass the full path of the sheet as the only argument. Use python3; if that command is not found, use python. 2. The script only reads the sheet. It prints a JSON report and exits with 0 (clean), 1 (problems) or 2 (it could not check; show its error). 3. If Python is missing, check the rules below by reading the sheet yourself, and say so. ## Rules 1. Line 1 is exactly: sku,name,price_eur,burn_hours 2. Every row has a sku, and no sku appears twice. 3. price_eur has two decimals, for example 18.50. 4. burn_hours is a whole number. ## Report List each problem as: line number, sku, what is wrong. Line 1 is the header. End with "Sheet OK" when there are no problems, or "N problems found". - Start the Antigravity CLI in the practice folder, or type
/skills reloadif it is already running.cd mosswick-candles agy - Press Shift + Tab until the mode indicator in the status bar clears. That is default mode, in which the CLI asks before it runs terminal commands.
- Ask the question without naming the skill.
Is my product sheet OK? - When the CLI asks to run the script, read the command. It should be check_products.py on products.csv and nothing else. Approve it.
- Check that the answer lists lines 3, 4 and 5 and ends with 3 problems found. Press Shift + Tab to return to the mode you use, then type
/exit.
Note: In auto mode, the start mode where available, commands run in a terminal sandbox without asking: the project folder is writable and network access is limited to domains you approved. On Windows the sandbox needs Windows 11 24H2 or later with the August 2026 update.
Create a free account to save your progress
Free, and no payment details. Your ticks and finished lessons are kept, on every device.
Create a free account I already have an accountCreate a free account to save your progress. Sign in or sign up