| name | permission-deduplication |
| description | Use when deduplicating permissions. Identifies redundant patterns covered by broader rules. |
| version | 1.0.0 |
| author | JacobPEvans |
Permission Deduplication
Rules for detecting when a specific permission is already covered by a broader existing pattern.
Pattern Coverage Rules
Bash Permissions
Wildcards (*) match any value. More wildcards = broader coverage.
Coverage examples:
git:*:*coversgit status:*,git log:*,git diff:*npm:*:*coversnpm list:*,npm install:*docker:*:*coversdocker ps:*,docker volume ls:**--version:*coversnpm --version:*,docker --version:*
No coverage:
git status:*does NOT covergit log:*(different commands)npm:*does NOT covernpm:*:*(different arg counts)
WebFetch Domains
Root domains cover their subdomains, but different root domains are separate.
Coverage examples:
github.comcoversapi.github.com,docs.github.com,status.github.comdocker.comcoversdocs.docker.com,hub.docker.com
No coverage:
github.comdoes NOT covergithubusercontent.com(different root domain)github.comdoes NOT coverraw.githubusercontent.com(separate root, notraw.github.com)github.comdoes NOT covergithub.io(different TLD)api.github.comdoes NOT coverdocs.github.com(different subdomains, no root coverage)localhostdoes NOT coverlocalhost:3000(port is a distinct entity, not a subdomain)
File Paths
Broader wildcards cover more specific patterns.
Coverage examples:
Read(**)covers any Read permissionGlob(**/*)coversGlob(**/*.js),Glob(**/package.json)
Pattern Notation Clarification
Bash Permission Argument Counts
Patterns are defined by the number of arguments, where each : separates argument positions:
git:*matchesgitwith exactly one argument (any value)git:*:*matchesgitwith exactly two arguments (any values)git status:*matchesgit statusas a command pair, plus exactly one additional argument
The notation shows exact argument positions, not whether the command uses the Bash() wrapper:
Bash(git:*:*)- Same asgit:*:*, theBash()wrapper doesn't change the matching rules- Both match git commands with exactly two arguments where both can be anything
Deduplication Algorithm Example
When checking if a new permission is already covered by an existing one, validate argument counts match:
def is_covered(existing_pattern, new_pattern):
# Extract components
existing_cmd, *existing_args = existing_pattern.split(':')
new_cmd, *new_args = new_pattern.split(':')
# Commands must match
if existing_cmd != new_cmd:
return False
# Argument counts must be identical (otherwise patterns aren't comparable)
if len(existing_args) != len(new_args):
return False
# Each position: existing must be "*" or match exactly
return all(
existing_arg == "*" or existing_arg == new_arg
for existing_arg, new_arg in zip(existing_args, new_args)
)
Root Domain Recommendations
For well-known vendors (GitHub, Docker, Google, Apple, Microsoft), prefer root domain over individual subdomains.
If multiple subdomains found → suggest adding root domain instead.
Related Permission Suggestions
When discovering a safe permission, suggest related safe commands in the same family:
docker volume ls→ suggestdocker volume inspectaws s3 ls→ suggestaws s3 sync --dryrunnpm list→ suggestnpm outdated,npm audit
Commands Using This Skill
.claude/agents/permissions-analyzer.md- Uses deduplication to filter redundant permissions during discovery/sync-permissionscommand - Indirectly uses this skill through the permissions-analyzer agent