# Cairo Modules Scope

> Explain Cairo modules, `mod` declarations, privacy, and scope control; use when a request involves organizing code into modules or resolving visibility errors in Cairo.

- Skill: `teddyjfpender/cairo-modules-scope` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add teddyjfpender/cairo-modules-scope`
- Raw SKILL.md: https://api.skillmd.com/api/skills/teddyjfpender/cairo-modules-scope/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: teddyjfpender (https://skillmd.com/u/teddyjfpender)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/teddyjfpender/cairo-modules-scope

---


# Cairo Modules and Scope

## Overview
Guide module declarations, nesting, and visibility rules in Cairo.

## Quick Use
- Read `references/modules-scope.md` before answering.
- Show where `mod` must appear and what file it refers to.
- Emphasize that items are private by default and require `pub` to expose.

## Response Checklist
- Declare modules with `mod name;` or inline `mod name { ... }`.
- Use `pub` to make modules or items public.
- Use `super` or `crate` to refer to parent or crate root.

## Example Requests
- "Why can't another module access my function?"
- "Where should I put `mod hosting;`?"
- "How do I make a module public?"

## Cairo by Example
- [Modules](https://cairo-by-example.xyz/mod)
- [Visibility](https://cairo-by-example.xyz/mod/visibility)
- [Struct visibility](https://cairo-by-example.xyz/mod/struct_visibility)

