ClaudeCode/Codex使用优化

ClaudeCode/Codex使用优化

强烈建议使用 cc-switch 管理 ClaudeCode 和 Codex:cc-switch

ByPass模式软链接

ClaudeCode

Windows(PowerShell)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$libexec = "$HOME\.local\libexec"
$bin = "$HOME\.local\bin"

# 创建目录
New-Item -ItemType Directory -Force $libexec, $bin | Out-Null

# 创建实际启动脚本
@'
@echo off
claude --dangerously-skip-permissions %*
'@ | Set-Content -Encoding ASCII "$libexec\claude-danger.cmd"

# 创建软链接
New-Item -ItemType SymbolicLink `
-Path "$bin\claude-danger.cmd" `
-Target "$libexec\claude-danger.cmd"

# 永久添加到当前用户 PATH
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")

$pathEntries = @(
$userPath -split ";" |
Where-Object { $_ -and $_.Trim() }
)

if ($pathEntries -notcontains $bin) {
$newUserPath = (@($pathEntries) + $bin) -join ";"
[Environment]::SetEnvironmentVariable(
"Path",
$newUserPath,
"User"
)
}

# 让当前 PowerShell 窗口立即生效
if (($env:Path -split ";") -notcontains $bin) {
$env:Path = "$bin;$env:Path"
}

Write-Host "安装完成:" -ForegroundColor Green
Write-Host " $bin\claude-danger.cmd"
Write-Host ""
Write-Host "现在可以运行:claude-danger"

验证:

1
2
Get-Command claude-danger
claude-danger --version

使用:

1
2
3
claude-danger
claude-danger -p "检查这个项目"
claude-danger -p "修复所有测试"

如果 New-Item -ItemType SymbolicLink 提示权限不足,请启用 Windows“开发人员模式”,或使用管理员 PowerShell 执行。

macOS(zsh)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 创建目录
mkdir -p "$HOME/.local/libexec" "$HOME/.local/bin"

# 创建实际启动脚本
cat > "$HOME/.local/libexec/claude-danger" <<'SH'
#!/bin/sh
exec claude --dangerously-skip-permissions "$@"
SH

chmod +x "$HOME/.local/libexec/claude-danger"

# 创建软链接
ln -sfn \
"$HOME/.local/libexec/claude-danger" \
"$HOME/.local/bin/claude-danger"

# 永久添加到 zsh PATH
PATH_LINE='export PATH="$HOME/.local/bin:$PATH"'

grep -qxF "$PATH_LINE" "$HOME/.zshrc" 2>/dev/null ||
printf '\n%s\n' "$PATH_LINE" >> "$HOME/.zshrc"

# 让当前终端立即生效
export PATH="$HOME/.local/bin:$PATH"

echo "安装完成:$HOME/.local/bin/claude-danger"

验证:

1
2
command -v claude-danger
claude-danger --version

使用:

1
2
3
claude-danger
claude-danger -p "检查这个项目"
claude-danger -p "修复所有测试"

claude-danger 会绕过全部权限检查,只应在无互联网的容器、虚拟机或其他外部隔离环境中运行。

Codex

三个命令对应关系如下:

1
2
3
codex-danger-sandbox → 绕过审批和沙箱
codex-danger-hook → 只绕过 Hook 信任
codex-danger-both → 两者都绕过

Windows(PowerShell)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$libexec = "$HOME\.local\libexec"
$bin = "$HOME\.local\bin"

New-Item -ItemType Directory -Force $libexec, $bin | Out-Null

@'
@echo off
codex --dangerously-bypass-approvals-and-sandbox %*
'@ | Set-Content -Encoding ASCII "$libexec\codex-danger-sandbox.cmd"

@'
@echo off
codex --dangerously-bypass-hook-trust %*
'@ | Set-Content -Encoding ASCII "$libexec\codex-danger-hook.cmd"

@'
@echo off
codex --dangerously-bypass-approvals-and-sandbox --dangerously-bypass-hook-trust %*
'@ | Set-Content -Encoding ASCII "$libexec\codex-danger-both.cmd"

New-Item -ItemType SymbolicLink `
-Path "$bin\codex-danger-sandbox.cmd" `
-Target "$libexec\codex-danger-sandbox.cmd"

New-Item -ItemType SymbolicLink `
-Path "$bin\codex-danger-hook.cmd" `
-Target "$libexec\codex-danger-hook.cmd"

New-Item -ItemType SymbolicLink `
-Path "$bin\codex-danger-both.cmd" `
-Target "$libexec\codex-danger-both.cmd"

$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
if (($userPath -split ";") -notcontains $bin) {
[Environment]::SetEnvironmentVariable(
"Path",
$userPath.TrimEnd(";") + ";" + $bin,
"User"
)
}

重新打开终端即可使用。

macOS(zsh)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
mkdir -p ~/.local/libexec ~/.local/bin

cat > ~/.local/libexec/codex-danger-sandbox <<'SH'
#!/bin/sh
exec codex --dangerously-bypass-approvals-and-sandbox "$@"
SH

cat > ~/.local/libexec/codex-danger-hook <<'SH'
#!/bin/sh
exec codex --dangerously-bypass-hook-trust "$@"
SH

cat > ~/.local/libexec/codex-danger-both <<'SH'
#!/bin/sh
exec codex \
--dangerously-bypass-approvals-and-sandbox \
--dangerously-bypass-hook-trust \
"$@"
SH

chmod +x ~/.local/libexec/codex-danger-*

ln -sfn ~/.local/libexec/codex-danger-sandbox \
~/.local/bin/codex-danger-sandbox

ln -sfn ~/.local/libexec/codex-danger-hook \
~/.local/bin/codex-danger-hook

ln -sfn ~/.local/libexec/codex-danger-both \
~/.local/bin/codex-danger-both

grep -qxF 'export PATH="$HOME/.local/bin:$PATH"' ~/.zshrc ||
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc

source ~/.zshrc

之后两端都可以这样调用:

1
2
3
codex-danger-sandbox
codex-danger-hook -C ./my-project
codex-danger-both "检查并修复所有测试"

所有额外参数都会原样传给 codex

插件/扩展

ccstatusline-zh

Claude Code CLI 可定制状态栏格式化工具。本机当前未在 PATH 中检测到该命令,现用的是 OMC HUD;下面保留独立安装方法。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 通过 npm 全局安装:
npm install -g ccstatusline-zh

# 编辑 ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "ccstatusline-zh",
"padding": 0,
"refreshInterval": 10
}
}

# 启动配置界面
ccstatusline-zh setup

个人自用配置,~/.config/ccstatusline/setting.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{
"version": 3,
"lines": [
[
{
"id": "1",
"type": "model",
"color": "cyan"
},
{
"id": "2",
"type": "separator"
},
{
"id": "3",
"type": "context-length",
"color": "brightBlack"
},
{
"id": "4",
"type": "separator"
},
{
"id": "5",
"type": "git-branch",
"color": "magenta"
},
{
"id": "6",
"type": "separator"
},
{
"id": "7",
"type": "git-changes",
"color": "yellow"
}
],
[
{
"id": "b6282fdf-ce69-4cbf-b110-6a527bc3d4cc",
"type": "thinking-effort"
},
{
"id": "e7cc9595-735e-4825-bf7f-1b8f5585ec78",
"type": "separator"
},
{
"id": "0060d01c-27dc-47e7-a04c-4ba3d194052e",
"type": "tokens-input"
},
{
"id": "7ae3115b-77fd-4b5a-bc80-7cf601ca650d",
"type": "separator"
},
{
"id": "12049e30-acb7-43cc-8e4e-73bb01835620",
"type": "tokens-output"
},
{
"id": "59a6190f-2f52-4dc8-8517-fb5b87412251",
"type": "separator"
},
{
"id": "ba869255-3f0f-44d9-8651-89dc64aca344",
"type": "tokens-cached"
},
{
"id": "1ca5c436-cc96-4a70-965d-4f40307df60e",
"type": "separator"
},
{
"id": "f0a10552-a3ce-4d7c-8418-ed73574dbefe",
"type": "tokens-total"
}
],
[
{
"id": "e37d38a6-eee4-44d1-9525-778231f9ea70",
"type": "session-usage"
},
{
"id": "319b1b10-0366-4964-a2e5-cf8238e0bbb6",
"type": "separator"
},
{
"id": "7be0d38b-883b-42bd-a112-a199517e7b18",
"type": "context-percentage-usable"
},
{
"id": "86823a2b-5d40-4cb8-b00e-80625ad02904",
"type": "separator"
},
{
"id": "a94323ed-bc10-493a-9a0f-fb1f0cf9ae93",
"type": "reset-timer"
},
{
"id": "48c66ed7-fa34-4e8f-b532-2f1f165a55b9",
"type": "separator"
},
{
"id": "ffbffe3f-ce82-47e8-9a52-d415596b2f10",
"type": "weekly-usage"
},
{
"id": "61df48f1-d2f0-4108-9cce-4a86799d954e",
"type": "separator"
},
{
"id": "1518ca25-6485-4c30-98c2-e342283c95ed",
"type": "weekly-reset-timer"
}
]
],
"flexMode": "full-minus-40",
"compactThreshold": 60,
"colorLevel": 2,
"inheritSeparatorColors": false,
"globalBold": false,
"gitCacheTtlSeconds": 5,
"minimalistMode": false,
"powerline": {
"enabled": false,
"separators": [
""
],
"separatorInvertBackground": [
false
],
"startCaps": [],
"endCaps": [],
"autoAlign": false,
"continueThemeAcrossLines": false
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Codex实现类似的可以直接修改comfig.toml

[tui]
status_line = [
"model-with-reasoning",
"fast-mode",
"current-dir",
"git-branch",
"context-remaining",
"five-hour-limit",
"weekly-limit",
"codex-version",
]

status_line_use_colors = true

oh-my-claudecode

Claude Code 的多智能体编排系统。选择使用这个不建议再套一层superpowers。

1
2
3
4
5
6
# 安装
/plugin marketplace add https://github.com/Yeachan-Heo/oh-my-claudecode
/plugin install oh-my-claudecode

# 配置
/omc-setup

oh-my-codex

Codex 的多智能体编排系统。选择使用这个不建议再套一层superpowers。

1
2
# 安装
npm install -g oh-my-codex

superpowers

一套行之有效的智能技能框架和软件开发方法论。

1
2
3
4
5
6
# Claude Code安装
/plugin install superpowers@claude-plugins-official

# Codex安装
/plugins
搜索superpowers,然后安装

supabase

提供与 Supabase 协同工作所需的一切。

1
2
# 安装插件
npx plugins add supabase-community/supabase-plugin

webnovel-writer

基于 Claude Code 的长篇网文辅助创作系统,解决 AI 写作中的「遗忘」和「幻觉」问题,支持 200 万字量级 连载创作。

1
2
3
4
5
6
# 安装插件
claude plugin marketplace add lingfengQAQ/webnovel-writer --scope user
claude plugin install webnovel-writer@webnovel-writer-marketplace --scope user

# 安装插件所需Python依赖
python -m pip install -r https://raw.githubusercontent.com/lingfengQAQ/webnovel-writer/HEAD/requirements.txt

MCP

codegraph

预索引代码知识图谱,代码更改时自动同步,更少的令牌,更少的工具调用。

1
2
3
4
5
# 安装
npm i -g @colbymchenry/codegraph

# 给Claude Code/Codex配置
codegraph install

chrome-devtools-mcp

Chrome DevTools 自动化与网页调试。

1
2
3
4
5
6
# Claude Code安装
/plugin marketplace add ChromeDevTools/chrome-devtools-mcp
/plugin install chrome-devtools-mcp@chrome-devtools-plugins

# Codex安装
codex mcp add chrome-devtools -- npx chrome-devtools-mcp@latest

expo

让AI 辅助工具了解 Expo SDK,并使其能够与移动模拟器和 React Native DevTools 进行交互。

1
2
3
4
# Claude Code安装
claude mcp add --transport http expo https://mcp.expo.dev/mcp

# 需要进行认证和本地配置,具体访问mcp地址

XcodeBuildMCP

为在 iOS 和 macOS 项目上进行开发时代理使用的工具提供工具。

1
2
3
brew tap getsentry/xcodebuildmcp
brew install xcodebuildmcp
xcodebuildmcp init

godot-mcp

用于与 Godot 游戏引擎交互的 MCP 服务器。提供启动编辑器、运行项目和捕获调试输出的工具。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 前提:已安装 Godot、Node.js 18+ 和 npm。

# Claude Code安装
claude mcp add godot -- npx @coding-solo/godot-mcp

# Codex安装(修改config.toml)

## Windows Powershell
[mcp_servers.godot]
command = "npx.cmd"
args = ["-y", "@coding-solo/godot-mcp"]

[mcp_servers.godot.env]
GODOT_PATH = 'C:\你的路径\Godot.exe'
DEBUG = "true"

## Macos
[mcp_servers.godot]
command = "npx"
args = ["-y", "@coding-solo/godot-mcp"]

[mcp_servers.godot.env]
GODOT_PATH = "/Applications/Godot.app/Contents/MacOS/Godot"
DEBUG = "true"

mobile-mcp

用于移动自动化和数据抓取的模型上下文协议服务器(iOS、Android、模拟器、仿真器和真机)

1
2
3
4
5
# Claude Code安装
claude mcp add mobile-mcp -- npx -y @mobilenext/mobile-mcp@latest

# Codex 安装
codex mcp add mobile-mcp npx "@mobilenext/mobile-mcp@latest"

Skills

frontend-design

在构建新 UI 或重塑现有 UI 时提供独特、有意的视觉设计指南。

1
npx skills add https://github.com/anthropics/skills --skill frontend-design

ui-ux-pro-max

一个为跨多平台和框架构建专业 UI/UX 提供设计智能的 AI 技能。

1
2
3
4
5
6
7
8
9
全局安装CLI
npm install -g ui-ux-pro-max-cli

# 进入项目后进行安装
uipro init --ai claude
uipro init --ai codex

# 可选:为claude code全局安装
uipro init --ai claude --global

gsap-skills

教导AI编码代理如何正确使用GSAP(GreenSock动画平台),包括最佳实践、常见动画模式和插件使用方法。

1
npx skills add https://github.com/greensock/gsap-skills

emilkowalski/skills

帮助设计师和工程师构建更好的用户界面。包含apple-design/emil-design-eng等

1
npx skills@latest add emilkowalski/skills

technical-documentation

构建和审查高质量的技术文档以及代理说明文件。

1
2
3
4
5
6
7
8
9
10
11
请帮我安装这个 Agent Skill。

Skill 页面:https://skillsmp.com/zh/creators/openclaw/openclaw/agents-skills-technical-documentation
源地址:https://github.com/openclaw/openclaw/tree/main/.agents/skills/technical-documentation
Skill 名称:technical-documentation
作者:openclaw
推荐安装命令:npx skills add https://github.com/openclaw/openclaw --skill technical-documentation

请打开 Skill 页面和源地址,先阅读 SKILL.md 以及所有配套文件,并在安装前说明任何风险。

如果当前环境可以执行 shell 命令,优先使用上面的安装命令。如果需要手动安装,请复制包含 SKILL.md 的完整 skill 目录,包括 scripts、references、assets、agents 以及 Skill 页面展示的其他文件,并保留相对目录结构。不要只安装 SKILL.md。安装完成后,请确认目标 skills 目录里包含 SKILL.md 和这个 skill 需要的全部配套文件。