Skip to content
Back to skills

Cairo Closures

ASecurity

Explain Cairo closures, syntax, capture rules, type inference, and Fn traits; use when a request involves anonymous functions or passing behavior as a parameter 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-closures --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cairo Closures?

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

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

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-closures
description: Explain Cairo closures, syntax, capture rules, type inference, and Fn traits; use when a request involves anonymous functions or passing behavior as a parameter in Cairo.
---

# Cairo Closures

## Overview
Guide closure syntax and how closures capture environment values in Cairo.

## Quick Use
- Read `references/closures.md` before answering.
- Use concise examples like `|x| x * 2` and multi-line closures with `{}`.
- Mention the current limitation on capturing mutable variables.

## Response Checklist
- Use pipe syntax for parameters and infer types when possible.
- Explain capture of outer bindings and when that affects trait bounds.
- Choose `FnOnce`, `FnMut`, or `Fn` based on how the closure uses captured values.

## Example Requests
- "How do I write a closure in Cairo?"
- "Why is the closure type inferred as `u8`?"
- "What is the difference between `FnOnce`, `FnMut`, and `Fn`?"

## Cairo by Example
- [Closures](https://cairo-by-example.xyz/fn/closures)
- [Capturing](https://cairo-by-example.xyz/fn/closures/capture)
- [As input parameters](https://cairo-by-example.xyz/fn/closures/input_parameters)
- [Input functions](https://cairo-by-example.xyz/fn/closures/input_functions)
- [Higher Order Functions](https://cairo-by-example.xyz/fn/hof)

Files in this skill

  • SKILL.md1.3 KB
  • references/closures.md1016 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…