safe_run

safe_run is a skill for Claude Code, Codex from isLinXu/crablet. It costs 11 tokens per session (481 once invoked), scanned A, original, MIT.

A skill for running shell commands inside an isolated Docker container, a lightweight environment separated from the main computer.

In plain words
What is it for?
Use it to execute command-line tasks with limits on network access, memory, and CPU.
Why use it?
It reduces the risk that a command will affect the host system and disables network access by default.

Skill for Claude CodeCodex

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

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.

agentmods
npx agentmods add skills/islinxu/crablet/safe_run
Any agent
npx skills add isLinXu/crablet --skill safe_run
Clone the repo
git clone --depth 1 https://github.com/isLinXu/crablet

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 safe_run

README.md
[![agentmods](https://agentmods.dev/badge/skills/islinxu/crablet/safe_run.svg)](https://agentmods.dev/skills/islinxu/crablet/safe_run)
Your own site
<a href="https://agentmods.dev/skills/islinxu/crablet/safe_run"><img src="https://agentmods.dev/badge/skills/islinxu/crablet/safe_run.svg" alt="Measured on agentmods" height="20"></a>
Per session 11 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 481 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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.00011 $0.00481
Opus 5 $0.00005 $0.00241
Sonnet 5 $0.00002 $0.00096
Haiku 4.5 $0.00001 $0.00048

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

Security

Grade A, and why

safe_run scanned grade A with 1 finding 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 6d 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

result = subprocess.run(
crablet/skills/safe_run/SKILL.md · 72 lines

What it actually says

Safe Run Skill

This skill executes shell commands inside an isolated Docker container to prevent harm to the host system.

Tools

run_command

Executes a command in a sandboxed environment.

  • command (string): The shell command to execute.

Implementation

import subprocess
import shlex

def run_command(command: str) -> str:
    """
    Executes a command inside an ephemeral Docker container (alpine).
    The container is removed immediately after execution (--rm).
    Network access is disabled by default (--network none) for security,
    unless explicitly needed (can be configured).
    """
    
    # Security: Use shlex to quote the user command to prevent injection outside the container command
    # However, since we are passing the whole string to /bin/sh -c inside docker, 
    # we need to be careful. Ideally we pass it as a single argument.
    
    # Docker command structure:
    # docker run --rm --network none alpine /bin/sh -c "command"
    
    docker_cmd = [
        "docker", "run", "--rm",
        "--network", "none",  # Disable network for SSRF prevention
        "--memory", "128m",   # Limit memory
        "--cpus", "0.5",      # Limit CPU
        "alpine:latest",      # Use lightweight image
        "/bin/sh", "-c", command
    ]
    
    try:
        # Run docker command
        result = subprocess.run(
            docker_cmd,
            capture_output=True,
            text=True,
            timeout=30 # Hard timeout of 30 seconds
        )
        
        if result.returncode != 0:
            return f"Error (Exit Code {result.returncode}):\n{result.stderr}"
            
        return result.stdout if result.stdout else "(No output)"
        
    except subprocess.TimeoutExpired:
        return "Error: Command execution timed out (30s limit)."
    except Exception as e:
        return f"System Error: {str(e)}"

# Register the tool
register_tool("run_command", run_command)
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. 6d ago First seen · 72 lines · 11 tokens per session scan A bbbae963c740

Subscribe to this mod's changes

safe_run is a skill published in the GitHub repository isLinXu/crablet (56 stars, last pushed 6d ago), licensed MIT. It adds 11 tokens to every session and 481 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

exec-local-docker

Execute a TensorRT-LLM workload locally in Docker. Runs a fully-resolved Docker command in background, monitors completion, reads logs, and reports results. Workflow-agnostic — does not need to know if the workload is pytest, eval, benchmark, or a custom script.

NVIDIA/TensorRT-LLM · 62 tokens

harbor

CLI toolkit for managing containerized LLM services. Use when the user wants to start, stop, configure, or manage AI/LLM services like Ollama, Open WebUI, llama.cpp, vLLM, LiteLLM, ComfyUI, and 250+ others. Triggers on requests to "run a model", "start ollama", "set up an LLM", "configure harbor", "manage services"…

av/harbor · 114 tokens

new-service

Add a new service to Harbor — scaffold the compose config, environment variables, metadata, documentation, and cross-service integrations. Use this skill whenever the user wants to add a new service to Harbor, integrate a new tool/app/model server, create a compose configuration for a new project, or onboard any…

av/harbor · 139 tokens

ecspresso

ECS deployment tool - deploy, manage, and troubleshoot ECS services.

kayac/ecspresso · 17 tokens

hardening-docker-containers-for-production

Hardening Docker containers for production involves applying security best practices aligned with CIS Docker Benchmark v1.8.0 to minimize attack surface, prevent privilege escalation, and enforce leas.

xalgorix/xalgorix · 43 tokens

scanning-docker-images-with-trivy

Trivy is a comprehensive open-source vulnerability scanner by Aqua Security that detects vulnerabilities in OS packages, language-specific dependencies, misconfigurations, secrets, and license violati.

xalgorix/xalgorix · 42 tokens