Guidance for tuple struct wrapper APIs that use public named constructors and internal tuple constructors; use when designing newtypes/wrappers, deciding constructor visibility, or documenting public vs internal usage.
설치
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
Guidance for tuple struct wrapper APIs that use public named constructors and internal tuple constructors; use when designing newtypes/wrappers, deciding constructor visibility, or documenting public vs internal usage.
Tuple Wrapper API Style
Goals
Keep public API stable by hiding representation details.
Keep internal code concise with tuple constructor and .0 access.
Pattern
Public: provide named constructors (e.g., new, from_array) and avoid exposing .0 in docs or external examples.
Internal: use tuple constructor Type(value) and .0 access for brevity.
When to apply
Use on newtype wrappers, identifiers, or semantic wrappers (e.g., Frontier, VersionVector, AgentId).
Skip for rich structs with many fields or where field names are clearer than a tuple.
Implementation checklist
Define wrapper as tuple struct: pub struct Type(T).