Help us improve
Share bugs, ideas, or general feedback.
From compact-core
This skill should be used when a user needs help debugging Compact smart contract errors, including compiler failures ("parse error", "unbound identifier"), proof generation issues, TypeScript witness type mismatches, disclosure errors ("potential witness-value disclosure must be declared"), or compatibility problems between Midnight components. Also applies when a user says their contract "won't compile", "worked before but broke after update", or when consecutive fix attempts keep revealing new errors. This skill orchestrates the debugging process and routes to domain-specific compact-core skills.
npx claudepluginhub devrelaicom/midnight-expert --plugin compact-coreHow this skill is triggered — by the user, by Claude, or both
Slash command
/compact-core:compact-debuggingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Core principle: **NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.**
This skill should be used when reviewing Compact smart contract code, TypeScript witness implementations, or test files for a Midnight project. Applies when a user asks to "review my Compact contract", "audit this smart contract", "check my Midnight code", or "run a code review checklist". Provides category-specific checklists covering privacy, security, cryptographic correctness, token economics, concurrency, compilation, performance, architecture, code quality, testing, and documentation, plus mechanical verification via /midnight-verify:verify.
Verification by compilation and execution. Translates a Compact claim into a minimal test contract, compiles it with the Compact CLI, runs the compiled output with @midnight-ntwrk/compact-runtime, and interprets the result. Loaded by the contract-writer agent. Covers workspace setup (lazy init), contract writing, compilation, runner script creation, execution, and result interpretation. References midnight-tooling:compact-cli for compilation details.
This skill should be used when the user asks about the Compact CLI, Compact Dev Tool, Compact Developer CLI, or compact devtools for Midnight Network smart contract development, including setting up the Compact toolchain on a new machine, resolving "compact: command not found" or "No default compiler set" errors, validating that Compact source code compiles correctly, switching between compiler versions, pinning a project to a specific compiler version, understanding why compilation is slow or how to speed it up, figuring out which version of the compiler or language they're running, setting up a project-local toolchain directory, configuring import search paths for multi-file contracts, understanding error messages or exit codes from the compiler or formatter, setting up or uninstalling the Compact toolchain, resolving GitHub API rate limiting when listing or updating versions, or troubleshooting why format or fixup is reporting failures
Share bugs, ideas, or general feedback.
Core principle: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
Debugging flow: Don't guess → Hypothesize → Instrument → Reproduce → Analyze → Fix → Verify.
This skill is process orchestration — it routes to existing compact-core skills for domain knowledge and does NOT duplicate their content.
First determine: "Is this a code bug or a compatibility issue?"
Code bug indicators:
Compatibility issue indicators:
If compatibility: fetch live support matrix from midnightntwrk/midnight-docs (docs/relnotes/support-matrix.mdx), compare against installed versions. Recommend /midnight-tooling:doctor for automated diagnostics.
| Functional Area | Components |
|---|---|
| Network | Node |
| Runtime & Contracts | Compact Compiler, Compact Runtime, Compact JS, On-chain Runtime, Ledger |
| SDKs & APIs | Wallet SDK, Midnight.js, DApp Connector API |
| Indexing & Data | Midnight Indexer |
| ZK & Proving | Proof Server |
If code bug: proceed to triage table.
Before any investigation, run /midnight-verify:verify on the contract:
/midnight-verify:verify <file.compact>
If the issue involves witnesses:
/midnight-verify:verify <contract.compact> <witnesses.ts>
The verification result immediately narrows the problem space:
If /midnight-verify:verify identifies the issue directly, present the finding — no further investigation may be needed.
| Symptom | Route To Skill | Investigation Phase |
|---|---|---|
parse error: found... | compact-language-ref (troubleshooting) | Root Cause |
unbound identifier | compact-language-ref + compact-standard-library (hallucination traps) | Root Cause |
potential witness-value disclosure | compact-privacy-disclosure (debugging-disclosure) | Root Cause |
implicit disclosure of witness value | compact-privacy-disclosure (debugging-disclosure) | Root Cause |
incompatible combination of types | compact-language-ref (types-and-values) | Root Cause |
cannot cast from type | compact-language-ref (types-and-values) | Root Cause |
cannot prove assertion | compact-language-ref (troubleshooting, runtime section) | Hypothesis |
operation undefined for type | compact-ledger (types-and-operations) | Root Cause |
| TypeScript type mismatch | compact-witness-ts (type-mappings) | Root Cause |
| Witness returns unexpected value | compact-witness-ts (witness-implementation) | Hypothesis |
| Token mint/transfer fails | compact-tokens (token-operations) | Pattern Analysis |
| MerkleTree proof fails | compact-privacy-disclosure + compact-standard-library | Hypothesis |
| "Works locally, fails on devnet" | compact-witness-ts (contract-runtime) | Pattern Analysis |
| Contract deploys but can't query state | Compatibility check (Indexer ↔ Ledger) | Compatibility |
| Proof generation hangs or fails | Compatibility check (Proof Server ↔ Compiler) | Compatibility |
| Wallet can't sign transactions | Compatibility check (Wallet SDK ↔ DApp Connector ↔ Midnight.js) | Compatibility |
| SDK bindings don't match generated types | Compatibility check (Compact JS ↔ Compiler) | Compatibility |
| Node rejects transaction | Compatibility check (Node ↔ On-chain Runtime) | Compatibility |
import not found / module not found | compact-language-ref (modules-and-imports) | Root Cause |
Adding disclose() keeps causing new errors | compact-privacy-disclosure (step 5: restructure) | Pattern Analysis |
| Constructor errors or missing initialization | compact-structure (patterns) + compact-ledger (state-design) | Root Cause |
| Enum variant access errors | compact-language-ref (troubleshooting) | Root Cause |
Entered based on triage result, not enforced sequentially.
skipZk=truedisclose() additions: "What can an on-chain observer learn from this value?"Track every fix attempt internally using this format:
Fix #1: [category] [what was tried] [result: resolved | new error | same error]
Fix #2: ...
Escalation triggers:
Surface a warning (non-blocking) when detecting:
| Pattern | Warning |
|---|---|
| Fix applied without stated hypothesis | "What's our hypothesis for why this will work?" |
| Same error category failed 3+ times | "We've tried this approach multiple times. Let's reconsider." |
| Fix in area A causes new error in area B | "This fix introduced a new issue elsewhere. Possible architectural concern." |
| Rapid successive fix attempts | "Let's slow down and verify our understanding before the next attempt." |
Stop immediately if the reasoning pattern matches any of the following.
If any of these apply: Stop. Return to Phase 1 (Root Cause Investigation) before attempting any fix.
Consecutive fixes revealing new problems in different areas indicates architectural issues: stop patching, document findings, discuss with team, consider design rethink.
After every fix:
skipZk=true. If unavailable, advise manual compilation.disclose() added, trace value to source and document what becomes public.Skills (loaded on demand via triage routing):
compact-language-ref — compiler errors, syntax, types, troubleshootingcompact-privacy-disclosure — disclosure errors, privacy patterns, debugging processcompact-structure — contract anatomy, common mistakescompact-standard-library — stdlib verification, hallucination trapscompact-witness-ts — TypeScript witnesses, type mappings, contract runtimecompact-ledger — state design, ADT operationscompact-tokens — token operations, mint/transfer patternsCross-plugin references:
/midnight-tooling:doctor — automated version diagnostics, environment healthmidnightntwrk/midnight-docs → docs/relnotes/support-matrix.mdxThis skill is purely process orchestration + triage routing + fix tracking.