dapp-sdd:implement
Use when executing implementation tasks with commits after each task and reviews after each phase.
Use when reviewing Compact contracts for idiomatic patterns, learning recommended practices, or identifying common mistakes to avoid in Midnight smart contract development.
Full skill instructions
Guidance on idiomatic Compact patterns and common mistakes to avoid.
This skill activates for queries about:
Trigger words: best practices, idiomatic, convention, pattern, recommended, should, ought
| Pattern | Good | Avoid |
|---|---|---|
| Authorization | require_owner() helper | Inline auth in every circuit |
| Constants | Named constants | Magic numbers |
| Error handling | Descriptive assertions | Silent failures |
| State access | Controlled via helpers | Direct ledger access everywhere |
| Naming | verb_noun for circuits | Cryptic abbreviations |
// ❌ Missing language pragma
// Should be at the top of every file
export circuit example(): [] { }
// ✅ With pragma
pragma language_version >= 0.18.0;
export circuit example(): [] { }
// ❌ Not using Counter for counts
ledger count: Cell<Uint<64>>;
export circuit increment(): [] {
count.write(count.read() + 1);
}
// ✅ Using Counter ADT
ledger count: Counter;
export circuit increment(): [] {
count.increment(1);
}
Check file structure:
Verify appropriate types:
Check against idioms:
Use when executing implementation tasks with commits after each task and reviews after each phase.
Use when starting a new Midnight project, cloning example contracts (counter, tokens, NFTs, DEX), scaffolding from OpenZeppelin templates, or bootstrapping a Compact contract development environment with working starter code.
Use when caching ZK proofs for performance, implementing proof cache invalidation, storing verification results, caching intermediate proof components, or building distributed proof caches with Redis.
Use when setting up CI/CD for Midnight projects, configuring GitHub Actions for Compact contract compilation, running TypeScript tests in CI, validating version consistency, or automating contract builds.
Use when building witness data for ZK proofs, showing proof generation progress to users, implementing disclosure consent flows, handling proof timeouts and retries, or explaining privacy guarantees.
Use when implementing any Midnight example dApp to ensure compliance with quality standards and project conventions.
Use when implementing witness functions in TypeScript, mapping Compact types to TypeScript (Field→bigint, Bytes→Uint8Array), deploying contracts, calling circuits from TypeScript, reading ledger state, or building Midnight DApps with the JavaScript SDK.
Use when reading public ledger state, implementing reactive UI that updates with chain state, caching state for performance, or understanding public vs private state in Midnight DApps.
Use when optimizing prover performance, reducing proof generation memory usage, configuring prover infrastructure in Docker or Kubernetes, implementing parallel proof generation, or diagnosing prover bottlenecks.
Use when creating a phased implementation plan from a specification, with review gates after each phase.
Use when expanding a README-based dApp description into a full specification with user stories and acceptance criteria.
Use when calling deployed Midnight contracts from Node.js backends, querying contract state, executing state-changing transactions, building API endpoints that interact with contracts, or automating contract interactions.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience