1---2name: antonygiomarxdev-maverick-rust-no-magic-values3description: Rust — no magic literals4---56# Rust — no magic literals78## What serious codebases typically do910- **Compiler and Clippy**: favor `const` and rich types; teams often enable lints that reduce fragile `unwrap` patterns.11- **`const` / `static`**: protocol values and defaults live in dedicated modules so the meaning of each number has one home.12- **Enums**: closed sets with exhaustive `match`; prevent typos and drift across call sites.13- **Newtypes**: `struct X(u32)` or typed arrays (`Eui64`) to avoid mixing units or semantics.14- **Adapter layer**: table/column names and SQL fragments as `const` or a `schema` module, not copy-paste.15- **Configuration**: operational policy belongs in config structs or named presets (e.g. install profile), not ad hoc literals inside logic.1617## Checklist when changing code1819- [ ] Does this number or string encode domain or protocol meaning? → `const` or type.20- [ ] Is it a closed set of variants? → `enum` (+ serde/display where needed).21- [ ] Does the same literal already exist elsewhere? → unify in the right crate’s module.22- [ ] Is it SQLite/HTTP/UDP detail? → keep it in the adapter, but **centralized** there.2324## Anti-pattern2526A helper that takes `&str` for “event kind” used from many places without an enum: every call site is a future bug.2728---29> Source: [antonygiomarxdev/maverick](https://github.com/antonygiomarxdev/maverick) — distributed by [TomeVault](https://tomevault.io).30<!-- tomevault:4.0:skill_md:2026-06-16 -->
Run npx skillmds@latest add tomevault-io/antonygiomarxdev-maverick-rust-no-magic-values in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Rust — no magic literals It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.