Agent skill
shared-wrapper-design
共有ラッパー(*Shared)と非共有本体(*)、Handle の使い分け、ArcShared+ToolboxMutex、SharedAccess/Clone の設計判断を扱う。共有の要否を判断し、shared_vs_handle ガイドに従って設計・実装する場面で使う。
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/design/shared-wrapper-design
SKILL.md
共有ラッパー設計
方針
- 共有が不要なら本体型(
Xyz)を使え。 - 共有が必要なら
XyzSharedを使え。 XyzSharedはArcShared<ToolboxMutex<Xyz, TB>>を内包し、CloneとSharedAccessを入口にせよ。
判断基準(簡易チェック)
- 単一所有・単一スレッド: 本体型(
Xyz)を選べ。 - 複数所有・複数スレッド:
XyzSharedを選べ。 - 外部へ渡す/保持する必要がある:
XyzSharedを選べ。
実装ガイド
XyzSharedのwith_read/with_writeで状態へアクセスせよ。- 個別ラッパーメソッドは必要時のみ追加し、基本構成は薄い共有ラッパーで保て。
- 共有/管理の責務が増えたら
XyzHandleを検討せよ。 - 迷ったら
docs/guides/shared_vs_handle.mdを必ず参照せよ。 TBのように RuntimeToolbox を型パラメータとして持つ型は、名称末尾をGenericにせよ(例:XyzSharedGeneric<T, TB>)。
例(非固定)
ActorFuture/ActorFutureSharedGenericは共有/非共有の一例に過ぎない。IdentityLookup/IdentityLookupSharedのような構成でも同様に適用せよ。
禁止事項
- 共有が不要なのに
XyzSharedを使うな。 - 本体型に内部可変性を持ち込むな。
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?