design-tool-use-sandboxing
Skill4 starsChanged 3 months agoMITView on GitHub
WHEN/WHERE/WHO: [Scheduling: Agents or architects granting LLMs access to terminal commands, file systems, or external APIs.] HOW: [Structural: Use this SKILL to enforce boundary protections, user-approval loops, and containerized execution for dangerous tools.] WHY: [Scheduling: Autonomous agents carry user-level privileges. Unconstrained tool execution leads to catastrophic code deletion or security breaches.]
- Reads credentials
- Deletes or force-pushes
In this repository61 other files it gives its agents.
- activate-personalSkill
- analyze-with-tactics-questionnairesSkill
- apply-agile-testing-quadrantsSkill
- apply-architectural-tacticsSkill
- apply-attribute-driven-designSkill
- apply-fundamentals-of-data-visualizationSkill
- apply-oopsi-modelSkill
- apply-screenplay-patternSkill
- apply-specification-by-exampleSkill
- blog-topic-discoverSkill
- build-agent-memory-systemsSkill
- build-business-objectives-modelSkill
- build-data-dictionarySkill
- build-feature-treeSkill
- comment-alive-test-driven-developmentSkill
- conduct-event-stormingSkill
- create-ecosystem-mapSkill
- create-living-documentationSkill
- create-skill-from-bookSkill
- CREATING-SKILL-TEMPLATESkill
- define-architectural-driversSkill
- define-bounded-contextsSkill
- define-ubiquitous-languageSkill
- design-agentic-screenplay-modelSkill
- design-agent-perception-layersSkill
- design-agent-planningSkill
- design-agent-reward-functionsSkill
- design-agents-using-patternsSkill
- design-architecture-viewpointsSkill
- design-autonomous-ai-interfacesSkill
- design-ddd-aggregatesSkill
- document-architectural-decisionsSkill
- document-legacy-codebaseSkill
- doc-with-usage-exampleSkill
- draft-srs-documentSkill
- elicit-requirements-modelsSkill
- evolve-skill-with-wikiSkill
- extract-business-rulesSkill
- facilitate-example-mappingSkill
- facilitate-user-story-mappingSkill
- implement-agent-observabilitySkill
- implement-agent-reflectionSkill
- improve-existing-skillSkill
- improve-user-storySkill
- managing-ai-projectsSkill
- orchestrate-multi-agent-collaborationSkill
- prioritize-requirementsSkill
- review-c4-modelSkill
- review-data-engineeringSkill
- save-as-skillSkill
- scaffold-cmake-cxx-sanitize-gtest-envSkill
- skill-commonSkill
- task-commit-triggerSkill
- test-case-with-demoSkill
- test-case-with-readmeSkill
- test-driven-developmentSkill
- UnitTesting-convert2CaTDDSkill
- update-my-resumeSkill
- update-spec-contextSkill
- validate-requirements-criteriaSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
When this skill is activated, first load skill-common and apply the shared conventions it defines: canonical section order, frontmatter …
- Distinctive: line 23
Must be used anytime an agent is given write, delete, or execute permissions.
- Very specific: line 29
When an LLM hallucinates a command like rm -rf /tmp/cache but makes a syntax error resulting in rm -rf / tmp/cache, the host machine is …
- Distinctive: line 45
Transfer Check: Verify the workflow still works across host execution, containerized execution, and mixed tool environments.
- Distinctive: line 46
Stop Rule: If the execution environment cannot provide either safe sandboxing or explicit approval gates, stop and warn instead of enabling …
- Distinctive: line 53
If the user asks to disable human-in-the-loop approvals for shell commands on their host machine, strongly warn them of the risks and …
- Distinctive: line 65
If an LLM passes a malformed argument, the tool wrapper must catch the exception and return a clear error message *back to the LLM* so it …
- Very specific: line 70
If the user rejects, return a message to the agent: "Tool execution rejected by human.
- Distinctive: line 73
If full autonomy is required for dangerous tools, execute them inside a Docker container or ephemeral virtual machine.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Design Tool Use Sandboxing
Common Contract (Load First)
When this skill is activated, first load skill-common and apply the shared conventions it defines: canonical section order, frontmatter rules, anti-pattern guidance, and the Review In Mind loop in review-in-mind. This skill adds only domain-specific rules below.
Who
Architects, security engineers, or coding agents integrating tool-use (function calling) capabilities into autonomous systems.
What
Implement secure execution environments and "human-in-the-loop" approval gates for any tools that mutate state, execute arbitrary code, or interact with external networks.
When
- Triggered by requests like: "give the agent a bash tool", "allow the agent to run scripts", or "add secure tool calling".
- Must be used anytime an agent is given write, delete, or execute permissions.
Where
Applies to the tool definition and execution layers of the agent orchestration framework.
Why
When an LLM hallucinates a command like rm -rf /tmp/cache but makes a syntax error resulting in rm -rf / tmp/cache, the host machine is destroyed. Agents must be treated as untrusted users. Proper sandboxing and human-approval gates are mandatory for safety.
Inputs
- Requested Tools: The list of functions the agent needs to call.
- Execution Environment: The target OS or container where tools will run.
Output (Logical Evidence)
- Secure Tool Wrappers: Code that wraps raw functions with validation and approval logic.
- Sandbox Architecture: A Dockerfile or DevContainer configuration for isolated execution.
Optimization Readiness
- Failure Signals: Dangerous tools bypass approval, schemas accept malformed arguments, host execution remains unsandboxed, or the workflow normalizes risky autonomy without clear human gates.
- Evidence To Collect: Wrapper schemas, approval prompts, rejected tool calls, sandbox configs, and examples of blocked versus permitted mutative actions.
- Safe Mutation Boundaries: Refine tool categorization, validation rules, approval UX, and sandbox examples without weakening the core safety boundary between read-only and mutative execution.
- Acceptance Criteria: Accept revisions only if dangerous actions are gated or isolated, malformed inputs are rejected cleanly, and users can inspect exactly what an agent wants to execute.
- Rejected Revision Handling: Record unsafe bypass proposals, weak validation patterns, and ambiguous approval wording so they are not reintroduced.
- Transfer Check: Verify the workflow still works across host execution, containerized execution, and mixed tool environments.
- Stop Rule: If the execution environment cannot provide either safe sandboxing or explicit approval gates, stop and warn instead of enabling dangerous tools.
Constraints (Logical Boundaries)
- Mandatory Approval for Mutative Actions: Any tool that alters the file system, modifies databases, or executes shell commands MUST pause and wait for explicit human approval, unless running in a fully disposable, isolated container.
- Strict Parameter Validation: Tool inputs generated by the LLM must be validated against a strict schema (e.g., Pydantic) before execution.
One More Thing
If the user asks to disable human-in-the-loop approvals for shell commands on their host machine, strongly warn them of the risks and ensure they explicitly accept responsibility before proceeding.
How (Structural Workflow)
1. Categorize the Tools
- Safe (Read-Only): Tools like
read_file,get_weather,search_web. These can execute autonomously. - Dangerous (Mutative/Exec): Tools like
run_bash,write_file,git_commit,drop_table. These require sandboxing or approval.
2. Implement Input Validation
- Wrap all tools with strict type-checking (e.g., Pydantic
BaseModel). - If an LLM passes a malformed argument, the tool wrapper must catch the exception and return a clear error message back to the LLM so it can self-correct, rather than crashing the orchestrator.
3. Implement Human-in-the-Loop (HITL) Gates
- For dangerous tools running on the host machine, inject an interrupt in the execution graph.
- The system must display the exact command/arguments to the user:
Agent wants to execute: 'rm -rf ./build'. Approve? (Y/n). - If the user rejects, return a message to the agent:
"Tool execution rejected by human. Find an alternative approach."
4. Implement Containerized Execution (Optional but Recommended)
- If full autonomy is required for dangerous tools, execute them inside a Docker container or ephemeral virtual machine.
- Mount only the specific workspace directories required; never mount the root filesystem or sensitive directories like
~/.ssh.
5. Add Timeout Limits
- Wrap all tool executions in a timeout block (e.g.,
timeout=30s) to prevent an agent from running an infinitewhile trueloop script that hangs the orchestrator.
Review In Mind (ReviewInMindGenie)
Execute the common review loop in review-in-mind before delivering.
Review lens for this skill:
- Are dangerous tools gated by HITL approval, containers, timeouts, and minimal mounts?
- Is the approval prompt explicit about the exact command, arguments, and consequences?
- Is there a defined fallback path when execution is rejected?
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

