From anchor
Apply when writing or modifying code — implementing a feature, fixing a bug, refactoring, or any non-trivial multi-step code edit. Enforces intent clarity, task-scope locking via TaskCreate, project-CLAUDE.md compliance, smallest-correct-diff edits, aggressive parallel sub-agents, end-to-end self-verification, multi-pass vulnerability scanning, condition-based Codex review, writing lessons learned back to project CLAUDE.md, anti-drift discipline on long tasks, and optional autonomous mode (don't stop until the task list is fully completed). TRIGGER when the user asks to implement / add / build / fix / debug / refactor / change / optimize anything in code, or hands over a coding task that touches one or more files. Also TRIGGER for security audits, vulnerability scans, and pre-merge verification. SKIP for pure explanation, documentation writing, one-line typo fixes, and brainstorming without code changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/anchor:anchorThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
写代码的最大成本不是打字,而是**返工 + 重复踩坑 + 串行思考 + 中途偏题 + 长任务记忆衰减**。这个 skill 把对策压成 **8 条核心规则** + 一系列 references 详细参考。
references/autonomous-mode.mdreferences/codex-review-when.mdreferences/coding-discipline.mdreferences/debugging-and-risks.mdreferences/e2e-validation.mdreferences/intent-and-recon.mdreferences/multi-agent-recipes.mdreferences/multi-cli-adapters.mdreferences/pitfall-template.mdreferences/templates/cli-tool.mdreferences/templates/data-pipeline.mdreferences/templates/default.mdreferences/templates/library.mdreferences/templates/web-app.mdreferences/vuln-checklist.mdscripts/_log_event.shscripts/_runtime.shscripts/analyze-events.pyscripts/auto-save.shscripts/ec-status.sh写代码的最大成本不是打字,而是返工 + 重复踩坑 + 串行思考 + 中途偏题 + 长任务记忆衰减。这个 skill 把对策压成 8 条核心规则 + 一系列 references 详细参考。
pwdfor f in CLAUDE.md AGENTS.md .cursor/rules .github/instructions.md; do [ -f "$f" ] && echo " ✓ $f ($(wc -l < "$f") lines)"; done; [ -z "$(ls CLAUDE.md AGENTS.md 2>/dev/null)" ] && echo " (none — fall back to reading neighbor files for de-facto conventions)"git rev-parse --git-dir >/dev/null 2>&1 && echo " branch: $(git branch --show-current 2>/dev/null), $(git status --short 2>/dev/null | wc -l | tr -d ' ') changed files" || echo " (not a git repo)"[ -f ~/.claude/.efficient-coding-autonomous ] && echo " ✅ ENABLED — Stop hook will block stop while task list has incomplete items" || echo " ⬜ disabled (toggle: touch ~/.claude/.efficient-coding-autonomous)"如果上面显示项目有 CLAUDE.md / AGENTS.md,开任何动作前先读它。 它是项目宪法。
references/intent-and-recon.md。TaskCreate;Codex: plan tool)。开干前把用户原话当第一条 task 锚住,所有动作只服务 task list 上的项。CLAUDE.md / AGENTS.md 是项目宪法。项目契约 > 用户全局规则 > 本 skill。references/coding-discipline.md。references/multi-agent-recipes.md。references/codex-review-when.md。CLAUDE.md(自动 sync 到 ~/.anchor/memory/pitfalls/,跨项目可 /recall)。否则下次再踩。模板见 references/pitfall-template.md。/recall。SessionStart 注入的"Memory index"列出本项目过去 /pit /decide /remember 写过的 topics — 用户提及 matching topic 时,先 /recall <topic> 拉过去经验再答,不要凭空。额外操作清单:
references/e2e-validation.mdreferences/debugging-and-risks.mdreferences/vuln-checklist.md长任务(>10 步、>30 分钟、跨多个子目标)的两个常见死法:中途偏题 和 skill 被 auto-compact 截掉。
锁 scope:第一件事用任务列表工具建 task,第一条抄用户原话作锚点。拆 3-7 个子 task,每个写可验证的产出。
偏题刹车:每完成一个 task → 标 completed → 看下一步 → 如果当前想做的事不在 list 上 → 停。要么加成新 task,要么放弃。
常见偏题信号:
长任务记忆维护:跑了 >30 turn / >1h → 主动 /ec re-invoke;感觉"我在做的事是不是偏了"→ 回头对照核心八条;用 /save <label> 或 /snapshot <label> 做存档;隔天 /resume-task <label> 续接。
复盘节点:每完成主要阶段(调研完 / 改动完 / 验证完)主动汇报,不要堆到最后。/recap 命令一键复盘。
仅在 ~/.claude/.efficient-coding-autonomous 文件存在时启用。详细协议见 references/autonomous-mode.md。
启用后:
观察 → 假设 → 验证 排查,穷尽 3 轮假设仍无进展才停下报告/save 自动 fallback:PreCompact + Stop hook 自动 save 到 ~/.anchor/saved-tasks/auto-*.md合理停下报告的场景:3 轮假设全证伪 / 需要外部凭证/信息 / 岔路口需要用户决策 / 涉及高代价动作。
用户随时关掉:rm ~/.claude/.efficient-coding-autonomous。
--no-verify" → 永远不要npm install / pip install 装不上,报告 blocker 并停下:"我没法在这环境装依赖(具体原因),需要你在本地执行 <命令> 再让我接着跑。" 借别处依赖跑出来的"测试通过"基于借来的环境,下一个干净 clone 的人复现不出来/ec不要堆"我做了 A、B、C"总结——用户看得到 diff。一两句话说变了什么 / 下一步就够。
完成清单按序:
references/e2e-validation.md)references/vuln-checklist.md)references/codex-review-when.md)CLAUDE.md(如适用,见 references/pitfall-template.md)completed持久化笔记写进 commit message / PR description / CLAUDE.md——不进代码注释。
| 阶段 | 命令 |
|---|---|
| 开始任务 | /lock / /init-claude-md / /ec |
| 干活中 | /next / /recap / /status / /diff |
| 长任务跨 session | /save / /resume-task / /milestone / /snapshot |
| 跨项目记忆 | /pit / /decide / /remember / /recall |
| 收尾 / 安全 | /scan / /cleanup / /done / /ship |
| 复盘 / 成本 | /spend / /report / /lean |
| 文件 | 用途 |
|---|---|
references/intent-and-recon.md | 意图清晰 + 60 秒定位(规则 #1 详解) |
references/coding-discipline.md | 动手时的纪律(规则 #4 详解) |
references/e2e-validation.md | E2E + 二阶自检 + 完成清单 |
references/codex-review-when.md | 何时调 codex review(规则 #6 详解) |
references/debugging-and-risks.md | 卡住的协议 + 高代价动作清单 |
references/pitfall-template.md | 踩坑记录模板 + 多类型示例 |
references/vuln-checklist.md | 漏洞 grep 命令 + SAST 工具 + coverage checklist |
references/multi-agent-recipes.md | 多 agent 并行实战 prompt 模板 |
references/autonomous-mode.md | 自治模式完整协议 |
references/multi-cli-adapters.md | Codex / Cursor / Cline / Aider 跨 CLI 适配 |
npx claudepluginhub biefan/anchor --plugin anchorProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.