Cairo Components

Explain Starknet components, embedding into contracts, and component interfaces; use when a request involves reusable contract logic or component-based design in Cairo.

teddyjfpender dd74f5a 2 files · 1.8 KB Updated

File contents

Cairo Components

Overview

Explain how to define, embed, and use components to share contract logic safely.

Quick Use

  • Read references/components.md before answering.
  • Use #[starknet::component] and component! for embedding.
  • Show both embeddable external functions and internal functions.

Response Checklist

  • Define component storage with #[storage] and an Event enum.
  • Use #[embeddable_as] on impls to expose entry points.
  • Embed component storage and events in the host contract.
  • Add #[abi(embed_v0)] impl aliases when embedding.

Example Requests

  • "How do I create a reusable component?"
  • "How do I embed a component into a contract?"
  • "What is the difference between embeddable and internal component functions?"

teddyjfpender/skill-issues/tree/main/skills/cairo-components commit dd74f5a61a

Frequently asked questions

npx skillmds@latest add teddyjfpender/cairo-components