map-project-monorepo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<EXTREMELY-IMPORTANT> This skill mutates durable project memory across multiple workspace members. Non-negotiable rules: 1. Discover the real workspace shape before writing any member `CLAUDE.md`. 2. Document the actual exported or reachable surface, not raw visibility markers alone. 3. Keep each member file self-contained enough for Claude's lazy-loading model. 4. Preserve root-level project rules and locked architectural decisions unless discovery proves them stale. 5. Do not run this skill proactively; it is explicit-user-only maintenance. </EXTREMELY-IMPORTANT>
<EXTREMELY-IMPORTANT> 此技能会修改多个工作区成员的持久化项目内存。以下规则必须严格遵守: 1. 在写入任何成员的`CLAUDE.md`之前,先探明真实的工作区结构。 2. 记录实际可导出或可访问的内容范围,而非仅依赖原始可见性标记。 3. 确保每个成员文件足够独立,适配Claude的懒加载模型。 4. 保留根级别的项目规则和已锁定的架构决策,除非探测证明它们已过时。 5. 请勿主动运行此技能;它仅用于明确触发的用户维护操作。 </EXTREMELY-IMPORTANT>

Map Project Monorepo

梳理项目单仓库

Inputs

输入

  • $request
    : Optional scope or refresh note such as
    all crates
    ,
    only packages/api-*
    , or
    refresh workspace docs after adding the sql crate
    .
  • $request
    :可选的范围或刷新说明,例如
    all crates
    only packages/api-*
    refresh workspace docs after adding the sql crate

Goal

目标

Refresh the root and per-member
CLAUDE.md
files so each workspace member has accurate, self-contained local guidance and the root stays thin and project-wide.
刷新根目录和各成员的
CLAUDE.md
文件,使每个工作区成员都拥有准确、独立的本地指引,同时根目录文件保持精简且覆盖整个项目。

Step 0: Resolve workspace scope and detect monorepo shape

步骤0:解析工作区范围并检测单仓库结构

Determine:
  • whether the repo is a Cargo workspace or a package monorepo
  • whether the user wants a full refresh or a scoped member refresh
  • which members exist and which already have
    CLAUDE.md
    files
  • which root-level memory files and architectural rules already exist and should be preserved
Load
references/workspace-discovery.md
for:
  • workspace detection order
  • member inventory expectations
  • discovery rules for exported surface, wiring, and dependency mapping
Stop early if:
  • the workspace shape cannot be identified
  • the target member set is too ambiguous to update safely
Success criteria: The workspace shape and refresh scope are explicit before discovery starts.
确定:
  • 仓库是Cargo工作区还是包单仓库
  • 用户需要全量刷新还是指定范围的成员刷新
  • 存在哪些成员,哪些成员已拥有
    CLAUDE.md
    文件
  • 已存在哪些根级别内存文件和架构规则需要保留
加载
references/workspace-discovery.md
以获取:
  • 工作区检测顺序
  • 成员清单要求
  • 导出范围、连接关系和依赖映射的探测规则
若出现以下情况则提前终止:
  • 无法识别工作区结构
  • 目标成员集过于模糊,无法安全更新
成功标准:在开始探测前,明确工作区结构和刷新范围。

Step 1: Discover members, public surface, and wiring

步骤1:探测成员、公开范围和连接关系

For every in-scope member, inventory:
  • actual exported or reachable surface
  • key source files
  • wiring files such as crate roots, package entry points, manifests, barrels, startup hooks, registries, routers, or feature flags
  • inter-member dependencies
  • tests, benchmarks, or runtime entry points
  • real consumer usage patterns when available
Rules:
  • do not equate raw
    pub
    or raw
    export
    counts with the real public surface
  • verify what consumers can actually reach first
  • prefer actual imports, re-exports, and runtime registration points over guesses
  • preserve existing member docs when they are still correct; extend or tighten them instead of regenerating blindly
Load
references/workspace-discovery.md
and complete the relevant discovery steps for the detected monorepo shape.
Success criteria: You have enough concrete inventory to write self-contained member docs without placeholders or false surface claims.
对每个在范围内的成员,统计:
  • 实际可导出或可访问的内容范围
  • 关键源文件
  • 连接文件,如crate根目录、包入口点、清单文件、桶文件、启动钩子、注册表、路由或功能标志
  • 成员间依赖关系
  • 测试、基准测试或运行时入口点
  • 可用的实际消费者使用模式
规则:
  • 不要将原始
    pub
    export
    数量等同于真实的公开范围
  • 先验证消费者实际可访问的内容
  • 优先依赖实际导入、重导出和运行时注册点,而非猜测
  • 若现有成员文档仍准确,则予以保留;仅进行扩展或调整,而非盲目重新生成
加载
references/workspace-discovery.md
,针对检测到的单仓库结构完成相关探测步骤。
成功标准:拥有足够具体的统计信息,可编写无占位符、无虚假范围声明的独立成员文档。

Step 2: Refresh per-member
CLAUDE.md
files

步骤2:刷新各成员的
CLAUDE.md
文件

For each in-scope member, update or create a focused local
CLAUDE.md
that covers:
  • purpose
  • public or exported surface
  • key files
  • dependencies
  • wiring and entry points
  • usage pattern
  • architecture notes
  • testing guidance
Load:
  • references/output-contract.md
    for required sections, size targets, and verification rules
  • references/package-template.md
    for library or package members
  • references/app-template.md
    for apps, binaries, or entrypoint-heavy members
Writing rules:
  • use real workspace examples, not placeholders
  • keep tables and bullets preferred over repetitive prose
  • make each member file self-contained for Claude's lazy-loading behavior
  • document hidden wiring points if a future change would need them to make behavior reachable
Success criteria: Every targeted member has an accurate, self-contained
CLAUDE.md
.
对每个在范围内的成员,更新或创建聚焦本地的
CLAUDE.md
,涵盖:
  • 用途
  • 公开或导出范围
  • 关键文件
  • 依赖关系
  • 连接方式和入口点
  • 使用模式
  • 架构说明
  • 测试指引
加载:
  • references/output-contract.md
    以获取必填章节、篇幅目标和验证规则
  • references/package-template.md
    用于库或包类型成员
  • references/app-template.md
    用于应用、二进制文件或入口点密集型成员
编写规则:
  • 使用真实的工作区示例,而非占位符
  • 优先使用表格和项目符号,避免重复冗长的 prose
  • 确保每个成员文件足够独立,适配Claude的懒加载行为
  • 记录隐藏的连接点,以便未来变更时可通过这些点触达相关行为
成功标准:每个目标成员都拥有准确、独立的
CLAUDE.md
文件。

Step 3: Simplify the root
CLAUDE.md

步骤3:精简根目录
CLAUDE.md
文件

Treat the root file as the project-wide router:
  • keep project-wide rules, locked decisions, testing policy, and workspace layout
  • remove member-specific API tables or file listings from root
  • ensure the root points clearly to member-local docs rather than duplicating them
Rules:
  • preserve root-level architectural constraints and steering decisions
  • do not erase useful human-authored global rules
  • move member detail down instead of letting the root become a second copy of every member file
Load
references/output-contract.md
for the root-file expectations and budget rules.
Success criteria: Root stays thin and project-wide while member detail lives where Claude will lazy-load it.
将根目录文件视为项目级路由:
  • 保留项目级规则、已锁定的决策、测试策略和工作区布局
  • 从根目录中移除成员专属的API表格或文件列表
  • 确保根目录清晰指向成员本地文档,而非重复内容
规则:
  • 保留根级别的架构约束和导向决策
  • 不要删除有用的人工编写全局规则
  • 将成员细节下移到对应文件,避免根目录成为所有成员文件的副本
加载
references/output-contract.md
以获取根目录文件的要求和篇幅规则。
成功标准:根目录保持精简且覆盖项目全局,成员细节存储在Claude会懒加载的位置。

Step 4: Verify coverage, self-containment, and budget

步骤4:验证覆盖范围、独立性和篇幅

Validate the refresh before declaring completion:
  • every in-scope member has a
    CLAUDE.md
  • member docs describe the real reachable surface, not just raw visibility markers
  • wiring and entry points are documented where relevant
  • root no longer duplicates member-local details heavily
  • line budgets remain sane
  • the refreshed docs would let an implementation agent work in a touched member without searching blindly
Load
references/output-contract.md
for verification gates and budget targets.
If verification fails:
  • improve coverage
  • restore missing sections
  • tighten duplicated content
  • correct stale reachability or wiring claims
Success criteria: The workspace memory is compact, member-local, and actually useful to future agents.
在宣布完成前验证刷新效果:
  • 每个在范围内的成员都拥有
    CLAUDE.md
    文件
  • 成员文档描述真实可访问的范围,而非仅原始可见性标记
  • 相关的连接方式和入口点已记录
  • 根目录不再大量重复成员本地细节
  • 篇幅保持合理
  • 刷新后的文档可让执行Agent在受影响成员中工作,无需盲目搜索
加载
references/output-contract.md
以获取验证标准和篇幅目标。
若验证失败:
  • 提升覆盖范围
  • 恢复缺失章节
  • 精简重复内容
  • 修正过时的可访问性或连接关系声明
成功标准:工作区内存紧凑、成员本地化,且对未来Agent真正有用。

Step 5: Report what changed

步骤5:报告变更内容

Summarize:
  • detected workspace shape
  • members refreshed
  • files created or updated
  • coverage or inventory highlights
  • budget status
  • intentionally deferred or out-of-scope members
Do not claim a perfect refresh if the workspace is only partially covered or if the requested scope excluded some members.
Success criteria: The user gets a clear summary of what workspace memory was refreshed and how complete it is.
总结:
  • 检测到的工作区结构
  • 已刷新的成员
  • 创建或更新的文件
  • 覆盖范围或统计亮点
  • 篇幅状态
  • 有意延迟处理或超出范围的成员
若工作区仅部分覆盖或请求范围排除了部分成员,请勿宣称刷新完美完成。
成功标准:用户可清晰了解工作区内存的刷新内容和完成度。

Guardrails

防护规则

  • Do not use this skill proactively; it is explicit-user-only because it mutates durable project memory.
  • Do not add
    context: fork
    ; this workflow writes into the active repository.
  • Do not add
    paths:
    ; this is a generic maintenance skill.
  • Do not overwrite useful root-level project rules without evidence they are stale.
  • Do not keep workspace discovery matrices, template encyclopedias, or quality scorecards inline in
    SKILL.md
    .
  • Do not bloat the root
    CLAUDE.md
    ; push member detail down.
  • Do not mark the refresh complete without verifying self-containment and reachability.
  • 请勿主动使用此技能;由于它会修改持久化项目内存,因此仅允许明确触发的用户使用。
  • 请勿添加
    context: fork
    ;此工作流会写入当前活跃的仓库。
  • 请勿添加
    paths:
    ;这是一个通用的维护技能。
  • 请勿在无证据证明已过时的情况下覆盖有用的根级别项目规则。
  • 请勿在
    SKILL.md
    中嵌入工作区发现矩阵、模板大全或质量评分卡。
  • 请勿让根目录
    CLAUDE.md
    变得臃肿;将成员相关细节下移到对应成员文件中。
  • 在未验证独立性和可访问性之前,请勿标记刷新完成。

When To Load References

何时加载参考文件

  • references/workspace-discovery.md
    Use for workspace detection order, member discovery rules, and exported-surface versus raw-visibility guidance.
  • references/output-contract.md
    Use for required member/root sections, budget rules, and verification gates.
  • references/package-template.md
    Use when refreshing library-style members.
  • references/app-template.md
    Use when refreshing binaries, apps, servers, or entrypoint-heavy members.
  • references/workspace-discovery.md
    用于工作区检测顺序、成员发现规则,以及导出范围与原始可见性的相关指引。
  • references/output-contract.md
    用于成员/根目录文件的必填章节、篇幅规则和验证标准。
  • references/package-template.md
    用于刷新库类型成员时。
  • references/app-template.md
    用于刷新二进制文件、应用、服务器或入口点密集型成员时。

Output Contract

输出约定

Report:
  1. detected workspace shape and scope
  2. members refreshed
  3. files created or updated
  4. coverage and self-containment summary
  5. budget and verification result
  6. deferred or intentionally skipped members
报告:
  1. 检测到的工作区形态和范围
  2. 已刷新的成员
  3. 创建或更新的文件
  4. 覆盖范围和独立性总结
  5. 篇幅和验证结果
  6. 延迟处理或有意跳过的成员