name: cairo-data-types description: Explain Cairo scalar and compound data types, literals, conversions, and string forms; use when a request asks about Cairo types (felt252, integers, bool, strings, tuples, arrays, unit), type annotations, or conversion errors.
Cairo Data Types
Overview
Explain Cairo's core data types, literals, and conversions so answers stay type-correct and safe.
Quick Use
- Read
references/data-types.mdbefore answering. - State the target type explicitly and show the correct literal or conversion.
- Prefer integer types over
felt252when safety (overflow/underflow checks) matters.
Response Checklist
- Identify whether the value should be
felt252, a specific integer type,bool, a string type, or a compound type. - When literals are ambiguous, use a type suffix or explicit annotation.
- For conversions, show
try_into/intopatterns and mention potential failure where relevant.
Example Requests
- "What is the difference between
felt252andu64in Cairo?" - "How do I write a short string vs a long string?"
- "Why does this integer literal need a type annotation?"