starknet

Guides StarkNet smart contract development with Cairo, Scarb, starknet.js, and L1-L2 messaging.

6|20|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/andresdefi/cryptoskills --skill starknet-andresdefi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: starknet
Source: https://github.com/andresdefi/cryptoskills/tree/main/skills/starknet
Command: npx skills add https://github.com/andresdefi/cryptoskills --skill starknet-andresdefi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI agents trained on EVM patterns generate incorrect StarkNet code because Cairo is fundamentally different from Solidity — no EOAs, no msg.value, felt252 instead of uint256, and a two-step declare-then-deploy flow. This Skill provides accurate, current StarkNet development knowledge including contract patterns, deployment workflows, testing, and cross-chain messaging. ## Core Features & Use Cases - Cairo Contract Patterns: Provides working examples of storage, interfaces, events, components, Ownable patterns, and OpenZeppelin-based ERC-20 tokens using Cairo 2.x syntax. - Deployment & Testing Workflows: Covers Scarb builds, starkli and sncast declare/deploy commands, snforge unit tests with cheatcodes, and starknet.js integration including multicall and typed data signing. - L1-L2 Messaging: Documents bidirectional messaging between Ethereum and StarkNet with Cairo send_message_to_l1_syscall, Solidity sendMessageToL2, and #[l1_handler] receivers. - Use Case: Ask the agent to write an ERC-20 token on StarkNet, and it produces a correct OpenZeppelin component-based Cairo contract, compiles it with Scarb, and walks you through declaring and deploying it to Sepolia testnet. ## Quick Start Ask the agent to create a new Cairo smart contract project with Scarb and deploy a counter contract to StarkNet Sepolia testnet.

Frequently Asked Questions about starknet

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a smart contract on StarkNet with Cairo?

Write Cairo contracts using the #[starknet::contract] attribute with a #[storage] struct, #[constructor] function, and #[abi(embed_v0)] impl blocks for external functions. Build with Scarb, which compiles Cairo to Sierra bytecode for deployment.

How to deploy a Cairo contract to StarkNet testnet?

Deploy in two steps: first declare the contract class with starkli declare or sncast declare to get a class hash, then deploy an instance with starkli deploy or sncast deploy passing constructor calldata. Fund your account via the Sepolia faucet first.

What is the difference between felt252 and u256 in Cairo?

felt252 is StarkNet's native field element type that wraps on overflow, while u256 is a struct of two u128 values that panics on overflow. Use u256 for token amounts and financial math, and felt252 for hashes and identifiers.

Does StarkNet support account abstraction and multicall?

Yes, every StarkNet account is a smart contract implementing __validate__ and __execute__ entrypoints, so there are no EOAs. Multicall is native because __execute__ receives an array of calls, batching multiple operations in one transaction.

Why does my StarkNet transaction fail with VALIDATION_FAILURE?

VALIDATION_FAILURE means the account contract's __validate__ function rejected the transaction, usually due to an incorrect signature or wrong private key for the account address. Verify your keypair matches the deployed account and the nonce is current.

How do I send messages between Ethereum and StarkNet?

Send L1-to-L2 messages by calling sendMessageToL2 on the StarkNet Core contract, which triggers a #[l1_handler] function on the L2 contract. For L2-to-L1, call send_message_to_l1_syscall in Cairo, then consume the message on L1 after the state update is proven.