code-execution
Scannednpx machina-cli add skill ggozad/haiku.skills/code-execution --openclawCode 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
- Execute the code and return the result
- Report any errors clearly and retry with a fix if needed
Sandbox limitations
Code runs in Monty, a minimal sandboxed Python interpreter. Only these features are available:
- Basic types: int, float, str, bool, list, dict, tuple, None
- Control flow: if/elif/else, for, while, break, continue
- Functions: def, lambda, return (no classes)
- Built-in modules: sys, typing, asyncio, dataclasses, json
- Built-in functions: print, len, range, enumerate, zip, map, filter, sorted, reversed, min, max, sum, abs, round, isinstance, type, str, int, float, bool, list, dict, tuple, set
Not available: standard library (os, math, re, etc.), third-party packages, file/network/environment access, classes, match statements.
Source
git clone https://github.com/ggozad/haiku.skills/blob/main/skills/code-execution/haiku_skills_code_execution/code-execution/SKILL.mdView on GitHub Overview
Code Execution turns task descriptions into Python code, runs it in Monty’s sandbox, and returns the result. It translates requirements into executable Python, executes the solution, and reports any errors clearly. If something goes wrong, it retries with a fix within sandbox limits.
How This Skill Works
It converts a description into working Python code, then executes it with the run_code tool inside a restricted sandbox. It captures stdout and returns the result, along with any runtime or syntax errors. If errors occur, it provides a clear report and can retry after code adjustments within the allowed features.
When to Use It
- You need a small Python script to produce a numeric or string result from a task description.
- You want immediate code execution feedback for a simple algorithm or data transformation.
- You want to validate a solution by running it with concrete input and inspecting the output.
- You need quick iteration when refining a coding solution within sandbox constraints.
- You want to prototype ideas without setting up external dependencies or files.
Quick Start
- Step 1: Describe the task clearly and specify expected input and output.
- Step 2: Write concise Python code that solves the task and run it with the run_code tool.
- Step 3: Review the output, fix any errors, and re-run until the result matches expectations.
Best Practices
- Provide a precise task description with expected input and output.
- Keep tasks within Monty's feature set (no external libraries, no file I/O).
- Start with a minimal, deterministic input to avoid flaky results.
- Validate results by printing or comparing against expected values.
- Iterate by correcting syntax or logic errors and re-running until satisfied.
Example Use Cases
- Compute the sum of numbers from 1 to N.
- Reverse a given string and return the result.
- Sort a list of integers in ascending order.
- Count the number of vowels in a sentence.
- Check if a given integer is prime.