compact-core:compact-patterns

Catalog reusable Compact contract design patterns for access control, state, and privacy.

37|9|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/devrelaicom/midnight-expert --skill compact-core-compact-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compact-core:compact-patterns
Source: https://github.com/devrelaicom/midnight-expert/tree/main/plugins/compact-core/skills/compact-patterns
Command: npx skills add https://github.com/devrelaicom/midnight-expert --skill compact-core-compact-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides a concise, actionable catalog of Compact smart contract design patterns so developers can choose, combine, and implement secure, privacy-aware primitives without reinventing common solutions.

Core Features & Use Cases

  • Pattern Catalog: Coverage of access control (owner-only, RBAC, pausable, initializable), state management (state machines, time-locks), commitments (commit-reveal, sealed-bid auctions), value handling (escrow, treasury), governance (multi-sig, voting), identity/membership (registry, credentials, anonymous Merkle membership), and privacy (unlinkability, selective disclosure).
  • Composition Guidance: Advice for combining patterns safely with integration points, ordering rules (auth before action, state checks after auth), and privacy stacking considerations.
  • Operational Guidance: Key primitives, test checklists, privacy trade-offs, and cross-skill references to related Compact skills (tokens, privacy deep dives, ledger types).
  • Use Case Example: Design a private sealed-bid auction that uses commit-reveal, escrowed deposits, a time-locked reveal phase, and anonymous bidder membership via a HistoricMerkleTree.

Quick Start

Ask for pattern recommendations to design a Compact escrow that supports anonymous membership, time-locked releases, and emergency pause controls.

Frequently Asked Questions about compact-core:compact-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What design patterns are available for Compact smart contracts?

Compact smart contract patterns cover access control (owner-only, RBAC, pausable), state management (state machines, time-locks), commitments (commit-reveal, sealed-bid auctions), value handling (escrow, treasury), governance (multi-sig, voting), and identity (registry, anonymous Merkle membership).

How do I design a private sealed-bid auction in Compact?

Design a private sealed-bid auction in Compact by combining commit-reveal, escrowed deposits, a time-locked reveal phase, and anonymous bidder membership via a HistoricMerkleTree. This composition ensures bid privacy and unlinkability throughout the auction lifecycle.

Can I combine multiple Compact contract patterns like escrow and access control?

Yes, you can combine Compact contract patterns safely by following integration points and ordering rules, such as applying authentication before actions and state checks after authentication. Privacy stacking considerations must also be evaluated when combining multiple patterns.

Does Compact support anonymous membership and selective disclosure for smart contracts?

Compact supports anonymous membership through Merkle tree implementations and selective disclosure patterns. These privacy features allow contracts to manage identity and shielded value flows while maintaining unlinkability between participants and transactions.

What are the privacy trade-offs when stacking Compact contract patterns?

Stacking Compact contract patterns introduces privacy trade-offs related to unlinkability and selective disclosure when combining access control with shielded value flows. The catalog provides privacy considerations and test checklists to evaluate these trade-offs during secure contract design.