Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Agent Scope Guard

    1

    Generate local safety hooks for Claude Code and Cursor to block scope creep and destructive shell commands.

    Free

    Security scanned
    Agent Scope Guard

    Agent Scope Guard

    Example session with this skill installed

    Generate PreToolUse hooks for my project at ./my-web-app to prevent the agent from deleting files and ensure it runs tests before finishing.

    • Read your context and instructions
    • Compiled the agent scope guard

    I have analyzed your project configuration. Since you are using Claude Code, I will generate the hooks for `.claude/settings.json`. The following hooks will prevent destructive commands and enforce test verification before completion. ## Configuration Update ```json { "hooks": { "PreToolUse": [ { "name": "prevent-destructive-shell", "description": "Blocks dangerous commands like rm -rf and git reset --hard", "command": "python3 -c \"import sys; cmd=sys.argv[1].lower(); exit(2) if any(x in cmd for x in ['rm -rf', 'git reset --hard', 'git push --force']) else exit(0)\"", "arguments": ["{{command}}"] }, { "name": "enforce-task-verification", "description": "Blocks 'task complete' reports if no verification command was run", "command": "bash -c \"if [[ '{{thought}}' == *'TASK COMPLETE'* ]] && [[ ! -f .verification_lock ]]; then echo 'Verification required'; exit 2; else exit 0; fi\"" }, { "name": "scope-guard", "description": "Prevents edits to files outside the initial scope", "command": "python3 scripts/check_scope.py --file {{path}}", "arguments": ["{{path}}"] } ] } } ``` **Next steps** 1. Run the generator with `python scripts/generate.py --project ./my-web-app` to apply these changes. 2. Verify the `.claude/settings.json.bak` file was created for safety. 3. Restart your Claude Code session to activate the new guardrails.

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

    About this skill

    Stop agents from burning tokens on unauthorized file edits or claiming tasks are finished without proof. This skill implements specific PreToolUse hooks for Claude Code and Cursor to mitigate scope creep and destructive shell operations. ## What it does - **Scope Creep Prevention**: Blocks the agent from editing files outside the declared task scope. - **Verification Enforcement**: Prevents the agent from reporting task completion unless verification commands have been executed. - **Shell Guardrails**: Identifies and blocks high-risk commands like `rm -rf`, `git reset --hard`, and `git push --force`. - **Config Auditing**: Reads existing `.claude/` or `.cursor/` configurations to identify missing safety hooks. - **Non-Destructive Patching**: Adds missing hooks via a diff-based approach rather than overwriting existing user settings. ## How it works 1. Point the generator at your project root using the `--project` flag. 2. Use `--dry-run` to inspect the proposed JSON changes and safety logic. 3. Apply the hooks to generate local `.claude/settings.json` or `.cursor/hooks.json` updates. 4. The agent will now trigger a block (exit code 2) whenever a tool call violates the defined safety boundaries. ## Frameworks & tools Built for Claude Code and Cursor IDE. The generated hooks are shell-based and the generator uses Python stdlib only. ## Why this beats prompting it yourself System prompts are easily ignored under high needle-in-a-haystack pressure or long contexts. These hooks operate at the tool-execution layer, providing a hard programmatic block that the agent cannot "convince" its way past. ## Use cases - Preventing agents from refactoring the entire codebase during a simple bug fix. - Ensuring test suites are actually run before a PR is marked as ready. - Protecting production-sensitive files from accidental deletion by the LLM. - Auditing local agent configurations for missing safety best practices. ## Known limitations Does not support network-based guardrails or environment variable checks. Requires a Python environment to run the generator script.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.

    Requires local Python to run the generator. Does not support network-based guardrails or environment variable filtering.

    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 buying a skill.

    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 to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed today

    • Free with an Agensi account

    Software
    Git

    A project with a .claude/ or .cursor/ configuration directory

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Environment Variables
    Listedtoday

    What's inside

    Frequently Asked Questions

    Unlike system prompts which can be ignored or bypassed during long-context tasks, this skill implements hard programmatic blocks at the PreToolUse layer. It ensures the agent literally cannot execute unauthorized shell commands or edit files outside your specified scope, regardless of its instructions.

    The 'agent scope guard' is specifically designed for Claude Code and Cursor IDE. It targets their local configuration structures to manage tool-execution permissions directly within your development environment.

    The skill uses a non-destructive, diff-based patching approach that reads your existing config files and only appends the necessary safety hooks. You can also use the `--dry-run` flag to review every proposed change before any files are modified.

    Yes, you can define specific directories or files as 'in-scope' for a task; any attempt by the agent to modify code outside those boundaries will trigger an immediate block (exit code 2).

    It provides a set of guardrails against high-risk shell commands like 'rm -rf' or 'git push --force'. This prevents the agent from accidentally deleting local data or forcing destructive changes to your version control history.

    You receive the generator script (Python stdlib compatible) and the core safety logic templates. This allows you to generate and audit safety hooks across any number of local projects without needing external dependencies.

    New in LLM Ops

    Free