Files
knowledge-base/6 - Zettelkasten/20260308213000 Everything Claude Code 最佳实践.md
Yaojia Wang 232b045e03 vault: align ECC docs with current repo and add orchestration manual
Updated ECC notes to match the current state of affaan-m/everything-claude-code
docs/token-optimization.md and docs/SKILL-PLACEMENT-POLICY.md:

- Drop CLAUDE_AUTOCOMPACT_PCT_OVERRIDE recommendations (now warned against
  upstream — variable can only lower threshold, opposite of intent)
- Add CLAUDE_CODE_SUBAGENT_MODEL=haiku as the new core token-saving setting
- Flag the default `memory` MCP for disablement (no skill/agent/hook references)
- Add Skill Placement Policy section (curated/learned/imported/evolved + provenance)
- Cover missing commands: /checkpoint, /sessions, /security-scan, /claw, /projects

Add new resource: ECC 编排实战手册.md (721 lines). Six orchestration patterns
(dmux+worktree, sequential claude -p, continuous-claude, Ralphinho RFC-DAG,
santa-loop, Task in-process) with real commands, real plan.json structures,
real CLI flags, and explicit "could not verify online" markers for /multi-*
and /feature-dev. All sourced to specific commands/*.md or skills/*.md files.

Cross-link the new manual from 完整指南 and 用法速查.
2026-04-26 12:17:47 +02:00

2.1 KiB
Raw Blame History

created, type, tags, source
created type tags source
2026-03-08 21:30 zettel
zettel
claude-code
best-practices
AI-tools
https://github.com/affaan-m/everything-claude-code

Everything Claude Code 最佳实践

上下文窗口是最稀缺资源

200k 上下文窗口在启用太多 MCP 后可能只剩 70k。三条铁律

  1. MCP < 10 个启用,< 80 个工具活跃 — 用 CLI + skill 替代 MCPgh CLI 替代 GitHub MCP
  2. 关闭 auto compact — 在逻辑断点手动 /compact,避免在关键推理中被截断
  3. CLAUDE.md < 200 行 — 详细规则放 rules/,利用 skill 的渐进式加载

Token 成本路由

90% 任务用 Sonnet只在架构决策和安全分析时用 Opus搜索探索用 Haiku。设置

{ "model": "sonnet", "env": { "MAX_THINKING_TOKENS": "10000", "CLAUDE_CODE_SUBAGENT_MODEL": "haiku" } }

CLAUDE_CODE_SUBAGENT_MODEL=haiku 是省钱新核心 —— 子 agent(通过 Task 工具派发的)跑 Haiku比默认便宜约 80%,文件读取/探索质量基本无损。

⚠️ 不要再设 CLAUDE_AUTOCOMPACT_PCT_OVERRIDE。仓库 docs/token-optimization.md 已警告:该变量在新版 Claude Code 上只能"降低阈值"(让压缩更早触发),与延后压缩的目的相反。改用手动 /compact + strategic-compact skill。

用 mgrep 替代 grep 可减少约 50% token 使用。

记忆持久化

  • 每个 session 结束保存摘要到 .tmp 文件(记录:有效方法、无效尝试、待办事项)
  • 下次 session 提供文件路径作为上下文
  • 动态注入:claude --system-prompt "$(cat ~/.claude/contexts/dev.md)"

并行但有纪律

  • 最小可行并行度 — 不盲目开多终端
  • Git worktree 隔离并行实例
  • /rename 命名每个 chat/fork 分叉非重叠工作
  • 级联方法:新任务右开,从左到右扫描,同时不超过 3-4 个