ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 josippapez

dev-core

Claude Code 的日常預設:儲存庫依據、永遠啟用的工程規則、核心技能與專門 agents。

josippapez@josippapez

josippapez/ai-setup/tree/main/claude/plugins/dev-core

已翻譯

關於這個 mod

dev-core

Claude Code 的日常預設:儲存庫依據、永遠啟用的工程規則、核心技能與專門 agents。這是 OpenCode `interactive-mcp⟧ 自訂外掛的 Claude 相容鏡像,保留舊名稱。

儲存庫依據來自獨立的 repo-docs⟧ 外掛:find_docs⟧、list_docs⟧、read_doc⟧、find_libs⟧、get_blast_radius⟧、get_file_dependents⟧ 位於 claude/plugins/repo-docs⟧,與 orchestrate⟧ 共用 MCP server 和 mcp__plugin_repo-docs_repo-docs__*⟧ 命名空間。claude/install.sh⟧ 會自動安裝它;工具無法呼叫時執行 claude plugin install repo-docs@ai-setup⟧,詳見 claude/plugins/repo-docs/README.md⟧。.mcp.json⟧ 也註冊 interactive⟧(@rawwee/interactive-mcp⟧;--disable-tools message_complete_notification,intensive_chat⟧ 只留下 request_user_input⟧)、context7⟧、chrome-devtools⟧ 與 computer-use⟧。computer-use 可控制沒有 API 或 DOM 的原生介面、作業系統對話框、瀏覽器外殼並查看實際渲染,也能救回卡在遠端除錯對話框的 chrome-devtools 呼叫。專案或密鑰專用 server 放在 ~/.claude.json⟧。

WCAG 查詢是 CLI,不是 MCP。@rawwee/wcag-cli⟧ 由 Bash 呼叫,搭配 accessibility⟧ skill;按需 CLI 在使用前不產生成本,常駐 MCP 則每個工作階段啟動 subprocess。opensrc⟧、rtk⟧ 也採同樣形式。`skills/⟧ 鏡像 OpenCode skills。

規則分成三層:永遠啟用的核心、逐提示摘要、工具觸發卡片。rules/⟧ 包含 evidence-first⟧、external-facts⟧、proactive-execution⟧。hooks/link-rules.cjs⟧ 在 SessionStart⟧ 逐檔刷新 rules/*.md⟧,讓 ~/.claude/rules/dev-core⟧ 指向 ${CLAUDE_PLUGIN_DATA}/rules/⟧。Claude Code 會在啟動時原生載入,主 agent 與所有 subagent 都會在 /context⟧ 的 Memory files 看到它,壓縮後也會重新載入。

規則在 SessionStart 鉤子前載入,因此發布連結的工作階段沒有原生副本,之後產生的 subagent 也沒有。該工作階段會在 SessionStart⟧ 與 SubagentStart⟧ 以分片上下文發布規則,受 10,000 字元上限限制,並以 first-session⟧ 和 session_id⟧ 為鍵。claude plugin disable⟧ 不會執行停用外掛,所以也會掃描 ~/.claude/rules/⟧ 到 ~/.claude/plugins/data/*/rules⟧ 的連結;claude plugin list --json⟧(0.3 s)顯示停用或不在列表時就移除。rules-index⟧ 保留完全相同的副本;使用者自己的 ~/.claude/rules/dev-core⟧ 目錄則保留。

hooks.json⟧ 為每個事件註冊 3 個分片槽位(使用 2 個),取代 hooks/inject-rules.cjs⟧。rules-digest.md⟧ 是第二層,由 hooks/inject-rules-digest.cjs⟧ 在每次 UserPromptSubmit⟧ 發出約 250-token 摘要。核心約 2.5k token,摘要只指向既有副本;concise-output⟧ 因此會讓工作階段顯示兩個 `[rules-reminder]⟧ 區塊。

rule-cards/⟧ 是第三層。hooks/rule-cards.ts⟧ 將特定工具的指導附在結果上,觸發器位於 rule-cards/triggers.json⟧,由 rule-cards/triggers.test.cjs⟧ 檢查。它取代每次符合呼叫都啟動 Node 的 PreToolUse⟧ 鉤子(每張卡 0.05 到 0.06 s,帶 git mv⟧ 防護的 Bash 呼叫會觸發 5 張卡)。核心在回合 0 到達,回合 40 時已離工作很遠;卡片則緊鄰動作。

| 卡片 | 觸發條件 | 何時略過 | | --- | --- | --- | | writing-code⟧ — 簡潔、手術式範圍、根因、審查者檢查項 | Edit⟧/Write⟧/NotebookEdit⟧、Bash 的 sed -i⟧、tee⟧ 或檔案重新導向 | — | | reading-libraries⟧ — 先用 opensrc⟧ | 觸及 node_modules/⟧ 的工具呼叫或 Bash | 只出現在 -not -path⟧、--exclude-dir⟧、-g '!node_modules'⟧、-prune⟧ 排除條件中 | | git-commit⟧ — 落地前必須滿足的事項 | Bash 的 `git commit⟧ | — |

命名路徑不等於處理路徑。稽核中 find . -type f -not -path "./node_modules/*"⟧ 曾觸發 opensrc 卡片;skip⟧ 正規表示式會壓下它。誤略過沒有代價,誤觸發每 2 分鐘消耗上下文,因此 skip 優先。每張卡都必須同時有 Bash 與工具名稱觸發器。在 fixture repo 的 5 個提示中,39 次呼叫沒有使用 Edit⟧、Write⟧、Read⟧、Grep⟧、Glob⟧;所有讀寫搜尋移動都透過 cat -n⟧、cat >> f <<EOF⟧、sed -i⟧、grep -rn⟧、find⟧、`mv⟧。只比對工具名稱時觸發 1 張卡,加上 Bash 模式後同次執行觸發 4 張卡。

卡片按 agent 去抖,每張卡最多每 2 分鐘出現一次。原始基準中 8 次注入只有 4 份不同內容,共 14,240 字元,其中一半是重複文字。可宣告 requires: <path>⟧;cwd 下沒有路徑就略過。去抖狀態保存在 mod 的 memory 中,/reload-plugins⟧ 會重新啟動卡片。成本從 30.5 KB(約 7.6k token)降到 9.9 KB(約 2.5k token),卡片總計 6.9 KB,只傳送匹配項。

git mv⟧ 是強制執行,不是建議。hooks/mv-guard.ts⟧ 作為 Bash 的 tool.call⟧ 鉤子,普通 mv⟧ 若來源由 git 追蹤就拒絕並提示 git mv⟧。命令依未加引號的 &&⟧、||⟧、;⟧、|⟧ 與換行拆分;雙參數 mv⟧、短參數和 cwd 工作樹內由 git 追蹤的來源會被拒絕,其餘照常執行。第一次嘗試是 mv src/utils.js src/helpers.js && sed -i '' ... && echo ...⟧;驗證後用 git mv⟧ 得到 R100 src/utils.js -> src/helpers.js⟧。git add -A⟧ 加上 git 重新命名偵測有時能挽救普通 `mv⟧,但 guard 不依賴相似度。

測試

node --test claude/plugins/dev-core/hooks/*.test.cjs

Mod

hooks/screenshots.tsx⟧ 會把 chrome-devtools 的 take_screenshot⟧ 結果畫成終端機記錄中的圖片(僅 PNG,可內嵌或儲存)。JPEG/WebP 與其他介面維持預設列。

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add josippapez/ai-setup
claude plugin install dev-core
原文 / README

dev-core

Everyday defaults for Claude Code: repo grounding, the always-on engineering rules, core skills, and the specialist agents. Claude-compatible mirror of the OpenCode interactive-mcp custom plugin, which keeps the older name.

  • Repo grounding comes from the separate repo-docs plugin, not from this one. find_docs/list_docs/read_doc/find_libs/get_blast_radius/get_file_dependents live in claude/plugins/repo-docs, shared with orchestrate so both use one MCP server and one tool namespace (mcp__plugin_repo-docs_repo-docs__*) instead of each bundling an identical copy. claude/install.sh installs repo-docs automatically alongside this plugin; if its tools are not callable, tell the user to run claude plugin install repo-docs@ai-setup. See claude/plugins/repo-docs/README.md.

  • .mcp.json registers interactive (@rawwee/interactive-mcp, a question tool subagents can reach since Claude Code withholds AskUserQuestion from them; --disable-tools message_complete_notification,intensive_chat leaves only request_user_input, since the main agent is told to use AskUserQuestion and nothing here uses intensive chat, so the other tools were roster weight nobody could call), plus bundled third-party MCP servers that should be available by default in every project: context7 (@upstash/context7-mcp), chrome-devtools (chrome-devtools-mcp) and computer-use (computer-use-mcp, mouse/keyboard/screenshot control of the real desktop for anything with no API and no DOM behind it: native app UI, OS dialogs, browser chrome outside the page, and seeing what actually rendered; it also rescues a chrome-devtools call stuck on the native remote-debugging dialog, which no timeout cuts short). Documented by the computer-use skill. These ship enabled with the plugin so they need no per-machine MCP config. Project- or secret-specific servers (e.g. Figma, a local Storybook endpoint) are intentionally kept out of the plugin and live at user scope in ~/.claude.json.

  • WCAG lookups are a CLI, not an MCP. Accessibility criteria/techniques/failures come from @rawwee/wcag-cli, invoked over Bash and documented by the bundled accessibility skill. A skill + on-demand CLI costs nothing until used, whereas an always-registered MCP spawns a subprocess every session — the same pattern as opensrc and rtk. Prefer this shape for any stateless reference lookup; keep an MCP only where the server holds real state (a warm index, a browser session), as repo-docs and chrome-devtools do.

  • skills/ mirrors the OpenCode skills.

  • Rules come in three layers: an always-on kernel, a per-prompt digest, and tool-triggered cards. Claude Code has no native plugin "rules" loader and nothing a plugin ships reaches the system prompt except an output style, so a hook publishes the kernel as user-scope rules and the other two layers arrive as hook-injected additionalContext.

    rules/ is the kernel: evidence-first, external-facts, proactive-execution. Only what applies to every turn regardless of which tool runs. hooks/link-rules.cjs runs on SessionStart, refreshes every rules/*.md in the plugin's data dir file by file through a rename (emptying the directory first made a concurrently starting session report every rule missing) (${CLAUDE_PLUGIN_DATA}/rules/) and points ~/.claude/rules/dev-core at the copy. From the next launch Claude Code loads them natively: into the main agent and every subagent (measured with a no-tools probe subagent), listed under Memory files in /context, reloaded after compaction. The data dir is the one path Claude Code deletes on uninstall, so the rules leave with the plugin; the dangling link is skipped silently (measured).

    Two gaps, both measured, both closed by the same script. Rules load before SessionStart hooks run, so the session that publishes the link has no native copy and neither do its subagents (measured: a subagent spawned after the link appeared still reported nothing): in that one session the script emits the rules as additionalContext on both SessionStart and SubagentStart, sharded under the 10,000-character cap, keyed on a first-session marker in the data dir that holds the publishing session_id. And claude plugin disable runs nothing of the disabled plugin, so the script also sweeps ~/.claude/rules/ for links into ~/.claude/plugins/data/*/rules whose plugin claude plugin list --json (0.3 s) reports disabled or no longer lists, and removes them; rules-index carries a byte-identical copy so the sweep still runs when dev-core itself is the one disabled. If the user has their own real directory at ~/.claude/rules/dev-core, it is left alone and the rules keep arriving as context every session.

    hooks.json registers 3 shard slots per event (2 in use). This replaced hooks/inject-rules.cjs, which emitted the kernel as sharded context on every session and every subagent spawn.

    rules-digest.md is the second layer: a ~250-token restatement of the kernel, emitted on every UserPromptSubmit by hooks/inject-rules-digest.cjs. The kernel is ~2.5k tokens and sits in the launch context, so repeating it every prompt is unaffordable and leaving it alone lets its pull fade. The digest carries no rule text of its own; it points at the copy already in context and says the full rules govern where the two differ. concise-output ships the identical script against its own digest, which is why a session shows two [rules-reminder] blocks.

    rule-cards/ is the third layer: guidance that only matters next to a specific tool, delivered by the mod in hooks/rule-cards.ts, which attaches the card to the tool call's result. Its triggers (tools, a fire regex, a skip regex) live in rule-cards/triggers.json, checked by rule-cards/triggers.test.cjs. It replaced a PreToolUse command hook that started a Node process per card on every matching call (0.05 to 0.06 s each, five per Bash call with the git mv guard). The kernel lands at turn 0 and is far from the work by turn 40; a card arrives adjacent to the action instead.

    | Card | Fires on | Skips when | | --- | --- | --- | | writing-code — simplicity, surgical scope, root cause, what a reviewer checks | Edit/Write/NotebookEdit, or a Bash sed -i, tee, or redirect into a file | — | | reading-libraries — opensrc over assumption | any tool call or Bash command touching a node_modules/ path | the path appears only in an exclusion (-not -path, --exclude-dir, -g '!node_modules', -prune) | | git-commit — what has to be true before it lands | a Bash git commit | — |

    Naming a path is not working on it. The skip column came from this plugin's own audit, where find . -type f -not -path "./node_modules/*" fired the opensrc card. The trigger's skip regex suppresses it; a false skip costs nothing, a false fire costs context every two minutes, so the skip pattern wins over the fire pattern.

    Every card has a Bash trigger as well as a tool-name one, and that is not optional. Benchmarked 2026-09-14 over five prompts in a fixture repo: across 39 tool calls the model made zero Edit, Write, Read, Grep, and Glob calls. Every file read, write, search, and move went through Bash (cat -n, cat >> f <<EOF, sed -i, grep -rn, find, mv). With tool-name matchers alone exactly one card fired; with the Bash patterns added, all four fired in the same run.

    Each card is debounced: it reappears at most once every two minutes, per card, per agent. Injected context does not leave the conversation, it only moves further back, so re-injecting on every user prompt just piles up duplicate copies. Measured over the five-prompt bench run under the original per-prompt keying: 8 injections carrying only 4 distinct bodies, 14,240 characters, half of it a repeat of text already in context. A card may declare requires: <path> to skip itself unless that path exists under the session cwd. The debounce is kept in the mod's memory, so /reload-plugins re-arms every card.

    Cost: the always-on bundle went from 30.5 KB (~7.6k tokens) to 9.9 KB (~2.5k tokens), loaded natively at launch for the main agent and each subagent. The cards total 6.9 KB, and only the one matching the tool is ever sent.

  • git mv is enforced, not suggested. hooks/mv-guard.ts is a mod tool.call hook on Bash that denies a plain mv whose source is tracked by git, and names the git mv to run instead. Guidance alone did not hold: the rule is read at session start and forgotten at the moment it matters, and a plain mv plus git add records the move as a delete and an add. It splits the command on unquoted &&, ||, ;, |, and newlines and checks every segment, because the whole-command version never fired once: asked to rename a tracked file, the model wrote mv src/utils.js src/helpers.js && sed -i '' ... && echo ... on the first try. Within a segment it denies only a two-argument mv, optional short flags, source tracked in the git work tree at the session cwd. Globs, multi-source moves, untracked or ignored sources, temp paths, and non-git directories all run untouched, because a false deny costs the user a blocked command.

    Verified live: the model hit the deny, read the reason, and re-ran with git mv, landing the change as R100 src/utils.js -> src/helpers.js. Worth knowing that git add -A plus git's own rename detection often recovers a plain mv anyway — in the control arm it did. The guard makes the rename deterministic rather than dependent on similarity detection.

Tests

node --test claude/plugins/dev-core/hooks/*.test.cjs

Mod

hooks/screenshots.tsx draws a chrome-devtools take_screenshot result as the picture itself in the terminal transcript (PNG only, inline or saved to a file). JPEG/WebP results and other surfaces keep the default row.

更多類似作品