Skill站外收录 @skilllib/skill-2117939930272413177
skill-permissions
自动分析各技能文件中声明的系统命令调用需求,生成对应权限规则并支持按需授权,可对单个或全部技能执行一次性权限配置,同时严格拦截高危操作如强制删除、提权执行和远程代码注入等。
测试与安全 AI 技能
Skills.MD
# Skill Permissions
Automatically analyze permissions required by all skills in Claude Code and generate one-time authorization commands.
## Dangerous Operations Warning
**This skill can modify other skill files.** The following commands may cause widespread file changes:
| Command | Risk Level | Description |
|---------|------------|-------------|
| `/skill-permissions inject` | High | Batch modify all skill SKILL.md files |
| `/skill-permissions allow-all` | Medium | Batch modify settings.json |
| `/skill-permissions allow <name>` | Low | Only modify settings.json |
| `/skill-permissions <name>` | Safe | Read-only analysis, no file modifications |
**Recommendations:**
- Prefer **explicit commands** (e.g., `/skill-permissions allow port-allocator`)
- Avoid `inject` or `allow-all` unless you understand the impact
- Run `/skill-permissions` first to see analysis results before batch operations
## Usage
| Command | Description |
|---------|-------------|
| `/skill-permissions` | Analyze all skills and show permission summary |
| `/skill-permissions <skill-name>` | Analyze specific skill's permission requirements |
| `/skill-permissions allow <skill-name>` | Execute one-time authorization for specific skill |
| `/skill-permissions allow-all` | Execute one-time authorization for all skills |
| `/skill-permissions inject` | Inject allow command into all skills |
| `/skill-permissions allow` | Execute one-time authorization for this skill |
## How It Works
### 1. Permission Analysis
Scan skill's SKILL.md file, identifying patterns like:
**Bash Command Patterns:**
```
find * → Bash(find *)
ls * → Bash(ls *)
cat ~/.claude/* → Bash(cat ~/.claude/*)
lsof -i:3* → Bash(lsof -i:3*)
git * → Bash(git *)
npm * → Bash(npm *)
```
**Recognition Rules:**
- Bash commands in code blocks (```bash ... ```)
- Inline commands (`command`)
- Explicitly mentioned system commands
### 2. Permission Rule Generation
Convert identified commands to `permissions.allow` rules:
```json
{
"permissions": {
"allow": [
"Bash(find * -name package.json *)",
"Bash(ls -d *)",
"Bash(cat ~/.claude/*)",
"Bash(lsof -i:3*)"
]
}
}
```
## Execution Steps
### Command: `/skill-permissions`
Analyze all skills and show permission summary:
1. **Scan all skills**
```bash
find ~/.claude/skills -name "SKILL.md" -type f 2>/dev/null
```
2. **Analyze permissions for each skill**
- Read SKILL.md content
- Extract bash code blocks
- Identify command patterns
- Generate permission rules
3. **Output analysis results**
### Command: `/skill-permissions <skill-name>`
Analyze specific skill's permission requirements:
1. **Locate skill**
```bash
SKILL_PATH=$(find ~/.claude/skills -type d -name "<skill-name>" 2>/dev/null | head -1)
```
2. **Read and analyze SKILL.md**
3. **Output detailed permission list**
### Command: `/skill-permissions allow <skill-name>`
Execute one-time authorization for specific skill:
1. **Analyze skill permission requirements**
2. **Read existing config**
3. **Merge permission rules** (deduplicate, preserve existing rules)
4. **Write config file**
5. **Output authorization result**
## Blocked Commands
The following command patterns are **automatically blocked** and won't be added to the allowlist:
### Dangerous File Operations
| Command | Reason |
|---------|--------|
| `rm *` | File deletion, may cause data loss |
| `rm -rf *` | Recursive force delete, extremely dangerous |
| `sudo *` | Super user privileges |
| `chmod 777 *` | Opens all permissions |
### Dangerous Process Operations
| Command | Reason |
|---------|--------|
| `kill -9 *` | Force kill process |
| `pkill *` | Kill processes by name |
| `curl * \| bash` | Remote code execution |
| `eval *` | Dynamic code execution |
### Dangerous Git Operations
| Command | Reason |
|---------|--------|
| `git push --force *` | Force push, may overwrite remote |
| `git reset --hard *` | Hard reset, loses uncommitted changes |
## Output Format
### Analysis Result (Single Skill)
```
Skill: port-allocator
Location: ~/.claude/skills/port-allocator
Detected commands:
- find ~/Codes -maxdepth 3 -name "package.json"
- ls -d */
- cat ~/.claude/port-registry.json
- lsof -i:3000
Generated permission rules:
- Bash(find * -maxdepth * -name package.json *)
- Bash(ls -d *)
- Bash(cat ~/.claude/*)
- Bash(lsof -i:3*)
Run `/skill-permissions allow port-allocator` to authorize
```
### Authorization Success
```
Permission authorization successful
Skill: port-allocator
Added permission rules:
- Bash(find * -maxdepth * -name package.json *)
- Bash(ls -d *)
- Bash(cat ~/.claude/*)
- Bash(lsof -i:3*)
Config file: ~/.claude/settings.json
New permissions take effect in next session, or run /clear to apply immediately
```
## Configuration Files
- **Permission config**: `~/.claude/settings.json`
- **Skill directory**: `~/.claude/skills/`
## First Use
If you encounter permission prompts, first run:
```
/skill-permissions allow
```
### Command: `/skill-permissions allow`
Execute one-time authorization for this skill:
1. Read `~/.claude/settings.json`
2. Merge the following permissions to `permissions.allow`:
```json
{
"permissions": {
"allow": [
"Bash(find ~/.claude/skills *)",
"Bash(cat ~/.claude/*)"
]
}
}
```
3. Write config file (preserve existing permissions)
4. Output authorization result
## Notes
1. **Conservative analysis** - Only identify explicitly appearing commands, avoid over-authorization
2. **Deduplicated merge** - New permissions merge with existing, no duplicates
3. **No deletion** - Only adds permissions, won't delete user's existing permission config
4. **Wildcards** - Use `*` to match varying parameter parts
5. **Session effect** - Permission updates require new session or /clear to take effect
6. **Explicit preferred** - Recommend explicit commands over batch operations to reduce risks
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「skill-permissions」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次