/anchor:init-claude-md [可选:项目一句话描述] 或 --template=<web-app|library|cli-tool|data-pipeline|default>from anchor
在当前工作目录创建 CLAUDE.md 骨架(项目无 CLAUDE.md 时用)。Use when entering a new project that has no project-level CLAUDE.md / AGENTS.md.
Ships in anchor. Installing the plugin adds it to Claude Code.
在当前工作目录(不是 ~/.claude/)创建一个项目 CLAUDE.md 骨架。
检查是否已存在:
./CLAUDE.md 已存在 → 报告位置 + 现有章节列表,问用户是否要"补齐缺失章节",不要覆盖已有内容判断项目类型 + 选 template:
$ARGUMENTS 含 --template=X → 用指定 templatepackage.json + Express/Django/Flask/Rails route 文件 → web-apppyproject.toml/Cargo.toml/package.json 但没入口 server → librarybin/ 或 cmd/main.go 或 cli framework imports → cli-tooldags/ / dbt/ / Airflow/Dagster imports → data-pipelinedefault~/.claude/skills/anchor/references/templates/:
web-app.md — Express/Django/Flask/Rails/NextJS/FastAPI 类library.md — npm/pip/cargo 发布的 librarycli-tool.md — Go/Rust/Python CLI 工具data-pipeline.md — Airflow/Dagster/dbt ETLdefault.md — 通用骨架快速侦察项目:用 1 条命令同时跑(不要等结果再说话):
ls -la 看顶层结构grep -l "main\|app\|server\|entry" 之类)git log --oneline -10 看最近活动(如果是 git repo)写 ./CLAUDE.md,复制 template 内容 + 基于侦察填实际值(不要照搬 <placeholders>):
# <项目名>
<一句话描述:$ARGUMENTS 或基于侦察推断>
## 架构概览
<2-4 句话:技术栈、主要模块、对外接口形态>
## 关键路径
<3-5 行:入口在哪、core 逻辑在哪、配置在哪>
## Conventions
<按侦察到的语言列项目实际遵循的约定。读邻近文件归纳出来,不要写"应该用 X"——只写"这个项目用 X"。>
- 命名:<驼峰/下划线/横线?前缀?>
- import 顺序:<标准库/第三方/本地的顺序?分组?>
- 错误处理:<抛异常/返回 Result/log 形式?>
- logger:<用什么 logger 函数?>
- 测试位置:<__tests__ / tests/ / _test.go 同目录?>
(没读出来的项**不要瞎填**——留 TODO 或省略)
## Testing
<怎么跑 unit / integration / e2e?>
```bash
# unit
<command>
# integration
<command>
<新成员/Claude 进来要做什么环境准备?依赖、env 文件、本地服务?>
<本节用 /pit 在每次修完非平凡 bug 后追加。3-5 行/条:现象 + 根因 + 修复 + 教训。>
(空——按"6 个月后看到值得感谢现在的自己"标准追加)
5. **写完报告**:
- 创建路径
- 用了哪个 template(`web-app` / `library` / `cli-tool` / `data-pipeline` / `default`)
- 哪些章节内容是基于侦察填的("侦察填实")
- 哪些章节内容是骨架占位需要用户/未来追加("待补")
- 提示:以后修非平凡 bug 用 `/pit` 追加到"踩坑记录"
### 不做
- 不覆盖已存在的 `./CLAUDE.md`
- 不基于猜测填具体技术细节(侦察不出来就留空,不要造)
- 不写超过 150 行的 CLAUDE.md 骨架——CLAUDE.md 是项目契约,不是文档汇编
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub biefan/anchor --plugin anchor23 commands in this plugin
/cleanup1. 拿改动文件清单扫本会话改动的文件,找 dead code / debug print / 未用 import / 过期 TODO 等收尾杂物。Use right before /done or /ship to ship clean code./decide/decide — architectural decision record (ADR)ADR-style 架构决策记录 — 写到 ~/.anchor/memory/decisions/<project>/。Use when you make a non-trivial design / tech / process decision worth remembering./diff1. 决定 diff 范围分析 git diff 的风险面 —— 改动规模、命中敏感关键词、可能引入的回归类别。Use before /done or before committing to spot trouble early./done1. 检查 task list一键收尾——按 ec skill 的"完成清单"系统化跑完所有 done-gates,不要再含糊说"应该可以了"/ec/ec — alias for /anchorBackward-compat alias for /anchor (formerly the primary skill trigger before v1.5.0)./lean/lean — toggle lean mode (token-savings)切换 anchor "lean mode" — hooks 减少 SessionStart 注入 / PostToolUse 输出 / 节省 token。Use when sessions are short, when you want minimal context tax, or for cost optimization.