Skip to content
Back to skills

Cairo Custom Data Structures

ASecurity

Explain how to build custom data structures in Cairo using structs, traits, and dictionaries; use when a request involves implementing mutable collections (like a vector) or handling Destruct/Drop with Felt252Dict.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
ai-agents

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill cairo-custom-data-structures --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cairo Custom Data Structures?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cairo Custom Data Structures
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-cairo-custom-data-structures/badge)](https://www.skillsdirectory.com/skills/david-li0406-cairo-custom-data-structures)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cairo-custom-data-structures
description: Explain how to build custom data structures in Cairo using structs, traits, and dictionaries; use when a request involves implementing mutable collections (like a vector) or handling Destruct/Drop with Felt252Dict.
---

# Cairo Custom Data Structures

## Overview
Guide users through building mutable data structures on top of dictionaries and traits, including proper destruction.

## Quick Use
- Read `references/custom-data-structures.md` before answering.
- Emphasize that arrays are immutable; use `Felt252Dict` for mutable storage.
- Call out `Destruct` implementations for structs containing dictionaries.

## Response Checklist
- Define a trait interface for the structure's operations.
- Store values in a `Felt252Dict` and track `len` separately when emulating vectors.
- Use `Nullable` when storing generic `T` in a dict.
- Implement `Destruct` to `squash()` dictionaries.

## Example Requests
- "How do I build a mutable vector in Cairo?"
- "Why does my struct with a dictionary need Destruct?"
- "How can I update a value by index?"

## Cairo by Example
- [Dictionaries](https://cairo-by-example.xyz/core/dict)
- [Drop and Destruct](https://cairo-by-example.xyz/trait/drop)
- [Testcase: linked-list](https://cairo-by-example.xyz/custom_types/enum/testcase_linked_list)

Files in this skill

  • SKILL.md1.3 KB
  • references/custom-data-structures.md835 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…