permissions-analyzer
GitHub作为安全过滤器,对自动允许的权限命令进行绿/黄/红分级审查。移除内置扫描误放的危险命令,合并安全项至设置文件,并提供禁用或启用建议提示的功能。
触发场景
安装
npx skills add intercom/2x-skills --skill permissions-analyzer -g -y
SKILL.md
Frontmatter
{
"name": "permissions-analyzer",
"metadata": {
"keywords": [
"settings",
"approvals",
"security"
],
"user-invocable": true
},
"description": "Vet a Claude Code permission allowlist against a GREEN\/YELLOW\/RED safety model and reduce permission\nprompts. Runs on top of the built-in \/fewer-permission-prompts scan (and permission auto mode):\nfilters proposed auto-allow commands through a GREEN\/YELLOW\/RED safety model — never auto-allowing\ninterpreters or package-manager executors — before merging the safe ones into ~\/.claude\/settings.json.\nAlso turns the proactive \"reduce your prompts\" suggestions off or on (disable\/enable).\n",
"allowed-tools": "Bash Read Write AskUserQuestion",
"disable-model-invocation": true
}
Permissions Analyzer
The mechanical scan of session history for frequently-approved commands is a job for Claude Code's
built-in /fewer-permission-prompts skill and permission auto mode (https://code.claude.com/docs/en/permissions).
This skill adds the layer neither provides: an opinionated safety filter plus a guarded
write into the user's global ~/.claude/settings.json. The built-in scan does not apply the RED
override below, so it can auto-allow commands this skill would reject — this skill applies the filter.
Modes
Pick the mode from the argument after /permissions-analyzer:
disable(oroff,stop,mute) — silence the proactive suggestion nudge. Runtouch ~/.claude/.disable-permissions-analyzer-suggestions, confirm the tips are off for all sessions, and mention/permissions-analyzer enableturns them back on. Do not run the vet-and-merge flow.enable(oron) — re-enable the nudge. Check whether~/.claude/.disable-permissions-analyzer-suggestionsexists, runrm -f ~/.claude/.disable-permissions-analyzer-suggestions, then confirm — say the suggestions are back on if the marker existed, or that they were never disabled if it did not. Do not run the vet-and-merge flow.- No argument (default) — run the vet-and-merge flow below.
The marker only governs the proactive suggestions; the flow is always available by running /permissions-analyzer with no argument.
Vet-and-merge flow
The goal: get safe, high-frequency commands onto the auto-allow list without letting anything that can execute arbitrary code slip through.
- Get candidate commands. Prefer the built-in scan — point the user at
/fewer-permission-prompts, which mines their session history and proposes an allowlist. Also accept a list the user pastes or the entries already in theirpermissions.allow. For users who want prompts gone entirely rather than command-by-command, mention permission auto mode as the broader option. With no candidates supplied and nothing to review, do not fabricate a classified list — route the user to/fewer-permission-promptsfirst, then vet what it returns. - Audit what the built-in already wrote, and strip RED. The built-in scan writes to the project
.claude/settings.jsonallowlist without applying the RED override. When the user has already run it, read that allowlist (and the user's~/.claude/settings.json), identify any RED entries, and — on the same explicit confirmation the write path requires — remove them from the allowlist. Flagging alone is not enough: a RED rule the built-in auto-allowed stays active until it is removed. - Classify each candidate into GREEN / YELLOW / RED using
references/safety-tiers.md. The RED override is the whole point of this skill — see below. - Present grouped by tier in a table before asking for confirmation.
- Merge the safe ones into
~/.claude/settings.jsonon explicit confirmation.
Read references/safety-tiers.md first
Classification rules and the permission syntax table live there. Two things matter most:
- The RED override. Anything that can execute arbitrary code — directly or via
run/exec/startsubcommands — is RED, even if the same tool is a "package manager" or "build tool".npm,npx,uv,bundle,pipx,bunx,deno,miseand bare interpreters (bash,python,node,ruby) are never auto-allow candidates. - Read-only is not "looks read-only". A linter is GREEN only when it cannot mutate files (
eslintwithout--fix,rubocopwithout-A/-a).
references/security-rationale.md covers the threat model (prompt injection, supply chain, side effects) — cite it when a user pushes back on a RED.
Constraints:
- Present the classified commands grouped by safety tier in a table before asking for confirmation.
- Dedup against the target file — the user's global
~/.claude/settings.jsonpermissions.allow. Skip a command only if it is already allowed there; a command being present in the project.claude/settings.jsonallowlist is not a reason to skip promoting it to the global allowlist. - Never write to
~/.claude/settings.jsonwithout explicit user confirmation viaAskUserQuestion. Show the diff first. - When merging accepted patterns into
permissions.allow, preserve every other key insettings.json— surgical merge, never a full-file overwrite. - Back up the file before attempting to repair a malformed
settings.json. - Use the Permission Syntax table in
safety-tiers.mdfor rule format — don't improvise patterns.
Resources
references/safety-tiers.md— Classification rules, RED override, permission syntaxreferences/security-rationale.md— Threat model and defense layers
版本历史
- 59213af 当前 2026-07-19 09:00


