一键导入
rust-module-boundary
Use when writing or reviewing Rust module structure, item visibility, public API exposure, or pub/pub(crate)/pub(super) choices in OMMX.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when writing or reviewing Rust module structure, item visibility, public API exposure, or pub/pub(crate)/pub(super) choices in OMMX.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Append release note entries for the current PR to the relevant OMMX Python SDK and/or Rust SDK release notes
Use when deciding, auditing, or applying GitHub Release labels on OMMX pull requests, especially `rust`, `python`, `proto`, `lean`, `documentation`, `bug`, or `breaking change` labels for release-note generation from the actual PR diff.
Use when reviewing, designing, triaging, or managing OMMX benchmarks, CodSpeed runs or flamegraphs, performance PRs or issues, benchmark workload changes, or benchmark CI policy. Classify the measurement purpose, define the benchmark contract and cost model, validate the required scaling or profile evidence, assign a lifecycle and run policy, and keep CI cost proportional to the regression signal.
Use when triaging, labeling, closing, rewriting, or organizing GitHub issues in Jij-Inc/ommx, especially when deciding consistent issue labels, separating issue backlog labels from PR release-note labels, auditing open issues, or applying GitHub issue metadata changes.
Use when reviewing changes to Arbitrary implementations, proptest strategy parameters, or property-test generators in the OMMX Rust SDK, including changes to what a default strategy generates.
Use when reviewing OMMX Python SDK changes, PyO3 bindings under python/ommx/src, public Python API shape, pyo3-stub-gen output, generated stubs, Python-side wrappers, or tests for Python SDK behavior.
| name | rust-module-boundary |
| description | Use when writing or reviewing Rust module structure, item visibility, public API exposure, or pub/pub(crate)/pub(super) choices in OMMX. |
Use this skill whenever Rust code changes introduce, remove, or review module boundaries or item visibility. This applies during implementation and code review.
Use .agents/skills/domain-responsibility-review/SKILL.md first when a change has domain meaning. This skill is the next step: translate that responsibility model into Rust modules, ownership boundaries, and visibility.
When designing access scope, do not start from the field, method, or visibility
keyword that would make the current call site compile. Start from the
operation → representation → API derivation defined as the Mandatory Design
Order in .agents/skills/domain-responsibility-review/SKILL.md. That order is
owned by the domain skill; do not restate or fork it here. This skill
translates its outcome into Rust module structure and visibility.
For each operation identified there, state:
Derive access scope from that analysis. Grant mutation authority only to the
object that owns the mathematical/domain operation. Lower-level tables or
collections may expose storage primitives only for the specific row-level
effects needed by that owner; they should not expose broad &mut access that
lets sibling modules perform part of the root operation without the owner.
pub(crate) is still an API across owner boundaries. Do not use crate-internal
visibility as the method for preserving invariants. Use it only when a named
owner in another top-level module must call a narrow operation whose effect can
be described without exposing broader mutation authority. If the justification
is only "SDK users cannot call it", make the item private or reshape the module
boundary.
Identify the owner before choosing visibility.
Choose the narrowest visibility that matches the owner boundary.
pub inside a private module when sibling code inside that private module boundary needs the item; the module privacy still protects it from the crate API.pub(crate) only when the item must cross top-level module boundaries in this crate and the allowed effect is narrower than the caller's full semantic operation.Document public owner invariants.
Avoid visibility as a shortcut.
pub(super) or pub(in ...) to patch around an awkward module hierarchy.Document crate-wide visibility.
pub(crate) is necessary, add a short comment or documentation explaining why the item must cross top-level module boundaries.rewrite, update, with, or into_parts unless the owning
abstraction genuinely exposes that whole operation.Before reading the diff by hand, generate the visibility delta and review that
listing. Eye-scanning a large diff misses added pub items; a generated
listing does not.
rust/; the
PyO3 binding crate lives under python/ommx/src, so match by file type
rather than hard-coding a directory:
git diff main...HEAD -- '*.rs' | rg '^\+.*\bpub\b'
git diff main...HEAD -- '*.rs' | rg '^\+.*(-> *&mut|&mut self)'
cargo-public-api and a nightly toolchain are available, produce the
public API delta of the SDK crate instead of reconstructing it from the
diff:
cargo public-api -p ommx diff main..HEAD
CI already runs cargo-semver-checks, but that only answers "is this a semver
break". The API delta answers "which public items appeared, changed, or
disappeared" — every added line is an SDK commitment that needs an owner
justification.#[pymethods], derive macros — never appear in it. cargo public-api
(rustdoc JSON) and rust-analyzer queries see the post-expansion API, so use
one of them when the change touches macro-heavy code.Check that visibility follows the domain owner.
findReferences on the item gives the actual
caller set. If every caller lives in one module, the visibility is too
broad — make the item private or pub inside a private module.
Graduation target for over-broad visibility: #![warn(unreachable_pub)]
and clippy's redundant_pub_crate, which flag items whose visibility
exceeds their actual reachability.Check for hidden API commitments.
Check for invariant bypass.
pub(crate) item, ask what invariant the callee can enforce
locally and what invariant remains owned by the caller. If the callee
accepts a closure or raw parts that let the caller mix these layers, treat
it as a boundary leak unless the owner analysis proves otherwise.Write findings in boundary terms.
.agents/skills/domain-responsibility-review/SKILL.md.pub(super) or pub(in ...)?pub(crate) is used, is the cross-module reason documented and is the exposed effect narrow enough?pub grep or cargo public-api diff)
instead of relying on eye-scanning the diff?