reliable-script-execution

reliable-script-execution is a skill for Claude Code, Codex from HKUDS/OpenSpace. It costs 18 tokens per session (659 once invoked), scanned A, original, MIT.

A file-first workflow for running Python scripts when inline execution is unreliable. It saves the script to a file, runs it from a clear directory, and can remove the temporary file afterward.

In plain words
What is it for?
Running repeatable Python tasks that need multiple lines of code or dependable file paths.
Why use it?
It reduces failures caused by long inline commands, special characters, or unclear working directories.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Running repeatable Python tasks that need multiple lines of code or dependable file paths.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hkuds/openspace/reliable-script-execution
About the project

OpenSpace is a skill-management layer for AI agents that stores, retrieves, evaluates, shares, and improves reusable workflows. It is intended for people using multiple coding agents who want skills to be reused and refined based on task outcomes. The catalogue provides 200 skills for use with OpenSpace and the agents it supports.

HKUDS/OpenSpace · 7,534 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add HKUDS/OpenSpace --skill reliable-script-execution
Clone the repo
git clone --depth 1 https://github.com/HKUDS/OpenSpace

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for reliable-script-execution

README.md
[![agentmods](https://agentmods.dev/badge/skills/hkuds/openspace/reliable-script-execution.svg)](https://agentmods.dev/skills/hkuds/openspace/reliable-script-execution)
Your own site
<a href="https://agentmods.dev/skills/hkuds/openspace/reliable-script-execution"><img src="https://agentmods.dev/badge/skills/hkuds/openspace/reliable-script-execution.svg" alt="Measured on agentmods" height="20"></a>
Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 659 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Tool Misuse · line 53
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 87
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00018 $0.00659
Opus 5 $0.00009 $0.00329
Sonnet 5 $0.00004 $0.00132
Haiku 4.5 $0.00002 $0.00066

Measured 4d ago against content hash 09bcbe1bfb0c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

reliable-script-execution scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

benchmarks/gdpval/skills/reliable-script-execution/SKILL.md · 120 lines

How it starts

The opening of the file, as written. The whole thing — 120 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Reliable Script Execution

When executing Python code via shell commands, avoid inline heredoc execution which can fail unpredictably with 'unknown error'. Use this two-step file-first approach for more reliable script execution.

Problem

Direct heredoc Python execution like:

python3 << 'EOF'
# complex code here
EOF

Can fail with 'unknown error', especially when:

  • Script contains multiple lines or complex logic
  • Special characters or quotes are present
  • Working directory context matters

Solution: File-First Approach

Step 1: Write Python Script to File

Use write_file to save your Python code to a .py file:

write_file(path="./temp_script.py", content="""
import json

data = {"key": "value"}
print(json.dumps(data))
""")

Step 2: Execute via Shell

Use run_shell with explicit working directory:

run_shell(command="python3 ./temp_script.py", timeout=60)

Step 3: Clean Up (Optional)

Remove temporary files after execution:

run_shell(command="rm ./temp_script.py")

Complete Example

Task: Generate a JSON report with calculations

# Step 1: Write the script
write_file(
    path="./generate_report.py",
    content="""
import json
from datetime import datetime

revenue = 500000.00
expenses = 379577.06
net_income = revenue - expenses

report = {
    "generated": datetime.now().isoformat(),
    "revenue": revenue,
    "expenses": expenses,
    "net_income": net_income
}

print(json.dumps(report, indent=2))
"""
)

# Step 2: Execute
run_shell(command="python3 ./generate_report.py", timeout=60)

# Step 3: Clean up
run_shell(command="rm ./generate_report.py")

Best Practices

  1. Use descriptive filenames: Name scripts according to their purpose (e.g., calculate_pnl.py, transform_data.py)

  2. Set appropriate timeouts: For data processing scripts, use longer timeouts (60-300 seconds)

  3. Specify working directory: If the script depends on relative paths, include cd /path && python3 script.py

Read the full file on GitHub · 120 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 120 lines · 18 tokens per session scan A 09bcbe1bfb0c

Subscribe to this mod's changes

reliable-script-execution is a skill published in the GitHub repository HKUDS/OpenSpace (7,534 stars, last pushed 26d ago), licensed MIT. It adds 18 tokens to every session and 659 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.