From hl-design-systems
Compile Circom circuits and run Groth16 trusted setup for zkVerify. Use when the user wants to compile a circuit, generate r1cs/wasm/zkey files, run powers of tau ceremony, or prepare for proof generation.
npx claudepluginhub horizenlabs/hl-claude-marketplace --plugin hl-design-systemsThis skill uses the workspace's default tool permissions.
Help the user compile their Circom circuit and run the trusted setup ceremony to prepare for proof generation.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Performs token-optimized structural code search using tree-sitter AST parsing to discover symbols, outline files, and unfold code without reading full files.
Help the user compile their Circom circuit and run the trusted setup ceremony to prepare for proof generation.
If invoked with an argument (e.g., /groth16-compile password_hash), use it as the circuit name.
If no argument provided, look for .circom files in circuits/ or ask the user which circuit to compile.
This skill compiles Circom circuits for Groth16 proof generation with snarkjs.
What this covers:
Alternatives not covered:
Before compiling, verify tools are installed:
circom --version && npx snarkjs --version
| Check | If Missing |
|---|---|
| circom | Auto-install (see below) |
| snarkjs | npm install snarkjs |
| circomlib | npm install circomlib (if circuit uses it) |
If circom is not installed, DO NOT stop and ask the user to install it manually. Instead, automatically install it by running these commands:
# 1. Install Rust if not present
if ! command -v cargo &> /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
fi
# 2. Install build tools (Linux/Docker)
if [ -f /etc/debian_version ]; then
apt-get update && apt-get install -y build-essential git || sudo apt-get update && sudo apt-get install -y build-essential git
fi
# 3. Clone and build circom
if [ ! -d /tmp/circom ]; then
git clone https://github.com/iden3/circom.git /tmp/circom
fi
cd /tmp/circom && cargo build --release && cargo install --path circom
# 4. Ensure PATH is updated
source "$HOME/.cargo/env"
# 5. Verify
circom --version
Always proceed with installation automatically. Only stop if the installation itself fails after multiple attempts.
mkdir -p build
circom circuits/<circuit_name>.circom \
--r1cs \
--wasm \
--sym \
-o build/ \
-l node_modules
Note: The -l node_modules flag tells circom where to find circomlib.
npx snarkjs r1cs info build/<circuit_name>.r1cs
Note the constraint count to choose the right Powers of Tau size.
# Choose size based on constraints (see reference.md for full table)
# pot12 = up to 4,096 constraints
curl -L https://storage.googleapis.com/zkevm/ptau/powersOfTau28_hez_final_12.ptau \
-o build/pot12_final.ptau
| Constraints | ptau | File |
|---|---|---|
| < 4,096 | 12 | 4.8 MB |
| < 16,384 | 14 | 19 MB |
| < 65,536 | 16 | 75 MB |
| < 262,144 | 18 | 300 MB |
See reference.md for larger sizes.
# Phase 2: Circuit-specific setup
npx snarkjs groth16 setup \
build/<circuit_name>.r1cs \
build/pot12_final.ptau \
build/<circuit_name>_0000.zkey
# REQUIRED: Add contribution (DO NOT skip this!)
npx snarkjs zkey contribute \
build/<circuit_name>_0000.zkey \
build/<circuit_name>.zkey \
--name="Circuit contribution" -v \
-e="$(openssl rand -hex 32)"
WARNING: The _0000.zkey is NOT safe for production. The contribution step is mandatory.
npx snarkjs zkey export verificationkey \
build/<circuit_name>.zkey \
build/verification_key.json
rm -f build/<circuit_name>_0000.zkey
build/
├── <circuit_name>.r1cs # Constraint system
├── <circuit_name>.zkey # Proving key
├── <circuit_name>_js/
│ └── <circuit_name>.wasm # Witness calculator
├── pot12_final.ptau # Powers of Tau (reusable)
└── verification_key.json # For zkVerify
build//groth16-prove to generate proofs.zkey file secureDO NOT ask the user to do things manually. This skill should:
npm install snarkjs)