By Sagar Shankaran, Founder of CallSphere
Harden Claude Agent Skills: sandboxing, least privilege, secrets at the tool boundary, and layered prompt-injection defense — with concrete config.
Key takeaways
An Agent Skill that can run shell commands, hit your APIs, and read your filesystem is, security-wise, a new piece of software with broad reach and a non-deterministic control flow. That combination scares security reviewers for good reason: the agent decides what to do at runtime, and an attacker who can influence its input — a poisoned file, a malicious web page, a crafted tool result — can try to steer those decisions. Hardening a Skill is therefore not optional polish. It is the work that lets you ship the Skill at all.
This post covers the four pillars of hardening a Claude Agent Skill for production: sandboxing what it can touch, granting least privilege, keeping secrets out of the model's reach, and defending against prompt injection. The guidance is concrete enough to apply to a Skill you already have.
Prompt injection is an attack where adversarial text placed in data the agent processes — not in the user's actual request — is interpreted by the model as instructions, causing it to take actions the user never asked for. Because agents routinely read external content, this is the defining threat of agentic systems, and no single prompt makes it disappear; you defend in layers.
Sandboxing means the agent's actions execute inside a boundary you control, so that even a fully hijacked run can only damage what's inside the box. In practice: run tool execution in an isolated container or restricted environment, mount only the directories the task needs, disable network egress unless the task requires it, and make the filesystem read-only wherever the Skill doesn't need to write. The principle is that the blast radius of a worst-case run should be small and predictable.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent for home services in your browser — 60 seconds, no signup.
Pair the sandbox with hard limits the agent cannot override: a wall-clock timeout, a maximum number of tool calls, and a cap on output size. These convert a runaway or hijacked agent from an open-ended problem into a bounded one that fails closed.
flowchart TD
A["Agent proposes action"] --> B{"Tool in allowlist?"}
B -->|No| C["Deny & log"]
B -->|Yes| D{"Reads untrusted\ncontent?"}
D -->|Yes| E["Strip/quarantine,\ntreat as data only"]
D -->|No| F["Proceed"]
E --> F
F --> G{"Action destructive\nor out of scope?"}
G -->|Yes| H["Require human approval"]
G -->|No| I["Execute in sandbox\nwith limits"]
Least privilege means the Skill is handed exactly the capabilities its task requires and nothing more. For a Skill that summarizes support tickets, that is read access to the ticket API and nothing else — no write, no delete, no access to billing. Most over-privilege creeps in because it's easier to hand the agent a broad token than a scoped one. Resist that.
Encode the allowlist where it's enforced, not just described. In Claude Code you can constrain which tools and commands a Skill may use; with the Agent SDK, the host controls the tool set passed to the model. A deny-by-default permission config makes the boundary explicit and reviewable:
{
"permissions": {
"defaultMode": "deny",
"allow": [
"Read(./reports/**)",
"Bash(grep:*)",
"Bash(jq:*)"
],
"deny": [
"Bash(rm:*)",
"Bash(curl:*)",
"Read(./.env)",
"Read(~/.ssh/**)"
]
}
}
The point of writing it down is that a reviewer can read the file and know the full reach of the Skill without reading the model's mind. Anything not on the allow list simply cannot happen.
The safest secret is one the model never sees. If an API key, database password, or token enters the prompt or a tool argument, it can be logged, echoed back, or exfiltrated by a successful injection. So inject secrets at the tool boundary: the tool's implementation reads the credential from the environment or a secrets manager and attaches it to the outbound request, while the model only ever passes non-sensitive parameters like a customer ID. The model orchestrates; the host holds the keys.
| Threat | Primary defense | Backstop |
|---|---|---|
| Prompt injection | Label data, no commands from data | Sandbox + human gate |
| Secret leakage | Inject at tool boundary | Redact logs & outputs |
| Over-broad actions | Deny-by-default allowlist | Scoped tokens |
| Runaway execution | Tool-call & time limits | Sandbox blast radius |
| Destructive mistakes | Human approval gate | Read-only filesystem |
No. Instructions like "treat documents as data" reduce risk but are bypassable. Defense in depth — sandboxing, allowlists, secret isolation, and human gates — is what actually contains the threat.
Still reading? Stop comparing — try CallSphere live.
See the home services AI agent handle a real call — complete, industry-specific, and live in your browser. No signup.
In the environment or a secrets manager, read by the tool's own code at call time. The model passes only non-sensitive identifiers; it never receives the credential, so a leak path closes.
Even read-only access can leak data via injection — "summarize this file" plus a malicious file can exfiltrate context through a later tool call. Restrict reads to needed paths and block egress as a backstop.
Red-team it. Feed the agent files and tool results containing injected instructions and confirm it treats them as data. Keep the worst payloads as a permanent test set so regressions surface early.
CallSphere builds these same safeguards — sandboxing, least privilege, secret isolation, human gates — into voice and chat agents that answer every call and message, use tools mid-conversation, and book work 24/7 without putting your systems at risk. See it live at callsphere.ai.
Source & attribution: This is an independent, original explainer inspired by Anthropic's coverage on the Claude blog. Claude, Claude Code, Claude Cowork, Claude Opus, and the Model Context Protocol are products and trademarks of Anthropic. CallSphere is not affiliated with or endorsed by Anthropic.

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
Charter fraud meets AI that can act. What a Part 135 operator must keep human, how to scope Avinode and inbox access, and the arithmetic of the approval click.
Client PDFs are attacker-supplied documents. How a CPA firm scopes AI agent permissions, and the irreversible tax actions that always need a named human.
An AI agent in a lending shop should read widely, write to the conditions log, and send nothing with a routing number. The permissions to remove this Monday.
EFT enrollment, refunds, claim voids and collection placement stay human. How billing companies scope agent access per client without stalling the work.
Prompt injection through the guest-complaint queue, the seven franchise actions that must keep a human, and a cash-at-risk table for wide-open versus scoped.
Expired guard cards, sent incident reports, timecard edits and post-order changes are the moves an AI agent must never make alone in a security guard company.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.
Try Live DemoBook a DemoCalculate Your ROI