Analyze permission prompts and auto mode denials, then generate permission rules and autoMode entries that cut prompt fatigue. Use when prompts keep interrupting, auto mode falls back to prompting, or after sessions with many denials.
git clone https://github.com/rohitg00/pro-workflow.git--- name: permission-tuner description: Analyze permission prompts and auto mode denials, then generate permission rules and autoMode entries that cut prompt fatigue. Use when prompts keep interrupting, auto mode falls back to prompting, or after sessions with many denials. user-invocable: true --- # Permission Tuner Reduce permission prompts by fixing their causes, not by piling up rules. ## Trigger Use when: - Permission prompts interrupt flow repeatedly - Auto mode keeps blocking routine work or falls back to prompting everything - Starting a new project and want to configure permissions ## How Prompts Happen - Rules resolve first: deny > ask > allow. A matching ask rule prompts even in auto mode, and a PreToolUse hook returning `allow` cannot override it. - In auto mode, anything no rule resolves goes to a classifier. After 3 blocks in a row or 20 in a session, auto mode pauses and prompts for everything until you approve one. - Auto mode drops broad allow rules: `Bash(*)`, wildcarded interpreters like `Bash(node *)`, package-manager run commands, `Agent`, and `Monitor`. - Hooks that exit 2 on harmless commands count as denials and push the session toward that fallback. ## Workflow ### Step 1: Gather data Rules merge across scopes, so check every file that exists, not only the user file. `/permissions` shows the rules Claude Code actually loaded, and `claude auto-mode config` shows the effective `autoMode` (the classifier ignores `autoMode` in `.claude/settings.local.json`). ```bash for f in ~/.claude/settings.json .claude/settings.json .claude/settings.local.json; do [ -f "$f" ] && jq --arg f "$f" '{file: $f, mode: .permissions.defaultMode, allow: (.permissions.allow|length), ask: (.permissions.ask|length), deny: (.permissions.deny|length), autoMode: (.autoMode != null)}' "$f" done claude auto-mode config ls -t ~/.claude/projects/*/*.jsonl | head -20 | xargs grep -ho '"toolDenialKind":"[^"]*"' | sort | uniq -c | sort -rn ``` `toolDenialKind` values seen in transcripts (undocumented, may change): `permission-rule` (rule or hook), `automode-blocked` (classifier), `automode-parsing-error` and `automode-unavailable` (no verdict, not tunable), `user-rejected` (you said no). ### Step 2: Pick the right fix | Symptom | Fix | |---------|-----| | Prompt on something you always approve | Remove or narrow the ask rule | | `permission-rule` on a harmless command | Fix the hook false positive or narrow the deny rule | | Classifier blocks work in your own repos, registries, local services | Add an `autoMode.environment` entry | | Classifier blocks one routine pattern | Add an `autoMode.allow` entry | | Want outward actions only when you asked | Add an `autoMode.soft_deny` entry | | Want a human check every time | Keep a short `permissions.ask` rule | ### Step 3: Generate rules ```json { "permissions": { "allow": [ "Bash(git status)", "Bash(npm test)", "Bash(npm run lint)" ], "ask": [ "Bash(git push --force*)", "Bash(git push * main)", "Bash(git push * main *)", "Bash(git push *:main)", "Bash(git push *:main *)", "Bash(git push * master)", "Bash(git push * master *)", "Bash(git push *:master)", "Bash(git push *:master *)", "Bash(gh pr merge *)", "Bash(npm publish*)" ], "deny": [ "Bash(rm -rf *)", "Read(**/.env)", "Read(**/.env.*)" ] }, "autoMode": { "environment": [ "$defaults", "Source control: repositories under github.com/your-org are trusted; feature-branch pushes are routine." ], "allow": ["$defaults"], "soft_deny": [ "$defaults", "Merging a pull request needs the user's approval for that specific merge." ] } } ``` `autoMode` only takes effect in `~/.claude/settings.json`, managed settings, or `--settings`. Keep `"$defaults"` in each list. Check the result with `claude auto-mode config` and review custom rules with `claude auto-mode critique`. ## Output ```text PERMISSION TUNER REPORT Mode: [mode] Rules: [X] allow, [Y] ask, [Z] deny autoMode: [yes/no] Denials: [n] permission-rule, [n] classifier, [n] no verdict, [n] you rejected Remove (ask rules you always approve): - Bash(...) -- approved [n]x Add to autoMode.environment: + "..." -- clears [n] blocks Add to autoMode.allow / soft_deny: + "..." Fix hooks: ! [script] blocked [n] harmless commands Keep asking: ~ force push, merge, publish, deploy Estimated prompts saved per session: ~[N] ``` ## Rules - Prefer `autoMode` entries over new ask rules - Destructive operations stay in deny or ask - Always present changes for user approval before applying - Never write `autoMode` into project settings - Include estimated prompt savings
[{"step":1,"action":"Collect permission-related issues. Gather session logs from [TOOL_NAME] or user feedback highlighting denied permissions, repeated prompts, or autoMode fallbacks. Save this data in a file named [SESSION_LOG_FILE].","tip":"Use the tool's built-in logging feature to export permission-related events. Filter for 'denied', 'prompted', or 'autoMode_fallback' entries."},{"step":2,"action":"Identify patterns. Review the collected data to spot recurring issues, such as specific resources, actions, or user roles that trigger denials or prompts. Note any common conditions (e.g., time of day, user role).","tip":"Look for clusters of denials around the same resource or action. For example, if 'user.profile' is denied 15 times in a session, it’s a strong candidate for a new rule."},{"step":3,"action":"Generate permission rules and autoMode entries. Use the prompt template to input the identified patterns and generate a JSON configuration file. Replace [SESSION_LOG_FILE] with the path to your log file and [TOOL_NAME] with the system you’re configuring (e.g., 'Claude', 'ChatGPT', or a custom AI tool).","tip":"Start with high-frequency denials or interruptions. Prioritize rules that cover the most common issues first to maximize impact."},{"step":4,"action":"Test and refine. Apply the generated JSON configuration to your system and monitor permission-related events for 24-48 hours. Adjust rules or autoMode entries as needed based on new data.","tip":"Use the tool’s validation feature to check for syntax errors in the JSON before applying. After applying, check the logs to confirm the new rules are working as intended."},{"step":5,"action":"Document and maintain. Save the finalized JSON configuration as a reference file (e.g., 'permission_rules.json') and update it regularly as new permission issues arise or system requirements change.","tip":"Schedule a monthly review of permission logs to proactively address emerging patterns before they cause interruptions."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/rohitg00/pro-workflow/tree/main/skills/permission-tunerCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Review the following permission-related issues from [SESSION_LOG_FILE] or [USER_FEEDBACK]: [LIST_OF_DENIALS_OR_INTERRUPTIONS]. Identify patterns in the denied permissions or repeated prompts. Generate a set of permission rules and autoMode entries that would prevent these issues in future sessions. Include specific conditions, actions, and fallback behaviors. Format the output as a JSON configuration file for [TOOL_NAME] or [SYSTEM_NAME].
```json
{
"permission_rules": [
{
"id": "rule_001",
"description": "Allow read-only access to user profile data unless sensitive fields are requested.",
"conditions": {
"resource": "user.profile",
"action": "read",
"fields": ["name", "email", "preferences"],
"exceptions": ["ssn", "password_hash"]
},
"action": "grant",
"fallback": "prompt_user_for_verification"
},
{
"id": "rule_002",
"description": "Block write access to system configurations unless explicitly approved by admin.",
"conditions": {
"resource": "system.config",
"action": "write",
"required_roles": ["admin"]
},
"action": "deny",
"fallback": "autoMode_fallback_to_prompt"
}
],
"autoMode_entries": [
{
"id": "auto_001",
"trigger": "user.requests_data_export",
"conditions": {
"user_role": "standard",
"data_type": "non_sensitive"
},
"action": "grant_export_permission",
"fallback": "none"
},
{
"id": "auto_002",
"trigger": "system.detects_anomaly",
"conditions": {
"severity": "high",
"user_role": "standard"
},
"action": "escalate_to_admin",
"fallback": "prompt_user_for_consent"
}
]
}
```
### Explanation:
The generated rules address two common issues from the session logs: repeated prompts for user profile data and autoMode falling back to prompting when writing system configurations. **Rule 001** now automatically grants read access to non-sensitive profile fields, reducing interruptions. **Rule 002** explicitly denies write access to system configurations unless the user is an admin, preventing unauthorized changes. The autoMode entries further streamline permissions: **Auto 001** allows standard users to export non-sensitive data without prompts, while **Auto 002** escalates high-severity anomalies to admins, ensuring security without unnecessary user prompts. These changes are estimated to reduce permission-related interruptions by **70%** based on historical denial patterns.skills-collection
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan