Skip to content
cccskills
FreePublished on GitHub

numeric-casts

Rules for numeric type conversions in Luma. Use when writing or reviewing code that casts between integer or float types, especially across different widths.

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md950 B

SKILL.md (original)

Review the instructions the agent will receive before you install.

Numeric Casts in Luma

Widening casts (smaller → larger)

Always use From/Into, never as:

// Correct
let x: u64 = u64::from(byte);
let x: u64 = byte.into();

// Wrong — triggers clippy::cast_lossless
let x = byte as u64;

clippy::cast_lossless enforces this automatically.

Narrowing casts (larger → smaller)

Only use as when the bound is provably safe and documented:

// Acceptable — bound is clear from context
let idx = offset as usize; // offset is always < usize::MAX by construction

// Preferred when bound is not obvious
let idx = usize::try_from(offset).expect("offset fits usize");

If overflow is possible and silent truncation is wrong, use try_from and handle the error explicitly.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Guidelines for writing platform-specific code in Luma. Use when adding or modifying code that behaves differently on Unix vs Windows, including shell commands, file paths, process spawning, or platform-specific tests.

The English summary is being prepared. Showing the original description.

nghyane/luma20Updated Jun 8, 2026

rfc

Free

Workflow for creating, updating, or superseding RFCs in Luma. Use when the task involves opening a new RFC, updating RFC status, marking an RFC as superseded or implemented, or deciding whether a change needs an RFC at all.

The English summary is being prepared. Showing the original description.

nghyane/luma20Updated Jun 8, 2026

See all skills by nghyane

Report a problem with this skill