Installable skillApache-2.0

Cairo Ownership

Explain Cairo ownership, moves, Copy/Drop/Destruct traits, and scope-based destruction; use when a request involves use-after-move errors, copying values, or ownership semantics in Cairo.

BY David-Li0406UPDATED Oct 30, 2026
INTENDED FOR◈OpenClawInstall in a listed agent.

instructions.md

---
name: cairo-ownership-28d9d539f9c7
description: Explain Cairo ownership, moves, Copy/Drop/Destruct traits, and scope-based destruction; use when a request involves use-after-move errors, copying values, or ownership semantics in Cairo.
---

# Cairo Ownership

## Overview
Guide Cairo's ownership rules, move semantics, and destruction traits so code compiles without ownership errors.

## Quick Use
- Read `references/ownership.md` before answering.
- Identify whether the type is moved, copied, dropped, or destructed.
- Provide small examples showing the move or copy that fixes the error.

## Response Checklist
- State the three ownership rules and apply them to the failing line.
- If a value is used after move, suggest borrowing (snapshot/ref) or copying (Copy trait).
- Mention Drop vs Destruct when dictionaries or resource-like types are involved.

## Example Requests
- "Why is this variable unavailable after I pass it to a function?"
- "How do I make my struct Copy?"
- "Why can't I derive Drop for a struct containing a dictionary?"

## Cairo by Example
- [Scoping rules](https://cairo-by-example.xyz/scope)
- [RAII](https://cairo-by-example.xyz/scope/raii)
- [Ownership and moves](https://cairo-by-example.xyz/scope/move)
- [Mutability](https://cairo-by-example.xyz/scope/move/mut)
- [Drop and Destruct](https://cairo-by-example.xyz/trait/drop)
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.