AgentSkillsCN

Permissions

审计并清理`.claude/settings.local.json`的权限。当用户提出“审查权限”“清理设置”“审计允许执行的命令”或提及`settings.local.json`中的冗余内容时使用此功能。

SKILL.md
--- frontmatter
name: Permissions
description: Audit and clean `.claude/settings.local.json` permissions. USE WHEN the user asks to review permissions, clean up settings, audit allowed commands, or mentions settings.local.json cruft.

Permissions Audit

Audit and clean the Claude Code permissions file (.claude/settings.local.json). This file grows organically as users approve Bash commands — each approval gets auto-appended verbatim, accumulating cruft over time.

Procedure

  1. Read .claude/settings.local.json
  2. Categorize every entry into one of the groups below
  3. Flag cruft — entries matching the patterns in the Cruft Patterns section
  4. Present a report showing: total entries, entries per group, flagged cruft with reasons
  5. On user approval, write a cleaned version with entries organized by group

Permission Groups

Organize the allow array in this order, separated by blank lines:

GroupDescriptionExamples
Non-Bash toolsTop-level tool grantsWebSearch, mcp__*
Standard CLICommon commands, no prefix neededBash(git:*), Bash(cargo:*)
Aliased commandsShell aliases require command/builtin prefixBash(command cp:*), Bash(builtin cd:*)
Forge hooksRelative paths to Hooks/ scriptsBash(Hooks/calendar-today.sh:*)
Forge binariesRelative paths to module binariesBash(Modules/forge-tlp/bin/safe-read:*)
Build toolsSetup and build scriptsBash(make:*)
WebFetch domainsAllowed web domainsWebFetch(domain:github.com)

The ask array stays at the bottom, unchanged.

Cruft Patterns

Flag and remove entries matching these patterns:

PatternWhy it's cruftExample
Absolute paths that duplicate a relative entryAuto-granted with full path when relative already exists/Users/.../Hooks/calendar-today.sh
Environment-prefixed commandsHook dispatcher noise — CLAUDE_PLUGIN_ROOT=, FORGE_MODULE_ROOT=, FORGE_ROOT=, CARGO_MANIFEST_DIR=Bash(CLAUDE_PLUGIN_ROOT=/path bash:*)
Loop fragmentsPartial shell syntax from multi-line commandsBash(for mod in ...), Bash(do), Bash(done)
File existence checksOne-off [ -f ... ] testsBash([ -f "$SCRIPT_DIR/Core/..." ])
Redundant aliasesbuiltin echo when echo exists, bare find when command find existsBash(builtin echo:*)
Internal functionsBash function names, not commandsBash(strip_front:*), Bash(parse_yaml_list:*)
Multi-line blobsEntire scripts pasted as a single permissionLong for/do/done blocks
One-off domainsDomains visited once during research, not part of regular workflowWebFetch(domain:random-blog.com)
Venv pathsPython from .venv/ when python3 already allowedBash(/path/.venv/bin/python3:*)

Guidelines

  • Keep anything the user intentionally uses across sessions
  • Keep du, md5, xargs, source — generally useful utilities
  • Remove anything that's a duplicate, fragment, or noise from auto-granting
  • When unsure, ask — don't silently remove potentially intentional entries
  • Report the before/after entry count