noir-optimize-acir
Workflow for measuring and optimizing the ACIR circuit size of a constrained Noir program. Use when asked to optimize a Noir program's gate count or circuit size.
Install
mkdir -p .claude/skills/noir-optimize-acir && curl -L -o skill.zip "https://mcp.directory/api/skills/download/3059" && unzip -o skill.zip -d .claude/skills/noir-optimize-acir && rm skill.zipInstalls to .claude/skills/noir-optimize-acir
About this skill
ACIR Optimization Loop
This workflow targets ACIR circuit size for constrained Noir programs. It does not apply to unconstrained (Brillig) functions — Brillig runs on a conventional VM where standard profiling and algorithmic improvements apply instead, and bb gates won't reflect Brillig performance.
Measuring Circuit Size
Binary projects
Compile the program and measure gate count with:
nargo compile && bb gates -b ./target/<package>.json
Library projects
Libraries cannot be compiled with nargo compile. Instead, mark the functions you want to measure with #[export] and use nargo export:
nargo export && bb gates -b ./export/<function_name>.json
Artifacts are written to the export/ directory and named after the exported function (not the package).
If bb is not available, ask the user for their backend's equivalent command. Other backends should have a similar CLI interface.
The output contains two fields:
circuit_size: the actual gate count after backend compilation. This determines proving time, which is generally the bottleneck.acir_opcodes: number of ACIR operations. This affects execution time (witness generation). A change can reduce opcodes without affecting circuit size or vice versa — both matter, but prioritizecircuit_sizewhen they conflict.
Always record a baseline of both metrics before making changes.
Optimization Loop
- Baseline: compile and record
circuit_size. - Apply one change at a time.
- Recompile and measure: compare
circuit_sizeto the baseline. - Revert if worse: if
circuit_sizeincreased or stayed the same, undo the change. Not every "optimization" helps — the compiler may already handle it, or the overhead of the new approach may outweigh the savings. - Repeat from step 2 with the next candidate change.
What to Try
Candidate optimizations roughly ordered by impact:
- Hint and verify: replace expensive in-circuit computation with an unconstrained hint and constrained verification. This is the highest-impact optimization for most programs.
- Reduce what you hint: if you're hinting intermediate values (selectors, masks, indices), see if you can hint only the final result and verify it directly.
- Hoist assertions out of branches: replace
if c { assert_eq(x, a) } else { assert_eq(x, b) }withassert_eq(x, if c { a } else { b }). - Simplify comparisons: inequality checks (
<,<=) cost more than equality (==). But don't introduce extra state to avoid them — measure first.
What Not to Try
- Don't hint division or modular arithmetic: the compiler already injects unconstrained helpers for these.
- Don't hand-roll conditional selects:
if/elseexpressions compile to the same circuit asc * (a - b) + b. - Don't replace
<=with flag tracking without measuring: adding mutable state across loop iterations can produce more gates than a simple comparison.
More by noir-lang
View all skills by noir-lang →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversBoost AI coding agents with Ref Tools—efficient documentation access for faster, smarter code generation than GitHub Cop
Extract plot data from images with Axiomatic AI. Use advanced web plot digitizer features for scientific imaging and ana
Connect AI coding agents to Circuitry’s visual workflow platform to convert flowcharts to code, sync project files, and
Extend your developer tools with GitHub MCP Server for advanced automation, supporting GitHub Student and student packag
Boost productivity with Task Master: an AI-powered tool for project management and agile development workflows, integrat
Optimize your codebase for AI with Repomix—transform, compress, and secure repos for easier analysis with modern AI tool
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.