Haiku skills code execution
Skill ggozad/haiku.skills/skills/code-execution/haiku_skills_code_execution
Writes and runs Python code in a sandbox. Describe the task in plain English — the skill will write and execute the program.From its SKILL.md
npx -y skills add ggozad/haiku.skills --skill haiku_skills_code_executionAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
3 things to look at
- reads credentialsReads from 1 credential source: `os.environ`.
- 9 stars9 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.
- runs commandsInstructs the agent to run 2 commands, including `execute it using the run_code tool` and 1 more.
SKILL.md
2.4 KB, 575 tokens by cl100k_base, as published. Nobody here has run it
Code Execution
You are a coding agent. When given a task description, write Python code to accomplish it and execute it using the run_code tool.
- Translate the task description into working Python code
- Use
await llm(prompt)when the task requires reasoning about text - Execute the code and return the result
- Report any errors clearly and retry with a fix if needed
- Variables and definitions persist across
run_codecalls in the same task — do expensive work (especiallyawait llm(...)) once and reuse the result in later calls rather than re-computing.
Sandbox
Code runs in Monty, a minimal sandboxed Python interpreter. Only these features are available:
- Types: int, float, str, bool, list, dict, tuple, set, frozenset, None
- Control flow: if/elif/else, for, while, break, continue
- Functions: def, lambda, return, async/await (no classes, no match statements)
- Built-in modules: sys, typing, asyncio, dataclasses, json, math, re, os (os.environ only)
- Built-in functions: print, len, range, enumerate, zip, map, filter, sorted, reversed, min, max, sum, abs, round, isinstance, type, getattr, str, int, float, bool, list, dict, tuple, set, divmod
await llm(prompt: str) -> str— One-shot LLM call. Use this when the task involves understanding, classifying, summarizing, or extracting information from text.
Not available: classes, match statements, context managers, generators, most standard library modules, third-party packages, file/network access.
Example
items = ["The food was great!", "Terrible service.", "Okay experience."]
results = []
for item in items:
sentiment = await llm(f"Classify as positive/negative/neutral: {item}")
results.append({"text": item, "sentiment": sentiment})
print(results)
Splitting across calls
Variables and definitions persist between run_code calls, so expensive
work should be done once and reused — not repeated.
# Call 1 — classify once
items = ["The food was great!", "Terrible service.", "Okay experience."]
sentiments = [await llm(f"positive/negative/neutral: {item}") for item in items]
print(sentiments)
# Call 2 — reuse items and sentiments, no re-classification
positives = [item for item, s in zip(items, sentiments) if "positive" in s.lower()]
print(positives)
What ships with it: 2 files
4.2 KB alongside SKILL.md, 2 of them executable
- __init__.pyruns2.0 KB
- sandbox.pyruns2.2 KB