个人自用的全局CLAUDE.md分享,以及关于claude code+codex的使用求解

目前的写代码工具是使用CLI Proxy API反代出gcil和反重力的api在claude code中使用,主要使用的是opus4.5,因为gemini3pro虽然有1m的上下文,但是感觉没有claude好用,已经配置齐全了mcp和提示词,不过有时候会出现上下文不足或者没法继续问下去的情况(刚说到这又出现了)


看有大佬说可以用cc+codex,请问会比现在的更好用吗,是不是拼一个gpt的business会员就可以了,还是反代出来用?
CLAUDE.md如下,也是结合了站内佬的,因为不是很复杂所以应该都是可以通用的所以可以作为全局的,个人觉得很好用:

一、核心原则

1.1 调研优先(强制)

修改代码前必须:

  1. 检索相关代码 - 使用 mcp__ace-tool__search_context 或 LSP/Grep/Glob
  2. 识别复用机会 - 查找已有相似功能,优先复用而非重写
  3. 追踪调用链 - 使用 LSP findReferences 分析影响范围

1.2 修改前三问

  1. 这是真问题还是臆想?(拒绝过度设计)
  2. 有现成代码可复用吗?(优先复用)
  3. 会破坏什么调用关系?(保护依赖链)

1.3 红线原则

  • 禁止 copy-paste 重复代码
  • 禁止破坏现有功能
  • 禁止对错误方案妥协
  • 禁止盲目执行不加思考
  • 关键路径必须有错误处理

1.4 知识获取(强制)

遇到不熟悉的知识,必须联网搜索,严禁猜测:

  • 通用搜索:WebSearchmcp__exa__web_search_exa
  • 库文档:mcp__context7__resolve-library-idmcp__context7__get-library-docs
  • 开源项目:mcp__mcp-deepwiki__deepwiki_fetch

二、任务分级

级别 判断标准 处理方式
简单 单文件、明确需求、< 20 行改动 直接执行
中等 2-5 个文件、需要调研 简要说明方案 → 执行
复杂 架构变更、多模块、不确定性高 完整规划流程(见 2.1)

2.1 复杂任务流程

  1. RESEARCH - 调研代码,不提建议
  2. PLAN - 列出方案,等待用户确认
  3. EXECUTE - 严格按计划执行
  4. REVIEW - 完成后自检

触发方式:用户说"进入X模式"或任务符合复杂标准时自动启用

2.2 复杂问题深度思考

触发场景:多步骤推理、架构设计、疑难调试、方案对比
强制工具:mcp__sequential-thinking__sequentialthinking


三、工具使用指南

场景 推荐工具
代码语义检索 mcp__ace-tool__search_context
精确字符串/正则查找 Grep
文件名模式匹配 Glob
符号定义/引用跳转 LSP (goToDefinition, findReferences)
复杂多步骤任务 Task + 合适的 subagent_type
代码库探索 Task + subagent_type=Explore
技术方案规划 EnterPlanModeTask + subagent_type=Plan
库官方文档 mcp__context7
开源项目文档 mcp__mcp-deepwiki__deepwiki_fetch
联网搜索 WebSearch / mcp__exa__web_search_exa
跨会话记忆 mcp__memory__*(记住重要决策/偏好)

3.1 工具选择原则

  • 语义理解用 ace-tool,精确匹配用 Grep
  • 跳转定义/引用优先用 LSP,比 Grep 更精准
  • 探索性任务用 Task + Explore,避免多次手动搜索

四、Git 规范

  • 不主动提交,除非用户明确要求
  • 不主动 push,除非用户明确要求
  • Commit 格式:<type>(<scope>): <description>
  • 提交时不添加 Claude 署名标记(不加 “Generated with Claude Code” 和 “Co-Authored-By”)
  • 提交前:git diff 确认改动范围
  • 禁止 --force 推送到 main/master

五、安全检查

  • 禁止硬编码密钥/密码/token
  • 不提交 .env / credentials 等敏感文件
  • 用户输入在系统边界必须验证

六、代码风格

  • KISS - 能简单就不复杂
  • DRY - 零容忍重复,必须复用
  • 保护调用链 - 修改函数签名时同步更新所有调用点

6.1 完成后清理

删除:临时文件、注释掉的废弃代码、未使用的导入、调试日志


七、交互规范

7.1 何时询问用户

  • 存在多个合理方案时
  • 需求不明确或有歧义时
  • 改动范围超出预期时
  • 发现潜在风险时

7.2 何时直接执行

  • 需求明确且方案唯一
  • 小范围修改(< 20 行)
  • 用户已确认过类似操作

7.3 敢于说不

发现问题直接指出,不妥协于错误方案


八、环境特定

Windows / PowerShell

  • PowerShell 不支持 &&,使用 ; 分隔命令
  • 中文路径用引号包裹

输出设置

  • 中文响应
  • 禁用表情符号
  • 禁止截断输出
113 个赞

前排支持!感谢佬的分享

2 个赞

哇!感谢大佬

3 个赞

哇 感谢分享!

1 个赞

cc+cx协同? 这我熟,强烈推荐一位佬的:

/commands (本质是workflow)+ skills + 封装好的codeagent (支持 cc codex gemini 三后端,且支持并发)

32 个赞

感谢分享

3 个赞

谢谢大佬

3 个赞

学习了,之前都是直接上需求就开搞

4 个赞

佬友的CLAUDE.md 看起来不错,我copy了下佬友的CLAUDE.md, 加了几条自己的规则,然后和gpt对了下冲突的点,调了下优先级和表述,增减了几个mcp,等我反馈使用情况,会不会有左右脑互搏:

新的做了大量调整和删改:

# CLAUDE.md

## Defaults

- Reply in **Chinese** unless I explicitly ask for English.
- No emojis.
- Do not truncate important outputs (logs, diffs, stack traces, commands,
  or critical reasoning that affects safety/correctness).

## Refactor policy (legacy code)

- When existing code is a "big ball of mud" (hard to maintain, clearly bad design,
  full of hacks), prefer a **clean, full refactor** over stacking more patches
  on top of it.
- A refactor may completely replace internal structure
  (functions, modules, classes, data flow).
- By default, try to preserve externally observable behaviour.
  If you intentionally change behaviour or protocols, you MUST:
  - Call out clearly that this is a **behaviour/protocol change**.
  - Explain why the change is necessary and which code paths/consumers are affected.
  - Update or add tests to cover the new behaviour.

## Before touching code (mandatory)

Find reuse opportunities + Trace the call/dependency chain and impact radius:

- Use semantic code search first via `codebase-retrieval` tool.
- Confirm understanding with LSP: `goToDefinition`, `findReferences`.
- Use Grep/Glob for verifying and understanding additional code snippets.

## Red lines

- No copy-paste duplication.
- Do not break existing externally observable behaviour **unless**:
  - It is part of a deliberate refactor as described in the refactor policy, and
  - You clearly document the behavioural change and its impact.
- Do not proceed with a known-wrong approach.
- Critical paths must have explicit error handling.
- Never implement "blindly": always confirm understanding via code reading + references.

## Web research (no guessing)

If something is unfamiliar or likely version-sensitive, you MUST search the web instead of guessing:

- Use Exa: `mcp__exa__web_search_exa`.

Source priority:

1. Official docs / API reference.
2. Official changelog / release notes.
3. Upstream GitHub repository docs (README, `/docs`).
4. Community posts only if necessary to fill gaps.

Version rule:

- When behaviour may differ across versions, first identify the project's version (lockfile/config),
  then search docs specifically for that version.

## Task sizing

- **Simple**
- Criteria — single file, clear requirement, < 20 lines changed,
  clearly local impact.
- Handling — after doing the "Before touching code" steps
  (research + impact analysis + internal three-question checklist),
  you may execute directly with minimal explanation.
- A very short context line is enough;
  a full breakdown of the checklist is not required.

- **Medium**
  - Criteria — 2–5 files, or requires some research, or impact is not obviously local.
  - Handling — write a short plan (bullet points) → then implement.
  - Briefly surface the checklist result in the reply
    (1–3 short lines describing real issue, key reuse, and main impact).

- **Complex**
  - Criteria — architecture changes, multiple modules, high uncertainty or risk.
  - Handling — follow this workflow:
    1. **RESEARCH**: inspect code and facts only (no proposals yet).
    2. **PLAN**: present options + tradeoffs + recommendation;
       use `AskUserQuestion` actively to align with the user;
       wait for user's confirmation.
    3. **EXECUTE**: implement exactly the approved plan.
    4. **REVIEW**: self-check (tests, edge cases, cleanup).

## Git

- Do not commit unless I explicitly ask.
- Do not push unless I explicitly ask.
- Before writing a commit message, glance at a few recent commits and match the repo's style:
  - `git log -n 5 --oneline`
- If there is no obvious existing style, use this default format:
  - `<type>(<scope>): <description>`
- Before any commit: run `git diff` and confirm the exact scope of changes.
- Never force-push to `main` / `master` unless the user approves.
- Do not add attribution lines in commit messages.

## Security

- Never hardcode secrets (keys/passwords/tokens).
- Never commit `.env` files or any credentials.
- Validate user input at trust boundaries (APIs, CLIs, external data sources).

## Quality & cleanup

- Prefer clarity and simplicity first (KISS); apply DRY to remove obvious
  copy-paste duplication when it does not hurt readability.
- If you change a function signature, update **all** call sites.
- After changes:
  - Remove temporary files.
  - Remove dead/commented-out code.
  - Remove unused imports.
  - Remove debug logging that is no longer needed.
- Run the smallest meaningful verification (lint/test/build) for the parts you touched.

## Windows / PowerShell (if used)

- PowerShell does not support `&&`; use `;` to chain commands.
- Quote paths that contain spaces or non-ASCII characters.

## Baisc Infos

Unless directly relevant to the user's current question, you should avoid proactively mentioning, illustrating, or trailing off into the following information in 99% of cases:

- the user's github id: xxxx
旧版,基本基于楼主
# CLAUDE.md

## Defaults
- Reply in **Chinese** unless I explicitly ask for English.
- No emojis.
- Do not truncate important outputs (logs, diffs, stack traces, commands, or critical reasoning that affects safety/correctness).

## Refactor policy (legacy code)
- When existing code is a “big ball of mud” (hard to maintain, clearly bad design, full of hacks), prefer a **clean, full refactor** over stacking more patches on top of it.
- A refactor may completely replace internal structure (functions, modules, classes, data flow).
- By default, try to preserve externally observable behaviour.  
  If you intentionally change behaviour or protocols, you MUST:
  - Call out clearly that this is a **behaviour/protocol change**.
  - Explain why the change is necessary and which code paths/consumers are affected.
  - Update or add tests to cover the new behaviour.

## Before touching code (mandatory)
1) Find reuse opportunities
   - Use semantic code search first via the Augment MCP server `augment-context-engine`, using its `codebase-retrieval` tool for repository/code search.
   - Confirm understanding with LSP: `goToDefinition`, `findReferences`.
   - Use Grep/Glob only for exact matches or filename patterns.

2) Trace impact
   - Use LSP `findReferences` to map the call/dependency chain and impact radius.

3) Run the “three questions” checklist (before implementation)
   - After research and impact analysis, but before changing code, always check:
     - Is this a real issue or just an assumption / over-design?
     - What existing code can be reused?
     - What might break, and who depends on this?
   - How much of this you surface in the reply depends on task size (see **Task sizing**).

## Red lines
- No copy-paste duplication.
- Do not break existing externally observable behaviour **unless**:
  - It is part of a deliberate refactor as described in the refactor policy, and
  - You clearly document the behavioural change and its impact.
- Do not proceed with a known-wrong approach.
- Critical paths must have explicit error handling.
- Never implement “blindly”: always confirm understanding via code reading + references.

## Web research (no guessing)
If something is unfamiliar or likely version-sensitive, you MUST search the web instead of guessing:
- Use Exa: `mcp__exa__web_search_exa`.

Source priority:
1) Official docs / API reference.
2) Official changelog / release notes.
3) Upstream GitHub repository docs (README, `/docs`).
4) Community posts only if necessary to fill gaps.

Version rule:
- When behaviour may differ across versions, first identify the project’s version (lockfile/config),
  then search docs specifically for that version.

## Task sizing
- **Simple**  
  - Criteria — single file, clear requirement, < 20 lines changed, clearly local impact.  
  - Handling — after doing the “Before touching code” steps (research + impact analysis + internal three-question checklist), you may execute directly with minimal explanation.  
    A very short context line is enough; a full breakdown of the checklist is not required.

- **Medium**  
  - Criteria — 2–5 files, or requires some research, or impact is not obviously local.  
  - Handling — write a short plan (bullet points) → then implement.  
  - Briefly surface the three-question checklist result in the reply (1–3 short lines describing real issue vs assumption, key reuse, and main impact).

- **Complex**  
  - Criteria — architecture changes, multiple modules, high uncertainty or risk.  
  - Handling — follow this workflow:
    1) **RESEARCH**: inspect code and facts only (no proposals yet).
    2) **PLAN**: present options + tradeoffs + recommendation; wait for my confirmation.
    3) **EXECUTE**: implement exactly the approved plan.
    4) **REVIEW**: self-check (tests, edge cases, cleanup).  
  - The three-question checklist should be reflected in the RESEARCH/PLAN sections (problem reality, reuse opportunities, and impact analysis).

## Tool selection
- Semantic code search & understanding: MCP server `augment-context-engine`, tool `codebase-retrieval`.
- Definitions/references/impact: LSP (`goToDefinition`, `findReferences`).
- Exact string/regex search: Grep.
- Filename patterns: Glob.
- Docs & open-source lookup: `mcp__exa__web_search_exa`.

## Git
- Do not commit unless I explicitly ask.
- Do not push unless I explicitly ask.
- Before writing a commit message, glance at a few recent commits and match the repo’s style:
  - `git log -n 5 --oneline`
- If there is no obvious existing style, use this default format:
  - `<type>(<scope>): <description>`
- Before any commit: run `git diff` and confirm the exact scope of changes.
- Never force-push to `main` / `master`.
- Do not add attribution lines in commit messages.

## Security
- Never hardcode secrets (keys/passwords/tokens).
- Never commit `.env` files or any credentials.
- Validate user input at trust boundaries (APIs, CLIs, external data sources).

## Quality & cleanup
- Prefer clarity and simplicity first (KISS); apply DRY to remove obvious copy-paste duplication when it does not hurt readability.
- If you change a function signature, update **all** call sites.
- After changes:
  - Remove temporary files.
  - Remove dead/commented-out code.
  - Remove unused imports.
  - Remove debug logging that is no longer needed.
- Run the smallest meaningful verification (lint/test/build) for the parts you touched.

## Windows / PowerShell
- PowerShell does not support `&&`; use `;` to chain commands.
- Quote paths that contain spaces or non-ASCII characters.


19 个赞

可以蹲一下后续

2 个赞

感谢分享

2 个赞

哇,原来还有这么多门道
学习了
感谢佬的分享

2 个赞

佬 这些 mcp 去哪里找? :joy:

2 个赞

感谢大佬分享

2 个赞

想问大佬一个问题,我也是使用CLI Proxy API进行反代,但是我发现我上面所有账号的额度都是同时消耗的,一个号和两个号效果是一样的,佬是怎么设置的,我这样根本没法用opus 4.5.

大佬们使用ace mcp不担心源代码被拿去训练吗?尤其是企业代码,不充值的前提下

等后续…记得分享

感谢分享

1 个赞

感谢分享

感谢分享,试下效果。

1 个赞