본문으로 건너뛰기
cccskills
무료GitHub에 공개

rust-contract-domain-modeling

Domain-driven modeling patterns for Axone contracts. Use when introducing domain concepts, encoding invariants, or deciding boundaries between domain, handlers, services, gateways, queries, and state.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md2.6 KB
  • references/repo-patterns.md1.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Rust Contract Domain Modeling

Goal

Keep business invariants in explicit domain types instead of scattering them across handlers, query builders, or storage code.

Boundary Rules

  • domain/ owns business concepts and invariants.
  • handlers/ decode messages, orchestrate use cases, and shape responses.
  • services/ compose domain logic with environment-dependent enrichment or cross-module coordination.
  • gateway/ isolates external module interaction and protocol-specific I/O.
  • queries/ build external query payloads or request strings; they should not become the home of business rules.
  • state/ persists data and reconstructs domain values; it should not silently redefine domain invariants.

Domain Rules

  • Prefer constructors such as new or try_new that reject invalid states up front.
  • Use TryFrom when validating a parsed or transport-level representation into a domain type.
  • Keep domain methods deterministic and side-effect-light whenever possible.
  • If a value is reconstructed from trusted state, make that explicit with a constructor such as from_state.
  • Model canonical representations once in the domain layer, then reuse them everywhere else.

Patterns From This Repository

  • Case::new and TryFrom<Term> validate that a case is a ground Prolog dict before it can circulate as a domain object.
  • Constitution::try_new validates UTF-8, required predicates, and engine feedback before a constitution exists as a valid domain value.
  • Constitution::from_state reconstructs a previously validated value from storage without re-running external validation.
  • Decision::new captures an immutable decision snapshot from already validated inputs.
  • Authority::new canonicalizes a bech32 account into the DID form exposed by the contract.

Design Heuristics

  • Put parsing and invariant checks as close as possible to the creation of the domain object.
  • Keep handlers thin. If a handler starts accumulating validation branches, move that logic into a domain type or service.
  • Avoid passing partially validated strings through multiple layers when a dedicated type can encode the guarantee once.
  • Make invalid states unrepresentable where practical, especially for smart-contract-critical logic.

References

  • For concrete domain examples from this repository, read repo-patterns.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Best practices for designing CosmWasm smart contract APIs. Use when defining message types, designing execute/query interfaces, or optimizing API ergonomics.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

axone-protocol/contracts1232026년 10월 14일 업데이트

Guide for writing Rust doc comments that produce accurate generated contract documentation. Use when editing Instantiate/Execute/Query/Response types or any public schema-facing API.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

axone-protocol/contracts1232026년 10월 14일 업데이트

Guide for writing conventional commit messages. Use when committing changes, writing commit messages, or reviewing commit history.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

axone-protocol/contracts1232026년 10월 14일 업데이트

Axone contract structure and Abstract SDK patterns. Use when scaffolding or refactoring contracts, deciding layer boundaries, wiring AppContract entrypoints, or adding module metadata and replies.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

axone-protocol/contracts1232026년 10월 14일 업데이트

Axone deployment workflows with cargo-make, cw-orch, and Abstract. Use when publishing modules, installing them on accounts, running local chain tasks, or inspecting deployments.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

axone-protocol/contracts1232026년 10월 14일 업데이트

Guide for regenerating Axone contract schemas and rendered Markdown docs. Use when contract APIs or metadata change, when checking generated-doc drift, or when preparing documentation commits.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

axone-protocol/contracts1232026년 10월 14일 업데이트

axone-protocol의 스킬 모두 보기

이 스킬의 문제 신고