Help us improve
Share bugs, ideas, or general feedback.
From compact-cli-dev
This skill should be used when the user asks about scaffolding, extending, or debugging an Oclif CLI for Midnight Compact contracts -- including CLI scaffold, Oclif CLI template, wallet commands, contract deployment CLI, devnet CLI, CLI development, add CLI commands, Midnight CLI patterns, CLI error handling, CLI spinner and progress patterns, building a command-line interface for Compact contracts, scaffolding a new CLI project, or extending the generated CLI with new commands
npx claudepluginhub devrelaicom/midnight-expert --plugin compact-cli-devHow this skill is triggered — by the user, by Claude, or both
Slash command
/compact-cli-dev:coreThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill provides patterns for building Oclif CLIs that interact with Midnight Compact smart contracts on a local devnet. The template scaffolds a complete CLI with wallet management, contract deployment, circuit invocation, state queries, and devnet lifecycle control.
references/contract-lifecycle.mdreferences/error-handling.mdreferences/oclif-patterns.mdreferences/provider-setup.mdreferences/wallet-management.mdtemplates/cli/bin/dev.tstemplates/cli/bin/run.tstemplates/cli/biome.jsontemplates/cli/package.json.tmpltemplates/cli/src/base-command.tstemplates/cli/src/commands/balance.tstemplates/cli/src/commands/call.tstemplates/cli/src/commands/deploy.tstemplates/cli/src/commands/devnet/start.tstemplates/cli/src/commands/devnet/status.tstemplates/cli/src/commands/devnet/stop.tstemplates/cli/src/commands/dust/register.tstemplates/cli/src/commands/dust/status.tstemplates/cli/src/commands/join.tstemplates/cli/src/commands/query.tsThis 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
This skill should be used when the user asks to create a new Midnight project, scaffold a Compact smart contract project, use create-mn-app, initialize a DApp, set up a new Midnight application, start a new project, use a project template, set up hello-world or counter template, or set up a Midnight development environment for the first time. Also triggered by "new project", "start a project", "init project", "create-mn-app", or "scaffold".
This skill should be used when the user asks to scaffold a new Midnight DApp frontend, create a Vite + React 19 project for Midnight, initialize a UI and API package for a Compact contract, set up a shadcn + Tailwind v4 frontend, or invokes /midnight-dapp-dev:init. Generates a complete browser DApp scaffold with wallet connection, provider assembly, and contract interaction boilerplate.
Share bugs, ideas, or general feedback.
This skill provides patterns for building Oclif CLIs that interact with Midnight Compact smart contracts on a local devnet. The template scaffolds a complete CLI with wallet management, contract deployment, circuit invocation, state queries, and devnet lifecycle control.
| Command | Description |
|---|---|
wallet:create [name] | Generate a new wallet with a random seed |
wallet:list | List all stored wallets |
wallet:info <name> | Show wallet address and creation date |
wallet:fund <name> | Airdrop NIGHT from the genesis wallet |
dust:register <wallet> | Register NIGHT UTXOs for DUST generation |
dust:status <wallet> | Check DUST balance and registration status |
balance <wallet> | Show NIGHT and DUST balances |
deploy | Deploy the compiled contract to devnet |
join <address> | Join an existing deployed contract |
call <circuit> | Call a contract circuit (transaction) |
query <field> | Query contract public state (read-only) |
devnet:start | Start local devnet via Docker Compose |
devnet:stop | Stop local devnet containers |
devnet:status | Show devnet service health |
src/
base-command.ts Shared base command (--json, error handling, welcome banner)
lib/
wallet.ts HD wallet derivation, WalletFacade, persistence
providers.ts 6-provider bundle factory
funding.ts Genesis airdrop, DUST registration, balance polling
contract.ts CompiledContract loading, deploy, join, persistence
config.ts Network config (DEVNET_CONFIG), initializeNetwork()
errors.ts Error classification and formatting
progress.ts Ora spinner helpers, JSON-mode silence
constants.ts File paths, seeds, timeouts, fee parameters
commands/
wallet/
create.ts wallet:create
list.ts wallet:list
info.ts wallet:info
fund.ts wallet:fund
dust/
register.ts dust:register
status.ts dust:status
devnet/
start.ts devnet:start
stop.ts devnet:stop
status.ts devnet:status
balance.ts balance
deploy.ts deploy
join.ts join
call.ts call
query.ts query
Extend BaseCommand to inherit --json support, error classification, and the welcome banner:
import { Args, Flags } from "@oclif/core";
import { BaseCommand } from "../base-command.js";
export default class MyCommand extends BaseCommand {
static override description = "What this command does";
static override args = {
name: Args.string({ description: "Argument description", required: true }),
};
static override flags = {
...BaseCommand.baseFlags,
verbose: Flags.boolean({ description: "Show extra output", default: false }),
};
async run(): Promise<void> {
const { args, flags } = await this.parse(MyCommand);
// Command logic here
const result = { name: args.name };
if (!this.jsonEnabled) {
this.log(`Result: ${args.name}`);
}
this.outputResult(result);
}
}
Place the file under src/commands/ — the directory structure determines the topic. For example, src/commands/mygroup/action.ts creates the command mygroup:action.
| File | Permissions | Contents |
|---|---|---|
.midnight-expert/wallets.json | 0o600 | Wallet seeds, addresses, creation dates. Contains secrets — never commit. |
.midnight-expert/deployed-contracts.json | 0o644 | Contract addresses and deployment timestamps. Safe to share. |
Both files are stored relative to the project working directory.
The templates/cli/ directory contains a complete, production-ready scaffolding template. Use it as the starting point when generating a new CLI project. Template files use the following placeholders:
| Placeholder | Description | Example |
|---|---|---|
{{CONTRACT_PACKAGE}} | npm package name of the compiled contract | @my-org/my-contract |
{{CONTRACT_NAME}} | PascalCase contract name matching the Compact source | MyContract |
{{CONTRACT_ZK_CONFIG_PATH}} | Path to the ZK config JSON from the compiled contract package | node_modules/@my-org/my-contract/zk-config.json |
{{CLI_PACKAGE_NAME}} | Name of the generated CLI binary (used in help text and error messages) | my-contract-cli |
{{GENERATED_AT}} | ISO timestamp of when the CLI was scaffolded | 2026-04-02T12:00:00Z |
| Reference | When to Consult |
|---|---|
references/oclif-patterns.md | Understanding command structure, BaseCommand, --json, topic grouping |
references/wallet-management.md | HD derivation, WalletFacade, seed format, persistence, key functions |
references/provider-setup.md | The 6-provider bundle, createProviders(), network config |
references/contract-lifecycle.md | CompiledContract, deploy, join, calling circuits, querying state |
references/error-handling.md | Error classification, ErrorCode enum, formatError, adding new codes |