Works with the AI Agents you already use
Claude Code Permissions Hardening: Safe Defaults
Loose tool permissions in Claude Code often lead to accidental secret leaks or destructive command execution.
Free
Claude Code Permissions Hardening: Safe Defaults
Example session with this skill installed
Audit my current Claude Code settings and give me a hardened configuration for a Node.js project that uses .env files and AWS.
- Read your context and instructions
- Compiled the claude code permissions
I have audited your environment and detected broad permissions. Your current config allows general Bash(*) access, which puts your .env and ~/.aws/ credentials at risk.
Security Audit Findings
| Risk | Location | Recommended Fix |
|---|---|---|
| Credential Leak | .env, ~/.aws/** | Add explicit deny rules for these paths. |
| Broad Bash Access | Bash(*) | Replace with specific allow/ask rules for npm and git. |
| External Fetch | WebFetch | Move to ask or deny to prevent data exfiltration. |
Hardened settings.json
{
"permissions": {
"allow": [
"Bash(npm run test:*)",
"Bash(npm run lint:*)",
"Bash(git status)",
"Bash(git diff:*)"
],
"ask": [
"Bash(git push:*)",
"Bash(npm install:*)",
"Bash(aws s3 sync:*)"
],
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)",
"Read(~/.ssh/**)",
"Read(~/.aws/**)",
"Bash(rm -rf:*)",
"Bash(curl:*)",
"Bash(wget:*)",
"Bash(sudo:*)"
]
},
"defaultMode": "architect"
}
Next steps
- Copy the JSON above into your
.claude/settings.jsonfor team-wide rules. - Run
claude path/to/your/envto confirm the Read(./.env) request is blocked. - Test your
npm run testcommand to verify authorized workflows remain uninterrupted.
Connects securely to your tools. The creator never sees your data.
About this skill
Loose tool permissions in Claude Code often lead to accidental secret leaks or destructive command execution. This skill audits your configuration and generates a hardened settings.json to enforce strict security boundaries. ## What it does - **Permission Auditing** identifies overly broad allow rules for Bash and WebFetch across local and global settings. - **Secret Protection** generates explicit deny rules for .env files, SSH keys, AWS credentials, and sensitive directories. - **Mode Optimization** configures the defaultMode and restricts file access to specific project directories. - **Destructive Command Blocking** prevents dangerous operations like sudo, rm -rf, or unauthorized curl/wget requests. - **Hook Review** analyzes MCP servers and PreToolUse hooks for potential insecure code execution. ## How it works 1. **Audit phase** reads your global and project-level settings to find high-risk configurations. 2. **Baseline generation** creates a tailored permissions object with allow, ask, and deny arrays. 3. **Defense strategy** suggests PreToolUse hooks and sandbox isolation settings for filesystem and network. 4. **Verification** provides a test plan to confirm blocked actions without breaking common development workflows. ## Frameworks & tools This skill targets Claude Code CLI environments and works with standard JSON configuration files (`settings.json` and `settings.local.json`). ## Why this beats prompting it yourself Manual configuration is prone to syntax errors and overlooked paths like hidden environment files. This skill uses a systematic audit-first approach to ensure your security posture covers deep-nested secrets and command-specific wildcards that general prompts often miss. ## Use cases - Secure a new project repository before sharing it with a team. - Prevent Claude from reading sensitive developer credentials in home directories. - Restrict Bash execution to a whitelist of npm or git subcommands. - Audit third-party MCP servers for excessive scopes or token access. ## Known limitations Requires manual application of generated JSON to local settings files. Filesystem sandboxing suggestions depend on underlying OS support.
Requires manual file updates. Sandboxing capabilities vary by OS. Only audits Claude Code specific settings.json files.
How to use
- 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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 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
1 use
Times used to date
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 4 days ago
- Free with an Agensi account