More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Least-Privilege Claude Code Sub-Agents

    1

    Build or harden sub-agents with limits set in front matter and hooks, then test that forbidden actions are blocked.

    Free

    Security scanned
    Least-Privilege Claude Code Sub-Agents

    Least-Privilege Claude Code Sub-Agents

    Example session with this skill installed

    Build a read-only security reviewer sub-agent for this repo and prove it cannot write files.

    • Read your context and instructions
    • Compiled the least-privilege claude code

    I added a security-reviewer agent to your repo. It can read files and run a short list of read-only git commands, nothing more. Every write command I sent the installed guard in this agent's name came back blocked. The live Claude Code probes are still yours to run.

    .claude/agents/security-reviewer.md (front matter; the body sets out its process and output table)

    name: security-reviewer
    description: Reviews uncommitted changes or named files in this repo for security bugs and returns findings ranked by severity, with a fix for each. Use when code that handles input, file paths, auth, secrets or shell calls has changed. Triggers on "security review", "check this diff for vulnerabilities", "review my changes for security".
    tools: Read, Grep, Glob, Bash
    model: sonnet
    

    It needs git diff, so Bash is granted and held by a settings-level guard (.claude/hooks/agent_commands.json) to git status, git diff with --cached or --stat, and git log --oneline -N. No Write, Edit, web or MCP.

    Checks I ran

    • Linter before the guard: 1 FAIL, 1 WARN ("read-only role has Bash with no PreToolUse guard"). After: 0 FAIL, 0 WARN, --strict too.
    • The skill's 55 unit tests passed. Against the installed guard, 9 ran and passed, and 7 MCP tests were skipped because that guard is not installed here.
    • 16 hook payloads piped into the installed guard. An excerpt:
    Command as security-reviewerExit
    git diff, git diff --cached, git status --short0
    touch probe.txt, echo probe > probe.txt, git diff > probe.txt2
    git diff --output=probe.txt, python3 -c "open(...).write(...)"2
    git status; rm README.md, git add -A, git checkout -- app/files.py2

    probe.txt does not exist afterwards. The main session and unlisted agents pass through, so your own shell is untouched.

    Your Claude Code is 2.1.280, so I left out onFailure: block (it needs 2.1.295). Until you upgrade and add it, moving the guard script turns the shell limit off.

    Next steps

    • Run the live probes in references/verification.md section B: list tools, then create scratch/probe.txt, then run python3 --version.
    • Ask it to review your staged change. app/routes.py passes a query-string value into read_upload, a path traversal it should catch.
    • Commit the agent, settings.json and .claude/hooks/ together.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Most Claude Code sub-agents are one typo away from having every permission in the session. Leave out the tools line and the agent inherits every built-in and every connected MCP server, while a misspelled field is ignored without any error. A prompt that says "never edit files" enforces nothing.

    This skill has your agent build sub-agents whose limits Claude Code itself enforces. It writes a least-privilege allow-list in front matter from eight permission shapes (air-gapped scanner, reviewer, researcher, single MCP server, connector, guarded shell, one forbidden action, inherit on purpose). It writes a description that routes correctly and finishes with a smoke test that tries the forbidden actions and checks the filesystem afterwards.

    For limits front matter cannot express, it includes two PreToolUse guard scripts you add as hooks: one holds an agent's Bash to an exact list of commands, the other holds an MCP server to a fixed list of its tools, so any tool name not on the list is refused. There is also a linter that catches silent mistakes in existing agents, and a hand-off script for splitting a job into its own operator folder with a deny list for unattended runs. All four scripts are standard-library Python with 55 unit tests. The Bash guard was also tested live against a real sub-agent. The MCP guard has unit tests only, with no live MCP server test, so smoke-test it on yours.

    Front-matter facts were checked against the Claude Code docs in November 2026, including the traps. A Bash rule in disallowedTools removes the whole shell, and a hook lets calls through when its script is missing unless you set onFailure: block.

    Needs Claude Code and Python 3.9 or later. For teams running several sub-agents, or any agent that reads untrusted input.

    It cannot stop damage done through a tool the agent is allowed to use, such as sending data out in a WebFetch URL. The MCP guard has unit tests only, with no live MCP server test, so smoke-test it on yours. Front-matter hooks may not fire in headless (claude -p) runs, so prove them with a live probe.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 13 days ago

    • Free with an Agensi account

    Requires

    Claude Code
    Python 3.9+
    macOS
    Python
    Git

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Listed13 days ago

    What's inside

    Frequently Asked Questions

    Claude Code and Python 3.9 or later. The linter and both guards use only the standard library, so there is nothing to pip install. It was tested on Claude Code 2.1.280. The `onFailure: block` hook setting needs 2.1.295 or later, and the skill checks your version before it adds that key.

    A prompt line stops nothing. This skill puts the limit where Claude Code enforces it: a `tools` allow-list in front matter, plus a PreToolUse guard when an agent needs a few shell commands. The linter also catches the silent mistakes, such as a missing `tools` line that inherits every tool or a misspelled field Claude Code ignores.

    The scripts have 55 unit tests: 16 for the guards, 31 for the linter and 8 for the hand-off script. The Bash guard was also tested live against a real sub-agent. The MCP guard has unit tests and piped payloads only, with no live MCP server, so the skill asks you to smoke-test it on yours.

    The linter and the two guards read local files and hook input and make no network calls. The hand-off script starts a headless Claude Code run in another folder, which talks to Anthropic like any session. The skill shows you each settings or hook change and asks before it saves one.

    Damage done through a tool the agent is allowed to use, such as sending data out in a WebFetch URL. Also a guard pattern that is too loose but still blocks your test strings, and settings outside the project that grant more than you see. Re-run the live checks after a Claude Code upgrade.

    Yes. It lints every agent first, lists the tools each one really uses from its body, and compares that with what it is granted. For an agent people rely on today, it starts with a deny-list that cannot break anything, then tightens to an allow-list once a smoke test shows exactly what the agent uses.

    New in Agents & Orchestration