/compact-cli-dev:corefrom compact-cli-dev
Scaffolds and extends Oclif CLIs for Midnight Compact smart contracts on a local devnet. Provides wallet management, contract deployment, circuit invocation, state queries, and devnet lifecycle commands.
Ships in compact-cli-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
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 |
|---|---|---|
.dapp-state/wallets.json | 0o600 | Wallet seeds, addresses, creation dates. Contains secrets — never commit. |
.dapp-state/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 |
references/contract-lifecycle.md (opens in a new tab)references/error-handling.md (opens in a new tab)references/oclif-patterns.md (opens in a new tab)references/provider-setup.md (opens in a new tab)references/wallet-management.md (opens in a new tab)scripts/render-template.mjs (opens in a new tab)templates/cli/bin/dev.ts (opens in a new tab)templates/cli/bin/run.ts (opens in a new tab)templates/cli/biome.json (opens in a new tab)templates/cli/package.json.tmpl (opens in a new tab)templates/cli/src/base-command.ts (opens in a new tab)templates/cli/src/commands/balance.ts (opens in a new tab)templates/cli/src/commands/call.ts (opens in a new tab)templates/cli/src/commands/deploy.ts (opens in a new tab)templates/cli/src/commands/devnet/start.ts (opens in a new tab)templates/cli/src/commands/devnet/status.ts (opens in a new tab)templates/cli/src/commands/devnet/stop.ts (opens in a new tab)templates/cli/src/commands/dust/register.ts (opens in a new tab)templates/cli/src/commands/dust/status.ts (opens in a new tab)templates/cli/src/commands/join.ts (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub midnightntwrk/midnight-expert --plugin compact-cli-devOther plugins' skills for the same job