Skill in 《Tool Permission System》

Skill Description

Design a configurable, layered permission/safety system for agent tools: one permission pipeline decides allow / ask / deny, rules layer across enterprise / user / project scopes, and the system is extensible through hooks.

Skill.md

Tool Permission System

Every agent that can edit files, run commands, or call external APIs eventually faces the same question on each tool call: auto-allow, ask the user, or deny? Scatter that decision across individual tools and your safety policy turns into an unauditable mess. This skill collapses it into one permission pipeline — every tool call passes through the same pipeline before execution, and it is the single place that decides allow / ask / deny.

Core Architecture

The pipeline order is deliberate, short-circuiting from the hardest block to the most permissive default:

LayerRole
deny rulesHard veto, immediate deny
ask rulesForced confirmation, not skippable even in bypass mode
checkPermissions()The tool's own tool-specific logic
safetyCheckDangerous paths (.git/, .claude/, shell configs) prompt, immune to bypass
bypass modeFast path, immediate allow
allow rulesAllowlist, immediate allow
defaultpassthrough → prompt the user

There are only three decision behaviors: allow, deny, ask. Don't invent new states.

Layered Rule Sources

Rules layer by scope, highest priority first: policySettings (enterprise admin, non-overridable) → userSettingsprojectSettingslocalSettingscliArgcommandsession. The key is that conflicts are settled by behavior order: the pipeline checks deny across all sources first, then ask, and only then allow — so enterprise enforcement always beats a user allowlist.

When to Use It

Use this skill when building or reviewing:

  • allow / ask / deny decisions for tool calls
  • rule configuration across project / user / enterprise scopes
  • a tool-level checkPermissions() contract
  • non-bypassable guardrails for dangerous operations (safetyCheck)
  • a hook system's configuration format and lifecycle
  • unattended / CI auto-deny plus an AI-classifier circuit breaker

How to Use

  1. Implement hasPermission(tool, input, context) that short-circuits in the order above.
  2. Implement checkPermissions() per tool for tool-specific rules and dangerous paths.
  3. Configure layered rules and hooks via settings.json; add the dontAsk wrapper for unattended runs.

Boundaries

This skill only owns the design and implementation of the permission decision. It does not own a tool's business logic, the confirmation-dialog UI, user identity authentication, or the prompt engineering of an AI classifier.

Install & Use

Install command

npx skills add simbajigege/book2skills/skills/tool-permission-system
OR

Direct download

Related Skills

LangChain Tool Builder AI Skill

Build LangChain (Python) tools using Claude Code's fail-closed design pattern — unified name, schema, security, and execution in one class, with ...

Query Loop Implementation AI Skill

Implement a production-ready LLM query loop for AI applications: tool calling, structured tool_result feedback, ReAct-style cycles, max-turn exits, ...

Agent Memory Implementation Guide AI Skill

Restructures a bloated or chaotic MEMORY.md into the 2-layer architecture Claude Code's autoDream service uses internally — keeping the index lean ...

Compact with Memory AI Skill

Executes /compact correctly — generates a high-quality conversation summary that preserves reasoning, decisions, and current state, with a memory ...

Session Dream AI Skill

On-demand session memory distillation — extracts key decisions, eliminated approaches, new discoveries, and current blockers and writes them to ...

Compact Memory Implementation Guide AI Skill

A developer implementation guide for adding compact memory to an Agent built with the Anthropic API or Claude Agent SDK — trigger strategy, the ...

Harness Step 1 — Create AGENTS.md & Knowledge Base AI Skill

Scans your codebase and generates AGENTS.md plus a complete docs/ knowledge base skeleton, so any Claude Code session orients in under 30 seconds.

Harness Step 2 — Fill docs/ with Real Content AI Skill

Deep-reads your codebase and fills every docs/ file with specific, accurate content grounded in what the code actually does.

Harness Step 3 — Session State Management AI Skill

Creates init.sh, tasks.json, and progress.md — so any new Claude Code session recovers full working context in under 30 seconds.

Understanding Financial Statements AI Skill

Analyze company financials using Tsinghua Professor Xiao Xing's three-statement framework. Apply to any company: balance sheet, income, cash flow.