tidy-permissions
Skill1 starsChanged 8 months agoMITView on GitHub
Clean up and optimize Claude Code permission rules in settings.json — consolidate similar rules with wildcards, remove duplicates, sort alphabetically. Usage: /tidy-permissions
- Deletes or force-pushes
- Commits and pushes
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Read these files (silently, skip if missing):
- Distinctive: line 37
Look for groups of 3+ rules that share a common prefix:
- Distinctive: line 43
Only consolidate when ALL rules in the group are safe to wildcard
- Distinctive: line 45
When in doubt, keep rules separate
- Distinctive: line 46
Never consolidate rules across different tools (Edit + Write)
- Distinctive: line 103
Wait for the user's approval.
- Distinctive: line 107
After approval, edit the settings files with the optimized permission arrays.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Tidy Permissions
You clean up and optimize permission rules in Claude Code settings.json files. When invoked, you read all permission configs, consolidate similar rules, remove duplicates, and produce a clean, organized permission list.
How It Works
The user invokes /tidy-permissions. You then analyze all settings files and optimize the permission rules.
Process
Step 1 — Read All Settings Files
Read these files (silently, skip if missing):
~/.claude/settings.json # user-level
.claude/settings.json # project-level (committed)
.claude/settings.local.json # project-level (local)Extract the permissions.allow, permissions.deny, and permissions.ask arrays from each.
Step 2 — Analyze & Consolidate
For each permission array (allow, deny, ask), apply these optimizations:
Remove exact duplicates:
Bash(npm run test)appearing twice → keep one
Consolidate with wildcards: Look for groups of 3+ rules that share a common prefix:
Bash(npm run lint),Bash(npm run test),Bash(npm run build)→Bash(npm:*)Bash(git status),Bash(git diff),Bash(git log),Bash(git add)→Bash(git:*)Bash(cd ~/dev),Bash(cd ~/projects)→ keep separate (only 2, not worth consolidating)
Be conservative with wildcards:
- Only consolidate when ALL rules in the group are safe to wildcard
Bash(git status)+Bash(git push --force)should NOT becomeBash(git:*)— force push is dangerous- When in doubt, keep rules separate
- Never consolidate rules across different tools (Edit + Write)
Common safe consolidation patterns:
| Rules | Consolidation |
Bash(npm run *) variants | Bash(npm:*) |
Bash(git status), Bash(git diff*), Bash(git log*), Bash(git branch*) | Bash(git:*) (only if no destructive git commands are in the list) |
Bash(ls *) variants | Bash(ls:*) |
Bash(npx *) variants | Bash(npx:*) |
Bash(node *) variants | Bash(node:*) |
Bash(cd *) variants | Bash(cd:*) |
Multiple Edit(.claude/*) | Edit(.claude) |
Multiple Read(src/*) | Read (if covering most of src) |
Dangerous patterns — do NOT auto-consolidate:
- Any
git push,git reset,git checkout --,git clean→ keep explicit - Any
rm,rmdir,kill→ keep explicit - Any
sudocommands → keep explicit
Step 3 — Sort & Organize
Sort each array:
- By tool name alphabetically (Bash, Edit, Glob, Grep, Read, Write)
- Within each tool, alphabetically by the rule content
- Wildcard rules first within each tool group (they're the broadest)
Step 4 — Present Changes
Show the user a before/after comparison for each file that would change:
## ~/.claude/settings.json — permissions.allow
Before (12 rules):
Bash(cd ~/dev/projects/neonloops)
Bash(git add)
Bash(git branch)
Bash(git diff)
Bash(git log)
Bash(git status)
Bash(npm run build)
Bash(npm run lint)
Bash(npm run test)
Edit(.claude/settings.local.json)
Edit(.claude/skills)
Read
After (5 rules):
Bash(cd:*)
Bash(git:*)
Bash(npm:*)
Edit(.claude)
Read
Removed: 7 redundant rulesWait for the user's approval. If they object to any consolidation, keep those rules separate.
Step 5 — Apply
After approval, edit the settings files with the optimized permission arrays.
Step 6 — Verify
jq -e '.permissions' <target-file>Confirm the JSON is valid after editing.
Rules
- Never consolidate dangerous commands — rm, kill, sudo, force push stay explicit
- Always show before/after — never edit without approval
- Preserve deny rules carefully — consolidating deny rules is risky, be extra conservative
- Don't merge across files — user, project, and local settings stay separate
- Don't add new permissions — only reorganize existing ones
- Don't remove permissions — only consolidate or deduplicate
- Validate JSON after editing — broken settings.json silently disables all settings
- Keep it fast — this is a quick cleanup, not a security audit
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

