Cairo language and compiler—Rust-like syntax, Sierra/CASM pipeline, Starknet contracts, linear types, and tooling.
Resources
1Install
npx skillscat add hairyf/blockchain-skills/cairo Install via the SkillsCat registry.
SKILL.md
Skill based on Cairo (starkware-libs/cairo), generated from
sources/cairo. Doc path:sources/cairo/docs/reference/src/components/cairo/modules/.
Cairo is a Turing-complete language for provable programs (Starknet, general computation). It uses a Rust-like syntax, Sierra as an intermediate representation, and compiles to CASM. Use this skill for writing and compiling Cairo programs and Starknet contracts, and for understanding types, traits, and linear semantics.
Core References
| Topic | Description | Reference |
|---|---|---|
| Modules and crates | Crates, modules, use, super, file layout | core-modules-and-crates |
| Functions | Signatures, mut/ref, methods, implicits, nopanic, local compilability | core-functions |
| Structs and enums | Definitions, instantiation, destructuring, match | core-structs-and-enums |
| Traits and impls | Traits, named impls (of), impl generics, dispatch | core-traits-and-impls |
| Types and generics | Type system, generics, Array, Felt252Dict, fixed arrays | core-types-and-generics |
| Linear types | Move, Copy, Drop, Destruct, Clone, snapshot (@) | core-linear-types |
| Derive and prelude | Derive macro, common traits, prelude | core-derive-and-prelude |
Features
Starknet
| Topic | Description | Reference |
|---|---|---|
| Starknet contracts | Storage, entry points, events, ABI, dispatchers, syscalls | features-starknet-contracts |
Tooling
| Topic | Description | Reference |
|---|---|---|
| CLI and compilation | cairo-compile, sierra-compile, cairo-run, starknet-compile | features-cli-and-compilation |
| Match and panic | Match (enum/felt252), panic, nopanic, panic_with | features-match-and-panic |
Best Practices
| Topic | Description | Reference |
|---|---|---|
| Naming and memory | Conventions, struct copy semantics, array/dict patterns | best-practices-naming-and-memory |