/midnight-verify:verify-by-type-checkfrom midnight-verify
Verifies Midnight SDK type claims and user TypeScript files by writing test files and running tsc --noEmit. Supports claim mode and file mode with result interpretation.
Ships in midnight-verify. 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.
None: SKILL.md is the whole skill.
You are verifying an SDK claim or user TypeScript file by running the TypeScript compiler. Follow these steps in order.
A clean tsc run proves types are correct. It does NOT prove runtime behavior. If the claim is about what happens when you call a function (not just its signature), note: "Types verified, but runtime behavior requires devnet verification."
The workspace lives at ~/.midnight-expert/verify/sdk-workspace/ in your home directory. It is home-based and independent of the project you are working in.
First time (workspace does not exist):
mkdir -p "$HOME/.midnight-expert/verify/sdk-workspace"
cd "$HOME/.midnight-expert/verify/sdk-workspace"
# Initialize Node project
npm init -y
# Install all SDK packages + TypeScript
npm install \
@midnight-ntwrk/midnight-js \
@midnight-ntwrk/midnight-js-contracts \
@midnight-ntwrk/midnight-js-types \
@midnight-ntwrk/midnight-js-utils \
@midnight-ntwrk/midnight-js-network-id \
@midnight-ntwrk/midnight-js-level-private-state-provider \
@midnight-ntwrk/midnight-js-indexer-public-data-provider \
@midnight-ntwrk/midnight-js-http-client-proof-provider \
@midnight-ntwrk/midnight-js-fetch-zk-config-provider \
@midnight-ntwrk/midnight-js-node-zk-config-provider \
@midnight-ntwrk/midnight-js-logger-provider \
@midnight-ntwrk/midnight-js-dapp-connector-proof-provider \
@midnight-ntwrk/midnight-js-protocol \
@midnight-ntwrk/midnight-js-compact \
@midnight-ntwrk/testkit-js \
typescript
# Create tsconfig.json for type-checking
cat > tsconfig.json << 'TSCONFIG_EOF'
{
"compilerOptions": {
"target": "ES2022",
"module": "Node16",
"moduleResolution": "Node16",
"strict": true,
"noEmit": true,
"skipLibCheck": false,
"esModuleInterop": true,
"resolveJsonModule": true
},
"include": ["jobs/**/*.ts"]
}
TSCONFIG_EOF
Subsequent times (workspace exists):
Run a quick integrity check:
cd "$HOME/.midnight-expert/verify/sdk-workspace"
npm ls typescript
If npm ls reports errors, run npm install to repair.
Create the job directory:
JOB_ID=$(uuidgen | tr '[:upper:]' '[:lower:]')
mkdir -p "$HOME/.midnight-expert/verify/sdk-workspace/jobs/$JOB_ID"
When the orchestrator passes domain: 'wallet-sdk' context, use a separate workspace at ~/.midnight-expert/verify/wallet-sdk-workspace/ instead of the SDK workspace. This workspace has different packages installed.
First time (workspace does not exist):
mkdir -p "$HOME/.midnight-expert/verify/wallet-sdk-workspace"
cd "$HOME/.midnight-expert/verify/wallet-sdk-workspace"
# Initialize Node project
npm init -y
# Install all Wallet SDK packages + DApp Connector API + TypeScript
npm install \
@midnightntwrk/wallet-sdk-facade \
@midnightntwrk/wallet-sdk-shielded \
@midnightntwrk/wallet-sdk-unshielded-wallet \
@midnightntwrk/wallet-sdk-dust-wallet \
@midnightntwrk/wallet-sdk-runtime \
@midnightntwrk/wallet-sdk-abstractions \
@midnightntwrk/wallet-sdk-capabilities \
@midnightntwrk/wallet-sdk-hd \
@midnightntwrk/wallet-sdk-address-format \
@midnightntwrk/wallet-sdk-utilities \
@midnightntwrk/wallet-sdk-indexer-client \
@midnightntwrk/wallet-sdk-node-client \
@midnightntwrk/wallet-sdk-prover-client \
@midnight-ntwrk/dapp-connector-api \
typescript
# Create tsconfig.json for type-checking
cat > tsconfig.json << 'TSCONFIG_EOF'
{
"compilerOptions": {
"target": "ES2022",
"module": "Node16",
"moduleResolution": "Node16",
"strict": true,
"noEmit": true,
"skipLibCheck": false,
"esModuleInterop": true,
"resolveJsonModule": true
},
"include": ["jobs/**/*.ts"]
}
TSCONFIG_EOF
Subsequent times (workspace exists):
cd "$HOME/.midnight-expert/verify/wallet-sdk-workspace"
npm ls typescript
If npm ls reports errors, run npm install to repair.
Job directory, type assertion writing, tsc execution, interpretation, and cleanup follow the same steps as the standard SDK workspace. The only difference is the workspace path and the installed packages.
Mode selection: When you receive a claim from the orchestrator, check the domain context:
domain: 'wallet-sdk' → use ~/.midnight-expert/verify/wallet-sdk-workspace/~/.midnight-expert/verify/sdk-workspace/ (existing behavior)When the orchestrator passes domain: 'ledger' context and the claim is about behavioral output of a @midnight-ntwrk/ledger-v8 function (not just its type signature), go beyond type-checking — write a script that calls the function and observes the output.
This uses the existing sdk-workspace (ledger-v8 is already installed there). No separate workspace needed.
When to use this mode:
Script pattern:
cat > "$HOME/.midnight-expert/verify/sdk-workspace/jobs/$JOB_ID/ledger-exec.mjs" << 'EXEC_EOF'
// Import the specific function being tested
import { nativeToken, coinCommitment, CostModel } from '@midnight-ntwrk/ledger';
// Call the function and capture output
const result = nativeToken();
// Output structured JSON for interpretation
console.log(JSON.stringify({
result: typeof result === 'bigint' ? result.toString() : result,
type: typeof result
}));
EXEC_EOF
Run it:
cd "$HOME/.midnight-expert/verify/sdk-workspace/jobs/$JOB_ID"
node ledger-exec.mjs
Report this as "ledger-v8 execution" evidence, not as type-checking evidence. Include the script source, output, and interpretation in your report.
Mode selection summary:
domain: 'wallet-sdk' → use ~/.midnight-expert/verify/wallet-sdk-workspace/domain: 'ledger' + behavioral claim → use sdk-workspace + ledger execution scriptdomain: 'ledger' + type claim → use sdk-workspace + normal tsc type assertions~/.midnight-expert/verify/sdk-workspace/ (existing behavior)Claim mode — you received a natural language claim about the SDK (e.g., "deployContract returns DeployedContract"). Go to Step 3A.
File mode — you received a .ts file to verify (e.g., /midnight-verify:verify src/deploy.ts). Go to Step 3B.
Parse the claim and write a .ts file that exercises it using type-level assertions. The file should compile if and only if the claim is true.
Common assertion patterns:
// 1. Verify an export exists
import { deployContract } from '@midnight-ntwrk/midnight-js-contracts';
// 2. Verify a function's return type
import type { DeployedContract } from '@midnight-ntwrk/midnight-js-contracts';
type Result = Awaited<ReturnType<typeof deployContract>>;
type _Check = Result extends DeployedContract ? true : never;
const _proof: _Check = true;
// 3. Verify an interface has a specific property
import type { MidnightProviders } from '@midnight-ntwrk/midnight-js-types';
type _HasWallet = MidnightProviders<any, any, any>['walletProvider'];
// 4. Verify a class extends another
import { CallTxFailedError, TxFailedError } from '@midnight-ntwrk/midnight-js-contracts';
const _err = new CallTxFailedError('test', []);
const _base: TxFailedError = _err; // assignability check
// 5. Verify a type is exported from a specific package
import type { ProverKey } from '@midnight-ntwrk/midnight-js-types';
const _pk: ProverKey = new Uint8Array() as ProverKey;
// 6. Verify a function's parameter types
import { toHex } from '@midnight-ntwrk/midnight-js-utils';
const _result: string = toHex(new Uint8Array([0xAB]));
// 7. Verify an import path works
import { setNetworkId } from '@midnight-ntwrk/midnight-js-network-id';
Write the file to the job directory:
cat > "$HOME/.midnight-expert/verify/sdk-workspace/jobs/$JOB_ID/test-claim.ts" << 'TS_EOF'
<type assertion code>
TS_EOF
.ts file into the job directory./contract/index.js, ../compiled/counter):
.d.ts stub so tsc can proceed:
// stub for missing compiled contract
declare const _default: any;
export default _default;
export declare const pureCircuits: any;
export declare const ledger: any;
export declare const Witnesses: any;
export declare const Contract: any;
cd "$HOME/.midnight-expert/verify/sdk-workspace"
npx tsc --noEmit --project tsconfig.json 2>&1
Or to check a specific file:
npx tsc --noEmit jobs/$JOB_ID/test-claim.ts 2>&1
Capture the full output (stdout and stderr).
If tsc exits 0 (no errors):
If tsc exits non-zero:
Report format:
### Type-Check Report
**Claim:** [verbatim]
**Test file:**
\`\`\`typescript
[full source of the test .ts file]
\`\`\`
**tsc output:**
\`\`\`
[compiler output — clean or errors]
\`\`\`
**Interpretation:** [Confirmed / Refuted / Inconclusive] — [explanation]
**Note:** [if behavioral claim: "Types verified, but runtime behavior requires devnet verification."]
[if file mode with stubs: "Imports from ./path/to/contract were stubbed — types for these imports are unverified."]
rm -rf "$HOME/.midnight-expert/verify/sdk-workspace/jobs/$JOB_ID"
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub midnightntwrk/midnight-expert --plugin midnight-verify19 skills in this plugin
/verify-by-cli-executionmidnight-verify:verify-by-cli-executionVerification by running Compact CLI commands and observing output. Checks CLI availability, runs commands, captures stdout/stderr/exit code, inspects filesystem changes, and interprets results. Covers flag existence, flag behavior, output structure, error messages, exit codes, version info, and CLI-vs-compactc comparisons. Loaded by the cli-tester agent./verify-by-devnetmidnight-verify:verify-by-devnetVerification by running E2E scripts against a local Midnight devnet. Writes SDK test scripts (raw or using testkit-js) that exercise the full transaction pipeline: deploy, call circuits, observe state. Checks devnet health before proceeding. Loaded by the sdk-tester agent. Loads the `midnight-tooling:devnet` skill for infrastructure management./verify-by-executionmidnight-verify:verify-by-executionVerification 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./verify-by-ledger-sourcemidnight-verify:verify-by-ledger-sourceVerification by source code inspection of the Midnight ledger Rust codebase. Searches and reads the actual Rust implementation to verify claims about transaction structure, token mechanics, cost model, on-chain VM, contract execution, and cryptographic primitives. Routes claims to specific crates within the 24-crate workspace. Uses octocode-mcp for quick lookups, falls back to local cloning for deep investigation. Loaded by the source-investigator agent when the claim domain is ledger/protocol./verify-by-sourcemidnight-verify:verify-by-sourceVerification by source code inspection. Searches and reads the actual compiler, ledger, and runtime source code to verify structural or architectural claims about Compact and Midnight that cannot be tested via compilation. Uses octocode-mcp for quick lookups, falls back to local cloning for deep investigation. Loaded by the source-investigator agent./verify-by-wallet-sourcemidnight-verify:verify-by-wallet-sourceVerification by source code inspection of the Midnight Wallet SDK repositories. Searches and reads the actual wallet SDK source code to verify claims about wallet packages, the DApp Connector API, HD derivation, address encoding, and the three-wallet architecture. Uses octocode-mcp for quick lookups, falls back to local cloning for deep investigation. Loaded by the source-investigator agent when the claim domain is wallet SDK.Other plugins' skills for the same job