cairo-contract-authoring

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

9 stars

Best use case

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

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

Teams using cairo-contract-authoring 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-contract-authoring/SKILL.md --create-dirs "https://raw.githubusercontent.com/cartridge-gg/nums/main/.agents/skills/cairo-contract-authoring/SKILL.md"

Manual Installation

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

How cairo-contract-authoring Compares

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

Frequently Asked Questions

What does this skill do?

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

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 Contract Authoring

Use this as the entrypoint for implementation decisions; load references only as needed.

## When to Use

- Checking Cairo language fundamentals that directly affect contract behavior (ownership, refs, traits, generics).
- Writing a new Starknet contract.
- Modifying storage/events/interfaces.
- Composing OpenZeppelin Cairo components.

## When NOT to Use

- Gas/performance tuning (`cairo-optimization`).
- Test strategy design (`cairo-testing`).
- Deployment and release operations (`cairo-toolchain`).

## Quick Start

1. Define interface and storage boundaries first.
2. Implement minimal external/write surface.
3. Add explicit auth and invariant checks.
4. Add tests before broadening feature surface.
5. Run the authoring-to-audit handoff flow, then `cairo-auditor`.

## Security-Critical Rules

- Timelock checks must read time from Starknet syscalls (`get_block_timestamp`), never from caller-provided arguments.
- Every `#[external(v0)]` function that mutates storage must have explicit access posture:
  - guarded (`assert_only_owner` / role checks), or
  - intentionally public with a code comment stating why.
- Upgrade flows must reject zero class hash inputs before applying state transitions.
- Use anti-pattern/secure-pattern pairs to keep authoring behavior explicit and reviewable.
- If any of these rules fail in fixture benchmarks, update both:
  - skill/reference text, and
  - deterministic cases in `../evals/cases/contract_skill_benchmark.jsonl`, and
  - generation cases in `../evals/cases/contract_skill_generation_eval.jsonl`.

## Workflow

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

## References

- Detailed authoring reference: [legacy reference](references/legacy-full.md)
- Cairo language fundamentals reference: [language reference](references/language.md)
- Build-side anti-pattern pairs: [anti-pattern pairs](references/anti-pattern-pairs.md)
- Authoring to audit execution path: [audit handoff](references/audit-handoff.md)
- Module index: [references index](references/README.md)

Related Skills

cairo-optimization

9
from cartridge-gg/nums

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

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.