← 文章 / AI技术
每天一个开发小知识 6小时前 · 2026-09-26 18:14:08 · 3 阅读

428.你的AI编程到哪一步了?(permissions)

之前提到 Claude Code 的开发模式,那就不得不再提 permissionsClaude 有一个功能,在对话框输入:/permissions就可以看到对应的配置,也就是开篇图片

permissions

permissions 可以配置:
  • 哪些命令执行时不需要用户确认(allow)
  • 哪些命令执行时需要用户确认(ask)
  • 哪些命令禁止 CC 执行(deny)
其实,自己平时在和 AI 对话的过程中,也用到了这个功能那些 「not ask again」的命令就会保存到 permissions 中由于当时并不知道配置 permissions 的原则导致很多不能/不需要保存的命令,也保存到 permissions 中比如搜索指定字符串的命令:grep -r "xxx"

优化

好在我一直奉行「用 AI 优化 AI」,最后 permissions 配置精简成这样
{
  "permissions": {
    "allow": [
      "Bash(bazel info *)",
      "Bash(claude --version)",
      "Bash(claude auto-mode *)",
      "Bash(claude config *)",
      "Bash(claude doctor *)",
      "Bash(claude plugin *)",
      "Bash(command -v sshpass)",
      "Bash(curl *)",
      "Bash(git diff *)",
      "Bash(git log *)",
      "Bash(git status)",
      "Bash(grep *)",
      "Bash(npm view *)",
      "Bash(ps *)",
      "Bash(python3 test_tools/main_test.py *)",
      "Bash(rg *)",
      "Bash(ssh *)",
      "Edit",
      "Fetch",
      "Glob",
      "Grep",
      "Read",
      "Skill(claude-api)",
      "Skill(update-config)",
      "WebFetch",
      "WebSearch",
      "Edit(//Users/chenhong39/Downloads/**)",
      "Edit(//tmp/**)"
    ],
    "ask": [
    ],
    "deny": [
      "Bash(rm -rf *)"
    ]
  }
}

最后

使用开发模式中的auto mode 搭配permissions 真的不要太爽,基本告别「YES工程师」

你的AI编程到哪一步了?

评论 (0)