| name | agent-tool-safety |
| description | Control shell, filesystem, MCP, browser, external APIs, and risky tools. Enforce read-only-before-write, least-privilege, and verification discipline. Trigger on /agent-tool-safety, or when using shell commands, file operations, MCP tools, browser automation, or external APIs. |
| user-invocable | true |
| allowed-tools | Read, Grep, Glob, Bash |
Agent Tool Safety
Safety discipline for tool-using agents. Apply proactively when working with shell, filesystem, network, or external APIs.
Principles
Read-only before write
- Search and read before creating or editing.
- Grep before Glob. Glob before Read.
- Understand existing code before modifying.
Least-privilege tool usage
- Use the narrowest tool for the job (Edit over Write for small changes).
- Prefer explicit file lists over broad glob operations.
- Never read/print
.env, tokens, keys, credentials, or secrets.
- Never run destructive commands:
rm -rf, git reset --hard, git clean -fd, git checkout -- ., git push --force.
Shell safety
- Explain what a command does before running it, especially if it modifies state.
- Prefer
&& chaining over scripts for simple multi-step operations.
- Avoid piping sensitive data to/from network endpoints.
- Use
--dry-run flags when available.
Browser and MCP safety
- Do not submit sensitive credentials into web forms via automation.
- Do not crawl authenticated sessions without explicit approval.
- Prefer read-only scraping over interactive actions.
Verification
- After every tool-based change, verify the result.
- If a command fails, diagnose before retrying with a workaround.
- Do not silence errors with
|| true or 2>/dev/null unless the error is expected and harmless.
Experience Log
This skill learns from experience. Mechanism:
-
Read .claude/experience/agent-tool-safety.md at skill start to benefit from past lessons.
-
Write to .claude/experience/agent-tool-safety.md after use if you learned something new.
-
Format: YYYY-MM-DD: <lesson> — one line per entry.
-
Evolve: If the same issue repeats 3+ times, update this SKILL.md itself.
This skill improves over time. After each use, append lessons learned.
Record format: YYYY-MM-DD: <lesson>
Read this at skill start to apply past lessons.