Agent skill
ai-analyze-permissions
Use when Claude Code permissions have accumulated in settings.local.json and you want to audit, consolidate, or clean up tool permission patterns.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/ai-analyze-permissions-arcasilesgroup-ai-engineering
SKILL.md
Analyze Permissions
Purpose
Analyze accumulated permissions in settings.local.json and suggest smart wildcard patterns to consolidate into shared configuration. Reduces permission sprawl by replacing specific entries with safe wildcard patterns.
Arguments (parsed from user input)
- action: What to do -
analyze(default),apply, orcleanup
Example invocations:
/ai-analyze-permissions→ analyze and suggest patterns/ai-analyze-permissions apply→ apply suggested patterns to shared config/ai-analyze-permissions cleanup→ just run the cleanup script
Process
Step 1: Read Current Permissions
Read these files:
- Project-local:
<project-root>/.claude/settings.local.json- accumulated "Always allow" permissions (per-project) - Global:
~/.claude/settings.json- shared/base permissions across all projects
Note: settings.local.json is project-specific. Each repo has its own at <repo>/.claude/settings.local.json. The global ~/.claude/settings.json is shared across all projects.
Step 2: Analyze Patterns
For each entry in settings.local.json:
-
Check if already covered - Is there a wildcard in
settings.jsonthat covers this?Bash(git commit -m "Fix bug")is covered byBash(git commit:*)Bash(curl https://api.example.com)is covered byBash(curl:*)
-
Identify pattern opportunities - Group similar commands:
- Multiple
kubectlcommands → suggestBash(kubectl:*) - Multiple
dockercommands → suggestBash(docker:*) - Multiple WebFetch for same domain → suggest
WebFetch(https://example.com/*)
- Multiple
-
Decide global vs local - Where should the pattern live?
- Global (
~/.claude/settings.json): General-purpose tools used across projects (npx,python,docker compose, etc.) - Local (
settings.local.json): Project-specific commands, or write operations you only want for that project (e.g.,git pushfor a personal repo)
- Global (
-
Assess safety - Consider if the pattern is safe for auto-approval:
- Read-only commands: Generally safe
- Commands with side effects: Flag for review
- Overly broad patterns: Warn about security implications
Step 3: Present Analysis
Output a structured report:
## Permission Analysis
### Settings Overview
- settings.local.json: X entries
- settings.json: Y entries (Z wildcards)
### Already Covered (can be removed)
These entries in settings.local.json are redundant:
| Entry | Covered by |
|-------|------------|
| Bash(git commit -m "...") | Bash(git commit:*) |
### Suggested New Patterns
These patterns would consolidate multiple specific entries:
| Pattern | Covers | Scope | Safety |
|---------|--------|-------|--------|
| Bash(kubectl:*) | 4 entries | global | Safe (read-heavy) |
| Bash(docker exec:*) | 3 entries | local | Review (can modify) |
### Uncategorized
These entries don't fit a pattern (one-offs):
- Bash(some-specific-command)
Step 4: Handle Actions
Based on the action argument:
analyze (default):
- Present the report
- Ask if user wants to apply suggestions
apply:
- For each suggested pattern, ask for confirmation
- Add approved global patterns to
~/.claude/settings.jsonby editing thepermissions.allowarray - Add approved local patterns to
<project-root>/.claude/settings.json(project-level, not local) - Run the cleanup script to remove now-redundant entries from
settings.local.json
cleanup:
- Run
<project-root>/.claude/skills/ai-analyze-permissions/scripts/cleanup-settings-local.sh
Step 5: Apply Patterns (if applying)
When adding patterns:
- Read the target settings file (
~/.claude/settings.jsonfor global,<project-root>/.claude/settings.jsonfor project) - Add new entries to the
permissions.allowJSON array - Write the updated JSON back (preserving all other fields)
- Run cleanup to remove now-redundant entries:
<project-root>/.claude/skills/ai-analyze-permissions/scripts/cleanup-settings-local.sh
Important: Adding patterns to settings.json never removes existing entries. The cleanup script only cleans settings.local.json. To clean settings.json itself, manually remove redundant entries.
Pattern Safety Guidelines
Safe to auto-approve (commonly needed):
Bash(npx:*),Bash(node:*),Bash(npm:*),Bash(pnpm:*)- JS/Node toolingBash(python:*),Bash(python3:*),Bash(pip:*)- Python toolingBash(cargo :*),Bash(cd :* && cargo:*)- Rust toolingBash(docker compose:*),Bash(docker ps:*)- DockerBash(kubectl get:*),Bash(kubectl describe:*)- K8s read operationsBash(git:*)subcommands (add, commit, log, diff, etc.)Bash(gh:*)read operations (pr view, issue list, api, etc.)Bash(chmod:*),Bash(ln:*),Bash(wc:*),Bash(which:*)- basic utilitiesBash(ssh:*),Bash(tmux:*),Bash(bash:*),Bash(zsh:*)- shell/systemWebFetch(domain:*),WebSearch- web access
Require review (side effects):
Bash(kubectl delete:*),Bash(kubectl apply:*)Bash(docker rm:*),Bash(docker exec:*)Bash(aws s3 rm:*)Bash(rm:*),Bash(mv:*)Bash(git push:*)- consider keeping per-project in local settings
Never auto-approve:
Bash(sudo:*)Bash(chmod 777:*)- Patterns that could leak secrets
$ARGUMENTS
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?