Skip to content
Back to skills

Cairo Variables Mutability

ASecurity

Explain Cairo variable bindings, immutability, `mut`, constants, and shadowing; use when a request involves variable declaration, reassignment errors, changing types via shadowing, or defining constants in Cairo.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
documentation

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-variables-mutability --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cairo Variables Mutability?

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

Security grade badge for Cairo Variables Mutability
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-cairo-variables-mutability/badge)](https://www.skillsdirectory.com/skills/david-li0406-cairo-variables-mutability)

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-variables-mutability
description: Explain Cairo variable bindings, immutability, `mut`, constants, and shadowing; use when a request involves variable declaration, reassignment errors, changing types via shadowing, or defining constants in Cairo.
---

# Cairo Variables and Mutability

## Overview
Guide variable bindings in Cairo, including immutability, mutation with `mut`, constants, and shadowing.

## Quick Use
- Read `references/variables-mutability.md` before answering.
- Provide short, compile-ready examples that show correct use of `let`, `let mut`, `const`, and shadowing.
- When addressing errors, point to the specific rule violated (immutability, type change, or scope).

## Response Checklist
- Decide whether the variable should be immutable, mutable, or constant.
- If the name is reused or the type changes, prefer shadowing with a new `let`.
- For constants, require `const`, a type annotation, and global scope.

## Example Requests
- "Why does `x = 6` fail after `let x = 5` in Cairo?"
- "Should I use `mut` or shadowing when converting `u64` to `felt252`?"
- "How do I declare a constant in Cairo?"

## Cairo by Example
- [Variable Bindings](https://cairo-by-example.xyz/variable_bindings)
- [Mutability](https://cairo-by-example.xyz/variable_bindings/mut)
- [Scope and Shadowing](https://cairo-by-example.xyz/variable_bindings/scope)
- [Freezing](https://cairo-by-example.xyz/variable_bindings/freeze)
- [Constants](https://cairo-by-example.xyz/custom_types/constants)

Files in this skill

  • SKILL.md1.5 KB
  • references/variables-mutability.md1.1 KB

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…