agentleFS
enderyildirimenderyildirim/claude-skills/skills/tidy-permissions/SKILL.md

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
  1. Distinctive:

    Read these files (silently, skip if missing):

    line 19
  2. Distinctive:

    Look for groups of 3+ rules that share a common prefix:

    line 37
  3. Distinctive:

    Only consolidate when ALL rules in the group are safe to wildcard

    line 43
  4. Distinctive:

    When in doubt, keep rules separate

    line 45
  5. Distinctive:

    Never consolidate rules across different tools (Edit + Write)

    line 46
  6. Distinctive:

    Wait for the user's approval.

    line 103
  7. Distinctive:

    After approval, edit the settings files with the optimized permission arrays.

    line 107

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 become Bash(git:*) — force push is dangerous
  • When in doubt, keep rules separate
  • Never consolidate rules across different tools (Edit + Write)

Common safe consolidation patterns:

RulesConsolidation
Bash(npm run *) variantsBash(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 *) variantsBash(ls:*)
Bash(npx *) variantsBash(npx:*)
Bash(node *) variantsBash(node:*)
Bash(cd *) variantsBash(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 sudo commands → keep explicit

Step 3 — Sort & Organize

Sort each array:

  1. By tool name alphabetically (Bash, Edit, Glob, Grep, Read, Write)
  2. Within each tool, alphabetically by the rule content
  3. 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 rules

Wait 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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.