Rust Module Organization & Public API Design
CommunityStructure Rust code for clarity and maintainability.
AuthorGoldziher
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill addresses the challenge of organizing Rust code effectively, ensuring a clear separation between internal implementation details and the public API, which is crucial for maintainability and preventing breaking changes.
Core Features & Use Cases
- Module Structure: Guides on organizing code into logical modules based on features and domain.
- Public API Definition: Best practices for defining a stable and user-friendly public API through re-exports in
lib.rs. - Visibility Control: Explains the use of
pub,pub(crate), andpub(super)for precise control over item visibility. - Feature Gates: Demonstrates how to use Cargo features to conditionally expose API elements.
- API Validation: Introduces
cargo-public-apifor tracking and preventing breaking changes. - Use Case: A Rust library maintainer needs to refactor their codebase to ensure a clean public API and prevent accidental exposure of internal implementation details, while also preparing for future feature additions.
Quick Start
Apply the principles of Rust module organization and public API design to structure your library's codebase for clarity and stability.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: Rust Module Organization & Public API Design Download link: https://github.com/Goldziher/spikard/archive/main.zip#rust-module-organization-public-api-design Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.