A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
Claude Code skill for writing and testing Compact smart contracts on Midnight
An Agent Skill for writing, testing, and deploying Compact smart contracts on the Midnight blockchain. Built from Discord community knowledge, compiler validation, and real-world gotchas. This project extends the Midnight Network with additional developer tooling.
Supports Claude Code, Cursor, Gemini CLI, VS Code Copilot, and 30+ other AI coding assistants.
Important: These examples are educational references. Any smart contract generated using this skill should be professionally audited before deployment to mainnet. AI-assisted code generation does not replace security review.
All examples compiled and tested against Compact 0.30.0 (compact-runtime 0.15.0, ledger v8). Also compatible with Compact 0.29.0 (ledger v7). See gotcha #74 for migration guide.
| Example | Circuits | Tests | Status |
|---|---|---|---|
| Counter | 3 | 5/5 | Validated |
| Bulletin Board | 3 | 8/8 | Validated |
| Fungible Token | 7 | 6/6 | Validated (OZ modules) |
| NFT | 7 | 6/6 | Validated |
| Rock-Paper-Scissors | 3 | 6/6 | Validated |
| Shielded Voting | 6 | 9/9 | Validated |
| Sealed-Bid Auction | 6 | 8/8 | Validated |
| Identity Proof | 4 | 6/6 | Validated |
| Credential Registry | 5 | 6/6 | Validated |
| Prescription | 5 | 6/6 | Validated |
| Escrow | 5 | 8/8 | Validated |
| Time Lock | 3 | 7/7 | Validated |
| Multi-Sig | 6 | 6/6 | Validated |
| Staking | 5 | 6/6 | Validated |
| Crowdfunding | 5 | 6/6 | Validated |
| Lending | 6 | 6/6 | Validated |
| Prediction Market | 5 | 7/7 | Validated |
| Oracle Feed | 5 | 6/6 | Validated |
| Access Control | 8 | 6/6 | Validated |
| DID Registry | 5 | 6/6 | Validated |
| Micro-DAO | 7 | 7/7 | Validated |
| Contract Upgradability | V1: 3, V2: 7 | 8/8 | Validated |
| Token Swap | 6 | — | Preprod deployed |
| Token Minting | 3 | — | Preprod deployed |
| Privacy Mixer | 3 | 7/7 | Validated |
| Lottery | 4 | 8/8 | Validated |
| Vesting | 4 | 8/8 | Validated |
| Revenue Sharing | 3 | 7/7 | Validated |
| Supply Chain | 4 | 7/7 | Validated |
29/29 compile on Compact 0.30.0. 143 circuits. 29/29 simulator-validated on compact-runtime 0.15.0. 6 contracts deployed on v8 preprod.
Token Swap and Token Minting use Zswap coin operations (receiveShielded, sendImmediateShielded, mintToken) that require the full network stack for circuit calls. Both compile and deploy successfully.
6 contracts deployed to Midnight preprod on Ledger v8 (protocol v22000). Representative sample validating all major patterns.
| Contract | Pattern | Circuits | DUST Fee | Deploy Time | Block |
|---|---|---|---|---|---|
| Counter | simplest | 3 | 252B | 17.8s | 114208 |
| Bulletin Board | auth | 2 | 267B | 19.1s | 114211 |
| Sealed-Bid Auction | commit-reveal + state machine | 5 | 554B | 16.9s | 114214 |
| Oracle Feed | time-based | 5 | 504B | 19.0s | 114217 |
| Multi-Sig | multi-party | 6 | 574B | 17.5s | 114220 |
| LOK | token ops (receiveUnshielded) | 4 | 423B | 17.4s | 114223 |
receiveUnshielded (wallet→contract token transfer) confirmed working on v8 — Issue #151 resolved.
30 contracts were previously deployed on Ledger v7 (protocol v21000). Chain state was reset with the v8 upgrade on March 25, 2026.
DUST is Midnight's fee token — generated continuously from tNight. Must register NIGHT UTxOs for dust generation before any deployment (gotcha #75).
mkdir -p .claude/skills
git clone https://github.com/adavault/midnight-skill.git .claude/skills/midnight-compact
git clone https://github.com/adavault/midnight-skill.git ~/.claude/skills/midnight-compact
The skill auto-activates on keywords: Midnight, Compact, circuit, witness, ledger, disclose, proof server, DUST, NIGHT, Zswap, shielded.
Or invoke explicitly: /midnight-compact
midnight-skill/
├── SKILL.md # Core skill — workflow, syntax, patterns
├── README.md # This file
├── LICENSE # MIT
├── reference/ # Deep-dive reference documents
│ ├── language.md # Compact types, syntax, modules, operators
│ ├── privacy-model.md # Shielded/unshielded state, ZK proof flow
│ ├── security.md # 10 ZK attack categories and mitigations
│ ├── testing.md # Simulator, standalone, testnet testing
│ ├── patterns.md # Design patterns and circuit optimization
│ ├── stdlib.md # CompactStandardLibrary reference
│ ├── gotchas.md # 79 real-world issues from Discord + compilation
│ ├── offchain.md # TypeScript SDK, wallet, deployment
│ └── auditing.md # ZK contract audit methodology
└── examples/ # Working examples with tests
├── counter.md # Simplest contract — state + increment
├── bulletin-board.md # Witness auth, CRUD, multi-user
├── fungible-token.md # OZ module composition (FT + Ownable + Pausable)
├── nft.md # Commitment-based NFT ownership
├── rock-paper-scissors.md # Commit-reveal 2-player game
├── shielded-voting.md # Commit-reveal private ballot
├── sealed-bid-auction.md # Commit-reveal with state machine
├── identity-proof.md # Selective disclosure, parameterized witnesses
├── credential-registry.md # Nullifier-based double-use prevention
├── prescription.md # Batch registration, nullifier for healthcare
├── escrow.md # Two-party exchange with deadline
├── time-lock.md # Time-based LOK/RELEASE pattern
├── multi-sig.md # M-of-N authorization, composite keys
├── staking.md # Lock period + ZK reward calculation
├── crowdfunding.md # Anonymous backing, ZK refund proofs
├── lending.md # Collateral, health factor, liquidation
├── prediction-market.md # Commitment-based bets, ZK payout
├── oracle-feed.md # External data, freshness checks
├── token-swap.md # Atomic swap (coin operations)
├── access-control.md # Role hierarchy, internal guards
├── did-registry.md # DID document lifecycle management
├── micro-dao.md # Token-gated voting, treasury
├── contract-upgradability.md # V1/V2 migration pattern
├── token-minting.md # Zswap coin creation (mintShieldedToken)
├── privacy-mixer.md # Nullifier-based deposit/withdraw mixer
├── lottery.md # Commit-reveal multi-party randomness
├── vesting.md # Time-based tranche release schedule
├── revenue-sharing.md # Private share allocations, ZK withdrawal
└── supply-chain.md # Selective disclosure provenance tracking
Compiling all examples against the real compiler uncovered several patterns not documented elsewhere:
Uint<N> + literal type widening — Uint<32> + 1 produces Uint<0..4294967297>. Fix: (expr + 1) as Uint<32>.witness fn(param: T): U passes circuit arguments to TypeScript witnesses as additional function parameters.circuit (not pure circuit) can read/write export ledger state, enabling reusable guard patterns.disclose() — compile-time constants written to export ledger don't need disclosure wrapping.All findings are documented in gotchas.md (#49-#52) and in each example's Key Concepts section.
The Ledger v8 release (March 2026) introduced significant SDK changes discovered during validation:
[nextPrivateState, value] instead of just value (gotcha #79)contract.initialState(ctx, ...args) replaces contract.constructor(ctx) (gotcha #79)registerNightUtxosForDustGeneration() before any deployment (gotcha #75)signRecipe bug fixed — wallet-sdk-facade 3.0.0 handles proof markers correctly (gotcha #76)nativeToken() trap — use unshieldedToken().raw from ledger-v7 for balance lookups (gotcha #77)levelPrivateStateProvider now requires encryption config (gotcha #78)Built from:
PRs welcome — especially from Midnight developers, ZK researchers, and privacy protocol builders. Areas of interest:
MIT — see LICENSE.
Built by ADAvault
Claude Code skill for YouTube creators — channel audits, video SEO, retention scripts, thumbnails, content strategy, Sho
AI image generation skill for Claude Code -- Creative Director powered by Gemini
A Claude Code skill by Hao (駱君昊) that learns your Facebook voice and auto-posts to FB / IG / Threads / X with a 14-day c
Universal SEO skill for Claude Code. 25 sub-skills + 18 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, bac