Installable skillApache-2.0

Cairo Dictionaries

Explain Cairo Felt252Dict usage, insert/get/entry patterns, and dictionary squashing; use when a request involves key-value storage, dictionary performance, or borrow/ownership rules for dictionaries in Cairo.

BY David-Li0406UPDATED Oct 30, 2026
INTENDED FOR✳Claude Code>_CodexInstall in a listed agent.

instructions.md

---
name: cairo-dictionaries-4b9f86c26fe5
description: Explain Cairo Felt252Dict usage, insert/get/entry patterns, and dictionary squashing; use when a request involves key-value storage, dictionary performance, or borrow/ownership rules for dictionaries in Cairo.
---

# Cairo Dictionaries

## Overview
Guide correct creation and use of Cairo dictionaries with proper ownership and performance notes.

## Quick Use
- Read `references/dictionaries.md` before answering.
- Show minimal snippets using `Felt252Dict` plus `Felt252DictTrait` methods.
- Mention squashing and cost implications when discussing performance.

## Response Checklist
- Use `Felt252Dict::<T>::default()` to initialize.
- Use `insert` and `get` for basic operations; use `entry`/`finalize` for advanced patterns.
- Remind that keys are `felt252` and values are generic `T`.
- Call out that dictionary access is linear in the number of entries and squashing occurs on destruction.

## Example Requests
- "How do I store balances by address in Cairo?"
- "Why does `get` return a default value sometimes?"
- "What is dictionary squashing and when does it happen?"

## Cairo by Example
- [Dictionaries](https://cairo-by-example.xyz/core/dict)
COMPATIBILITY & REFERENCES

Platform guidance

Imported from the listed AgentSkill.sh category. Complete supplied package files and notices are retained. Required external tools and credentials are not installed. No bundled code was executed during import. Individual agent task behavior has not been tested.