From e99b5fe4823342de0a79e91ee0e3000be9f33f92 Mon Sep 17 00:00:00 2001 From: Zhang Jiahao Date: Tue, 21 Apr 2026 00:50:16 +0800 Subject: [PATCH] Split tooling notes and pitfalls into @-imported sidecars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 主文件不断累积实测工具细节和踩坑记录让核心准则变难扫读;通过 Claude Code 的 @ 导入语法把这些拆到本地 note.md / debug.md, 主文件只保留指针和纲领, 后续新增工具经验或坑直接往子文件加, 主文件保持稳定。log.md 作为会话索引 由本地 SessionEnd hook 维护, 不跟随仓库同步。 --- CLAUDE.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 7f4177e..1b62173 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -26,12 +26,7 @@ Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-s **Workflow: Locate → Plan → Execute.** Never jump straight to edits. -1. **Locate**: find the relevant files, functions, call sites, and tests. Quote or cite the existing code before proposing changes. If you can't locate it, say so — don't guess. - - For mature/unfamiliar repos, prefer structured scans: - - `repomix -o /tmp/x.xml` (or `repomix `) — full-repo LLM pack; slice by subdir if > 100k tokens - - `eza --tree --git-ignore --level=3 .` for layout (⚠️ path arg required, omitting it silently prints nothing); `fd ` for files; `rg ` for call sites - - `git ls-files` when tokens are tight - - skip `broot` — interactive-only, no value in CLI/pipeline context +1. **Locate**: find the relevant files, functions, call sites, and tests. Quote or cite the existing code before proposing changes. If you can't locate it, say so — don't guess. Tooling details and known pitfalls live in `note.md` / `debug.md` (auto-imported below). 2. **Plan**: state the intended change in one or two sentences. List assumptions and open questions. Give a rough estimate of **token consumption** (reads + writes + tool calls) and **wall-clock time** so the user can redirect early if the scope is off. If uncertain, ask before writing code. 3. **Execute**: make the minimal edit that matches the plan. Deviations require a new plan, not silent improvisation. @@ -77,6 +72,17 @@ For multi-step tasks, state a brief plan: Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification. +## 5. Extended references (auto-imported) + +These files expand into context at session start: + +- Practice notes: @~/.claude/note.md +- Debug pitfalls: @~/.claude/debug.md + +Not auto-imported (read on demand): + +- Session log: `~/.claude/log.md` — appended by SessionEnd hook, grows unboundedly so kept out of context to save tokens + --- **These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.