cairo-optimization

Improves Cairo performance after correctness is established, including hotspot profiling, arithmetic/loop optimization, and bounded-int hardening.

9 stars

Best use case

cairo-optimization is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Improves Cairo performance after correctness is established, including hotspot profiling, arithmetic/loop optimization, and bounded-int hardening.

Teams using cairo-optimization should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/cairo-optimization/SKILL.md --create-dirs "https://raw.githubusercontent.com/cartridge-gg/nums/main/.agents/skills/cairo-optimization/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/cairo-optimization/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How cairo-optimization Compares

Feature / Agentcairo-optimizationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Improves Cairo performance after correctness is established, including hotspot profiling, arithmetic/loop optimization, and bounded-int hardening.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Cairo Optimization

Apply only after tests pass and behavior is locked.

## When to Use

- Improving gas/resource usage in hot paths.
- Rewriting expensive loops/arithmetic patterns.
- Optimizing storage layout and integer choices.

## When NOT to Use

- Early feature prototyping without tests.
- Security review as a substitute for correctness proofs.

## Quick Start

1. Confirm baseline behavior with tests.
2. Profile target paths with `python3 scripts/profile.py profile`.
3. Apply one optimization class at a time.
4. Re-run tests and compare resource deltas.
5. Use anti-pattern/secure-pattern pairs to keep micro-optimizations explicit.
6. Encode stable optimization rules in `../evals/cases/contract_skill_benchmark.jsonl` to prevent regressions.
7. Run `cairo-auditor` on touched files to ensure no security regressions were introduced.

## Workflow

- Main optimization flow: [default workflow](workflows/default.md)

## References

- Detailed optimization rules: [legacy reference](references/legacy-full.md)
- Profiling workflow and troubleshooting: [profiling reference](references/profiling.md)
- Optimization anti-pattern pairs: [anti-pattern pairs](references/anti-pattern-pairs.md)
- Module index: [references index](references/README.md)

Related Skills

cairo-contract-authoring

9
from cartridge-gg/nums

Guides Cairo smart-contract authoring on Starknet with language fundamentals, safe structure choices, component composition, and implementation workflow references.

cairo-auditor

9
from cartridge-gg/nums

Systematic Cairo/Starknet security audit workflow with deterministic preflight, parallel vector specialists, adversarial reasoning, and strict false-positive gating.

add-release-note

9
from cartridge-gg/nums

Add a new release note entry. Keeps the client data file and the docs MDX page in sync, and bumps the version so the in-game modal re-appears for all players.

account-abstraction

9
from cartridge-gg/nums

Starknet account abstraction correctness and security guidance for validate/execute paths, nonces, signatures, and session policies.

ui-ux-pro-max

9
from cartridge-gg/nums

UI/UX design intelligence for web and mobile. Includes 50+ styles, 161 color palettes, 57 font pairings, 161 product types, 99 UX guidelines, and 25 chart types across 10 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, and HTML/CSS). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, and check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, and mobile app. Elements: button, modal, navbar, sidebar, card, table, form, and chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, and flat design. Topics: color systems, accessibility, animation, layout, typography, font pairing, spacing, interaction states, shadow, and gradient. Integrations: shadcn/ui MCP for component search and examples.

ui-architecture

9
from cartridge-gg/nums

UI component patterns for the Nums game client — Radix primitives, elements, containers, theming, Storybook conventions. Use when creating or modifying UI components, adding storybook stories, or working with the design system.

ui-architecture-icon

9
from cartridge-gg/nums

Add SVG icons to the Nums game client — convert SVG, create component, export, update storybook. Use when adding, modifying, or removing icon components.

shadcn

9
from cartridge-gg/nums

Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", or "switch to --preset".

render-daily-replay

9
from cartridge-gg/nums

Auto-render a Remotion video replay of a Nums game on Mainnet. Resolves the target `gameId` from Torii (best reward of the day OR best score of the day, OR a specific gameId the user provides), silently auto-fetches the current NUMS price from Ekubo, then runs `pnpm remotion:render:game` with the right props. Use when the user asks to render today's top game, the daily winner, the biggest reward, the highest score, or any specific gameId, without having to assemble the render command by hand.

remotion-best-practices

9
from cartridge-gg/nums

Best practices for Remotion - Video creation in React

nums-remotion-replay

9
from cartridge-gg/nums

Project-specific skill for the Nums Remotion package that generates game replay videos by reusing the existing client React components. Covers the cross-package webpack setup, client-component overrides, Torii data fetching, font loading, render flow quirks, and hosting. Use when working on `remotion/` or the `SlidingNumber` component, adding new compositions, debugging font/animation issues, or setting up hosting for the Remotion Studio. Pairs with the generic `remotion-best-practices` skill.

dojo

9
from cartridge-gg/nums

Dojo Engine framework patterns — World, Systems, Models, Events, Components, Store, permissions, testing with spawn_test_world, and deployment with sozo.