Loading...
Loading...
Compare original and translation side by side
| Use this skill when... | Use something else when... |
|---|---|
| Setting up project permissions | Fixing plugin registry issues (use plugin-registry skill) |
| Debugging "permission denied" errors | Configuring hooks (use hooks-configuration skill) |
| Understanding settings hierarchy | Setting up MCP servers (use mcp-configuration skill) |
| Creating allow/deny patterns |
| 适用场景 | 其他场景(使用对应Skill) |
|---|---|
| 设置项目权限 | 修复插件注册表问题(使用plugin-registry skill) |
| 调试“权限被拒绝”错误 | 配置钩子(使用hooks-configuration skill) |
| 理解设置层级 | 设置MCP服务器(使用mcp-configuration skill) |
| 创建允许/阻止模式 |
| Priority | File | Scope | Commit to Git? |
|---|---|---|---|
| 1 (lowest) | | User-level (all projects) | N/A |
| 2 | | Project-level | Yes |
| 3 (highest) | | Local overrides | No (gitignore) |
| 优先级 | 文件 | 作用域 | 是否提交到Git? |
|---|---|---|---|
| 1(最低) | | 用户级(所有项目) | 不适用 |
| 2 | | 项目级 | 是 |
| 3(最高) | | 本地覆盖 | 否(加入gitignore) |
{
"permissions": {
"allow": [
"Bash(git status *)",
"Bash(npm run *)"
],
"deny": [
"Bash(rm -rf *)",
"Bash(sudo *)"
]
}
}{
"permissions": {
"allow": [
"Bash(git status *)",
"Bash(npm run *)"
],
"deny": [
"Bash(rm -rf *)",
"Bash(sudo *)"
]
}
}allowdenyallowdenyToolName(command prefix *)ToolName()Bashcommand prefix*ToolName(command prefix *)ToolName()Bashcommand prefix*| Pattern | Matches | Does NOT Match |
|---|---|---|
| | |
| | |
| | |
| | |
| 模式 | 匹配项 | 不匹配项 |
|---|---|---|
| | |
| | |
| | |
| | |
{
"permissions": {
"allow": [
"Bash(git status *)",
"Bash(git diff *)",
"Bash(git log *)",
"Bash(git add *)",
"Bash(git commit *)"
]
}
}{
"permissions": {
"allow": ["Bash(git *)"]
}
}{
"permissions": {
"allow": [
"Bash(git status *)",
"Bash(git diff *)",
"Bash(git log *)",
"Bash(git add *)",
"Bash(git commit *)"
]
}
}{
"permissions": {
"allow": ["Bash(git *)"]
}
}| Operator | Risk | Blocked Example |
|---|---|---|
| Command chaining | |
| Conditional execution | |
| Command separation | |
| Piping | |
| Redirection | |
| Command substitution | |
| Backtick substitution | |
| 操作符 | 风险 | 被阻止的示例 |
|---|---|---|
| 命令链式执行 | |
| 条件执行 | |
| 命令分隔 | |
| 管道 | |
| 重定向 | |
| 命令替换 | |
| 反引号替换 | |
#!/bin/bash#!/bin/bash
Then allow the script:
```json
{
"permissions": {
"allow": ["Bash(./scripts/test-and-build.sh *)"]
}
}
然后允许该脚本:
```json
{
"permissions": {
"allow": ["Bash(./scripts/test-and-build.sh *)"]
}
}{
"permissions": {
"allow": [
"Bash(git status *)",
"Bash(git diff *)",
"Bash(git log *)",
"Bash(git branch *)",
"Bash(git add *)",
"Bash(git commit *)",
"Bash(git push *)",
"Bash(git pull *)",
"Bash(git fetch *)",
"Bash(git checkout *)"
]
}
}{
"permissions": {
"allow": [
"Bash(git status *)",
"Bash(git diff *)",
"Bash(git log *)",
"Bash(git branch *)",
"Bash(git add *)",
"Bash(git commit *)",
"Bash(git push *)",
"Bash(git pull *)",
"Bash(git fetch *)",
"Bash(git checkout *)"
]
}
}{
"permissions": {
"allow": [
"Bash(gh pr *)",
"Bash(gh run *)",
"Bash(gh issue *)",
"Bash(gh workflow *)"
]
}
}{
"permissions": {
"allow": [
"Bash(gh pr *)",
"Bash(gh run *)",
"Bash(gh issue *)",
"Bash(gh workflow *)"
]
}
}{
"permissions": {
"allow": [
"Bash(npm test *)",
"Bash(bun test *)",
"Bash(vitest *)",
"Bash(biome *)",
"Bash(eslint *)",
"Bash(prettier *)"
]
}
}{
"permissions": {
"allow": [
"Bash(npm test *)",
"Bash(bun test *)",
"Bash(vitest *)",
"Bash(biome *)",
"Bash(eslint *)",
"Bash(prettier *)"
]
}
}{
"permissions": {
"allow": [
"Bash(pre-commit *)",
"Bash(gitleaks *)",
"Bash(trivy *)"
]
}
}{
"permissions": {
"allow": [
"Bash(pre-commit *)",
"Bash(gitleaks *)",
"Bash(trivy *)"
]
}
}{
"permissions": {
"allow": [
"mcp__context7",
"mcp__sequential-thinking"
]
}
}{
"permissions": {
"allow": [
"mcp__context7",
"mcp__sequential-thinking"
]
}
}mkdir -p .claudemkdir -p .claudecat > .claude/settings.json << 'EOF'
{
"permissions": {
"allow": [
"Bash(git status *)",
"Bash(git diff *)",
"Bash(npm run *)"
]
}
}
EOFcat > .claude/settings.json << 'EOF'
{
"permissions": {
"allow": [
"Bash(git status *)",
"Bash(git diff *)",
"Bash(npm run *)"
]
}
}
EOFecho ".claude/settings.local.json" >> .gitignoreecho ".claude/settings.local.json" >> .gitignorecat > .claude/settings.local.json << 'EOF'
{
"permissions": {
"allow": [
"Bash(docker *)"
]
}
}
EOFcat > .claude/settings.local.json << 'EOF'
{
"permissions": {
"allow": [
"Bash(docker *)"
]
}
}
EOFcat .claude/settings.json | jq .cat .claude/settings.json | jq .cat .claude/settings.json | jq '.permissions'cat .claude/settings.json | jq '.permissions'echo "=== User ===" && cat ~/.claude/settings.json 2>/dev/null | jq '.permissions // empty'
echo "=== Project ===" && cat .claude/settings.json 2>/dev/null | jq '.permissions // empty'
echo "=== Local ===" && cat .claude/settings.local.json 2>/dev/null | jq '.permissions // empty'echo "=== 用户级 ===" && cat ~/.claude/settings.json 2>/dev/null | jq '.permissions // empty'
echo "=== 项目级 ===" && cat .claude/settings.json 2>/dev/null | jq '.permissions // empty'
echo "=== 本地级 ===" && cat .claude/settings.local.json 2>/dev/null | jq '.permissions // empty'| Symptom | Cause | Fix |
|---|---|---|
| Permission denied | Pattern doesn't match | Add more specific pattern |
| Shell operator blocked | Contains | Use wrapper script |
| Settings not applied | Wrong file path | Check |
| JSON parse error | Invalid JSON syntax | Validate with |
| Permissions ignored | File not readable | Check file permissions |
| 症状 | 原因 | 解决方法 |
|---|---|---|
| 权限被拒绝 | 模式不匹配 | 添加更具体的模式 |
| Shell操作符被阻止 | 包含 | 使用包装脚本 |
| 设置未生效 | 文件路径错误 | 检查 |
| JSON解析错误 | JSON语法无效 | 使用 |
| 权限被忽略 | 文件不可读 | 检查文件权限 |
| Context | Command |
|---|---|
| View project perms | |
| View user perms | |
| Validate JSON | |
| Count patterns | |
| 场景 | 命令 |
|---|---|
| 查看项目权限 | |
| 查看用户级权限 | |
| 验证JSON | |
| 统计模式数量 | |
| Scope | Path |
|---|---|
| User | |
| Project | |
| Local | |
| 作用域 | 路径 |
|---|---|
| 用户级 | |
| 项目级 | |
| 本地级 | |
Bash(command prefix *)
mcp__server_nameBash(command prefix *)
mcp__server_name