Agent skill

Safe Script Execution

by HKUDS in HKUDS/OpenSpace

Fallback workflow for code execution when automated tools fail, using shell heredoc with verification

MITAuto-check passed

Install Safe Script Execution

skills CLI
$ npx skills add HKUDS/OpenSpace --skill safe-script-execution -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/OpenSpace safe-script-execution --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/OpenSpace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/benchmarks/gdpval/skills/safe-script-execution .claude/skills/safe-script-execution && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
safe-script-execution
GitHub stars
7.7k
Token cost
~830 tokens
SKILL.md length
272 words
Files
2
Skills in repo
199
Repo updated
First seen
Licence
MIT

At a glance

Fallback workflow for code execution when automated tools fail, using shell heredoc with verification

  • Works in 5 steps: Verify Working Directory → Create Script via Heredoc → Make Executable and Run with Explicit Path → …
  • SKILL.md covers When to Use This Skill, Step-by-Step Instructions, Example: PDF Generation Fallback and Anti-Patterns to Avoid, plus 1 more section
  • Calls python3

What it does

Safe Script Execution is an agent skill from HKUDS/OpenSpace. Fallback workflow for code execution when automated tools fail, using shell heredoc with verification

Its SKILL.md is about 830 tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file.

The repository describes itself as: "OpenSpace: The Skill Management Layer for AI Agents" -- https://open-space.cloud/. The licence is MIT.

Example prompts

  • “/safe-script-execution”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Verify Working Directory
  2. Create Script via Heredoc
  3. Make Executable and Run with Explicit Path
  4. Verify Output
  5. Error Handling

What it can do on your machine

Read from SKILL.md and the folder at commit 3827781. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Safe Script Execution loads about 830 tokens when it runs. Until then it costs about 31 tokens; SKILL.md has 272 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~31
When it runs · the whole SKILL.md, loaded when a task matches
~830

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/OpenSpace at commit 3827781, republished under its MIT licence (© HKUDS). 272 words, ~830 tokens.

Download SKILL.mdSave it as .claude/skills/safe-script-execution/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
safe-script-execution
description
Fallback workflow for code execution when automated tools fail, using shell heredoc with verification

Safe Script Execution Fallback

When to Use This Skill

Use this pattern when execute_code_sandbox or shell_agent repeatedly fails to produce expected outputs. This manual fallback provides explicit control over script creation and execution with built-in verification.

Step-by-Step Instructions

Step 1: Verify Working Directory

Before creating any scripts, confirm your current location and permissions:

bash
pwd
ls -la

Document the absolute path. All subsequent file operations should use explicit paths from this point.

Step 2: Create Script via Heredoc

Use shell heredoc syntax to create scripts. This avoids issues with multi-line string escaping:

bash
cat > /full/path/to/script.py << 'HEREDOC_END'
#!/usr/bin/env python3
# Your script content here
# Single quotes around delimiter prevent variable expansion
print("Hello from script")
HEREDOC_END

Key escaping rules:

  • Use single quotes around heredoc delimiter ('EOF') to prevent shell variable expansion
  • If script contains the delimiter string, choose a different unique delimiter
  • For bash scripts containing special characters, escape $, backticks, and !
Step 3: Make Executable and Run with Explicit Path
bash
chmod +x /full/path/to/script.py
/full/path/to/script.py

Always use the full absolute path, never rely on . or relative paths.

Step 4: Verify Output

Confirm files were created and inspect their properties:

bash
# Check file exists with size
ls -lh /full/path/to/output.file

# For PDFs, inspect metadata
pdfinfo /full/path/to/output.pdf 2>/dev/null || file /full/path/to/output.pdf

# For Word docs, check file type
file /full/path/to/output.docx
Step 5: Error Handling

If execution fails:

  1. Check script syntax: python3 -m py_compile /path/to/script.py
  2. Check permissions: ls -l /path/to/script.py
  3. Check available disk space: df -h .
  4. Review stderr output carefully

Example: PDF Generation Fallback

bash
# Step 1: Verify directory
pwd
ls -la

# Step 2: Create Python script
cat > /workspace/generate_pdf.py << 'SCRIPT_END'
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas

c = canvas.Canvas("/workspace/output.pdf", pagesize=letter)
c.drawString(100, 750, "Generated PDF")
c.save()
SCRIPT_END

# Step 3: Execute
chmod +x /workspace/generate_pdf.py
python3 /workspace/generate_pdf.py

# Step 4: Verify
ls -lh /workspace/output.pdf
pdfinfo /workspace/output.pdf 2>/dev/null || echo "PDF created, pdfinfo unavailable"

Anti-Patterns to Avoid

  • ❌ Don't use relative paths like ./script.py - always use absolute paths
  • ❌ Don't rely on unquoted heredoc delimiters if script contains variables
  • ❌ Don't skip verification steps - always confirm output exists and has expected size
  • ❌ Don't assume working directory - always pwd first

Troubleshooting Checklist

  • Working directory confirmed with pwd
  • Script file exists after heredoc creation (ls -l)
  • Script has execute permissions (chmod +x)
  • Output file exists with non-zero size (ls -lh)
  • File type verified (file command or type-specific inspection)

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in benchmarks/gdpval/skills/safe-script-execution of HKUDS/OpenSpace.

  • SKILL.md
  • .skill_id

Open the folder on GitHubat commit 3827781

Compare with similar skills

Safe Script Execution next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Safe Script Execution compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Safe Script Execution this skillHKUDS/OpenSpace7.7k—~830Automated safety check: PassMIT
Autom AutomationComposioHQ/awesome-claude-skills77k3 repos~723Automated safety check: PassNone
Doppler Marketing Automation AutomationComposioHQ/awesome-claude-skills77k3 repos~809Automated safety check: PassNone
Aero Workflow AutomationComposioHQ/awesome-claude-skills77k3 repos~753Automated safety check: PassNone
Anchor Browser AutomationComposioHQ/awesome-claude-skills77k3 repos~757Automated safety check: PassNone
Automate Thisgithub/awesome-copilot40k1 repos~3.1kAutomated safety check: PassMIT

Similar skills

  • Autom Automation

    ComposioHQ/awesome-claude-skills

    Automate Autom tasks via Rube MCP (Composio). An agent skill from ComposioHQ/awesome-claude-skills.

    77k GitHub starsUsed in 3 repos~723 tokens
    Productivity & AutomationAuto-check passed
  • Doppler Marketing Automation Automation

    ComposioHQ/awesome-claude-skills

    Automate Doppler Marketing Automation tasks via Rube MCP (Composio).

    77k GitHub starsUsed in 3 repos~809 tokens
    Productivity & AutomationAuto-check passed
  • Aero Workflow Automation

    ComposioHQ/awesome-claude-skills

    Automate Aero Workflow tasks via Rube MCP (Composio). An agent skill from ComposioHQ/awesome-claude-skills.

    77k GitHub starsUsed in 3 repos~753 tokens
    Productivity & AutomationAuto-check passed
  • Anchor Browser Automation

    ComposioHQ/awesome-claude-skills

    Automate Anchor Browser tasks via Rube MCP (Composio). An agent skill from ComposioHQ/awesome-claude-skills.

    77k GitHub starsUsed in 3 repos~757 tokens
    Productivity & AutomationAuto-check passed
  • Automate This

    github/awesome-copilot

    Official

    Analyze a screen recording of a manual process and produce targeted, working automation scripts.

    40k GitHub starsUsed in 1 repo~3.1k tokens
    Media & CreativeAuto-check passed
  • Agent skill for workflow-automation - invoke with $agent-workflow-automation

    74k GitHub starsUsed in 2 repos~4k tokens
    Productivity & AutomationAuto-check passed

More from HKUDS/OpenSpace

All 199 skills in this repo
  • Walks through producing a master audio track plus stems in Python, from checking a reference file and timing sections by BPM to effects, a zip archive and final verification.

    7.7k GitHub stars~2.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Handle cascading data retrieval tool failures by falling back to embedded knowledge generation

    7.7k GitHub stars~765 tokensUpdated 1 mo ago
    Auto-check passed
  • Gives an agent a workaround when its code-execution sandbox keeps failing: save the Python script to a file and run it through the shell instead.

    7.7k GitHub stars~588 tokensUpdated 1 mo ago
    Auto-check passed
  • A recovery routine for agents whose sandboxed code runner keeps failing: save the Python script to disk, then run it through the shell and read the output.

    7.7k GitHub stars~652 tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback ladder for failed sandboxed code runs, plus the habit of fixing the working directory first so generated files land in the right place.

    7.7k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback workflow for executing Python code when executecodesandbox fails repeatedly

    7.7k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Safe Script Execution

What does Safe Script Execution do?

Fallback workflow for code execution when automated tools fail, using shell heredoc with verification. Safe Script Execution is an agent skill from HKUDS/OpenSpace.

How do I install Safe Script Execution in Claude Code?

Run `npx skills add HKUDS/OpenSpace --skill safe-script-execution -a claude-code`. Or copy the skill folder (benchmarks/gdpval/skills/safe-script-execution in HKUDS/OpenSpace) into .claude/skills/safe-script-execution in your project. Claude Code loads it when a task matches its description.

How do I install Safe Script Execution in Codex?

Run `npx skills add HKUDS/OpenSpace --skill safe-script-execution -a codex`. Or copy the skill folder (benchmarks/gdpval/skills/safe-script-execution in HKUDS/OpenSpace) into .agents/skills/safe-script-execution in your project. Codex loads it when a task matches its description.

Can I use Safe Script Execution in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/OpenSpace --skill safe-script-execution -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/safe-script-execution, .gemini/skills/safe-script-execution, .github/skills/safe-script-execution and .opencode/skills/safe-script-execution in your project.

What does Safe Script Execution need to run?

Going by SKILL.md and its folder, Safe Script Execution needs the command-line tools its instructions call (python3). Our summary lists: Python 3.

Does Safe Script Execution access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Safe Script Execution safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Safe Script Execution use?

Safe Script Execution is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Safe Script Execution use?

About 830 tokens (SKILL.md is roughly 3.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Safe Script Execution?

Skills that share tags, products or a category with Safe Script Execution: Autom Automation (ComposioHQ/awesome-claude-skills, 77k stars), Doppler Marketing Automation Automation (ComposioHQ/awesome-claude-skills, 77k stars), Aero Workflow Automation (ComposioHQ/awesome-claude-skills, 77k stars) and Anchor Browser Automation (ComposioHQ/awesome-claude-skills, 77k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Safe Script Execution?

HKUDS (a GitHub organization) maintains it in HKUDS/OpenSpace, which has 7,743 GitHub stars. The repository holds 199 skills in this directory. The repository was last updated on August 12, 2026.

Source: HKUDS/OpenSpace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.